Java 类org.eclipse.core.resources.IWorkspaceDescription 实例源码

项目:n4js    文件:AbstractBuilderTest.java   
private void toggleAutobuild(final boolean enable) {
    if (isWorkbenchRunning()) {
        final IWorkspaceDescription workspaceDescription = getWorkspace().getDescription();
        if (null != workspaceDescription) {
            if (workspaceDescription.isAutoBuilding() != enable) {
                workspaceDescription.setAutoBuilding(enable);
                try {
                    getWorkspace().setDescription(workspaceDescription);
                } catch (final CoreException e) {
                    throw new IllegalStateException("Error while trying to turn workspace autobuild "
                            + (enable ? "on" : "off") + ".", e);
                }
            }
        }

    }
}
项目:dsl-devkit    文件:XtextTestProjectManager.java   
/** {@inheritDoc} */
@Override
public boolean setAutobuild(final boolean autoBuildStatus) {
  synchronized (autoBuildMutex) {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    boolean oldAutoBuildStatus = description.isAutoBuilding();
    if (oldAutoBuildStatus != autoBuildStatus) {
      description.setAutoBuilding(autoBuildStatus);
      try {
        workspace.setDescription(description);
      } catch (CoreException e) {
        throw new WrappedException("Failed to set workspace description", e);
      }
    }
    return oldAutoBuildStatus;
  }
}
项目:tlaplus    文件:ParserPreferencePage.java   
/**
 * Sets the value of the workspace auto-build to the module auto-build 
 */
private void setAutoBuilding()
{
    boolean autoBuildModule = getPreferenceStore().getBoolean(IPreferenceConstants.I_PARSE_MODULE_ON_MODIFY);

    // set the workspace auto-build flag
    IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription();
    if (autoBuildModule != ResourcesPlugin.getWorkspace().isAutoBuilding())
    {
        try
        {
            description.setAutoBuilding(autoBuildModule);
            ResourcesPlugin.getWorkspace().setDescription(description);
        } catch (CoreException e)
        {
            // TODO
            e.printStackTrace();
        }
    }
}
项目:reflectify    文件:FileBasedTest.java   
@Override
public void setUpSuite() throws Exception {
    // ensure auto-building is turned off
       IWorkspaceDescription descr = getWorkspace().getDescription();
       if (descr.isAutoBuilding()) {
           descr.setAutoBuilding(false);
           getWorkspace().setDescription(descr);
       }
       try {
        if (testProjects != null) {
            for (String curPrj : testProjects) {
                setUpJavaProject(curPrj);
            }
        }
    }
       catch (NullPointerException ex) {
        throw new IllegalStateException("Test project has not been set properly!");
    }

    super.setUpSuite();
}
项目:n4js    文件:AbstractIDEBUG_Test.java   
private static void toggleAutobuild(final boolean enabled) {
    final IWorkspace workspace = getWorkspace();
    final IWorkspaceDescription description = workspace.getDescription();
    description.setAutoBuilding(enabled);
    try {
        LOGGER.info("Turning auto-build " + (enabled ? "on" : "off") + "...");
        workspace.setDescription(description);
        LOGGER.info("Auto-build was successfully turned " + (enabled ? "on" : "off") + ".");
    } catch (final CoreException e) {
        throw new RuntimeException("Error while toggling auto-build", e);
    }
}
项目:n4js    文件:N4JSOrganizeImportsHandler.java   
/** Sets workspace auto-build according to the provided flag. Thrown exceptions are handled by logging. */
private static void setAutobuild(boolean on) {
    try {
        final IWorkspace workspace = getWorkspace();
        final IWorkspaceDescription description = workspace.getDescription();
        description.setAutoBuilding(on);
        workspace.setDescription(description);
    } catch (CoreException e) {
        LOGGER.debug("Organize imports cannot set auto build to " + on + ".");
    }
}
项目:gw4e.project    文件:ResourceManager.java   
/**
 * @param value
 */
public static void setAutoBuilding(boolean value) {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    if (workspace.isAutoBuilding() == value)
        return;
    IWorkspaceDescription desc = workspace.getDescription();
    desc.setAutoBuilding(value);
    try {
        workspace.setDescription(desc);
    } catch (CoreException e) {
        ResourceManager.logException(e);
    }
}
项目:gw4e.project    文件:ResourceManager.java   
/**
 * @return
 */
public static boolean isAutoBuilding() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = workspace.getDescription();
    return desc.isAutoBuilding();

}
项目:VerveineC-Cpp    文件:VerveineCParser.java   
private void configWorkspace(IWorkspace workspace) {
    IWorkspaceDescription workspaceDesc = workspace.getDescription();
    workspaceDesc.setAutoBuilding(false); // we do not want the workspace to rebuild the project every time a new resource is added
    try {
        workspace.setDescription(workspaceDesc);
    } catch (CoreException exc) {
        Activator.log(IStatus.ERROR, "Error trying to set workspace description: " + exc.getMessage());
    }

}
项目:Vitruv    文件:EclipseBridge.java   
/**
 * Turns off the automatic build feature of the workbench if it is currently switched on and
 * returns {@code true} when this was the case.
 * 
 * @return whether autobuild was on
 * @throws CoreException
 *             if the feature could not be set
 */
public static boolean turnOffAutoBuildIfOn() throws CoreException {
    final IWorkspace workspace = ResourcesPlugin.getWorkspace();
    final IWorkspaceDescription description = workspace.getDescription();
    if (description.isAutoBuilding()) {
        description.setAutoBuilding(false);
        workspace.setDescription(description);
        return true;
    } else {
        return false;
    }
}
项目:Vitruv    文件:EclipseBridge.java   
/**
 * Turns on the automatic build feature of the workbench.
 * 
 * @throws CoreException
 *             if the feature could not be set
 */
public static void turnOnAutoBuild() throws CoreException {
    final IWorkspace workspace = ResourcesPlugin.getWorkspace();
    final IWorkspaceDescription description = workspace.getDescription();
    if (!description.isAutoBuilding()) {
        description.setAutoBuilding(true);
        workspace.setDescription(description);
    }
}
项目:turnus.orcc    文件:OrccCodeAnalysisCli.java   
private void disableAutoBuild() throws CoreException {
    IWorkspaceDescription desc = workspace.getDescription();
    if (desc.isAutoBuilding()) {
        isAutoBuildActivated = true;
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccCodeAnalysisCli.java   
private void restoreAutoBuild() throws CoreException {
    if (isAutoBuildActivated) {
        IWorkspaceDescription desc = workspace.getDescription();
        desc.setAutoBuilding(true);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:TabuSearchPerformanceEstimationCli.java   
private void disableAutoBuild() throws CoreException {
    IWorkspaceDescription desc = workspace.getDescription();
    if (desc.isAutoBuilding()) {
        isAutoBuildActivated = true;
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:TabuSearchPerformanceEstimationCli.java   
private void restoreAutoBuild() throws CoreException {
    if (isAutoBuildActivated) {
        IWorkspaceDescription desc = workspace.getDescription();
        desc.setAutoBuilding(true);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccNumaExecutionCli.java   
private void disableAutoBuild() throws CoreException {
    IWorkspaceDescription desc = workspace.getDescription();
    if (desc.isAutoBuilding()) {
        isAutoBuildActivated = true;
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccNumaExecutionCli.java   
private void restoreAutoBuild() throws CoreException {
    if (isAutoBuildActivated) {
        IWorkspaceDescription desc = workspace.getDescription();
        desc.setAutoBuilding(true);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccDynamicExecutionCli.java   
private void disableAutoBuild() throws CoreException {
    IWorkspaceDescription desc = workspace.getDescription();
    if (desc.isAutoBuilding()) {
        isAutoBuildActivated = true;
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccDynamicExecutionCli.java   
private void restoreAutoBuild() throws CoreException {
    if (isAutoBuildActivated) {
        IWorkspaceDescription desc = workspace.getDescription();
        desc.setAutoBuilding(true);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccDynamicInterpreterCli.java   
private void disableAutoBuild() throws CoreException {
    IWorkspaceDescription desc = workspace.getDescription();
    if (desc.isAutoBuilding()) {
        isAutoBuildActivated = true;
        desc.setAutoBuilding(false);
        workspace.setDescription(desc);
    }
}
项目:turnus.orcc    文件:OrccDynamicInterpreterCli.java   
private void restoreAutoBuild() throws CoreException {
    if (isAutoBuildActivated) {
        IWorkspaceDescription desc = workspace.getDescription();
        desc.setAutoBuilding(true);
        workspace.setDescription(desc);
    }
}
项目:eclipse.jdt.ls    文件:ProjectsManager.java   
public boolean setAutoBuilding(boolean enable) throws CoreException {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    boolean changed = description.isAutoBuilding() != enable;
    if (changed) {
        description.setAutoBuilding(enable);
        workspace.setDescription(description);
    }
    return changed;
}
项目:cft    文件:StsTestUtil.java   
public static void setAutoBuilding(boolean enabled) throws CoreException {
    IWorkspaceDescription wsd = getWorkspace().getDescription();
    if (!wsd.isAutoBuilding() == enabled) {
        wsd.setAutoBuilding(enabled);
        getWorkspace().setDescription(wsd);
    }
}
项目:gwt-eclipse-plugin    文件:ProjectTestUtil.java   
/**
 * Enables or disables automatic building of projects.
 */
public static void setAutoBuilding(boolean enable) throws CoreException {
  IWorkspaceDescription desc = ResourcesPlugin.getWorkspace().getDescription();
  if (desc.isAutoBuilding() != enable) {
    desc.setAutoBuilding(enable);
    ResourcesPlugin.getWorkspace().setDescription(desc);
  }
}
项目:m2e-nar    文件:AbstractTestBuild.java   
@SuppressWarnings("deprecation")
@Before
public void setUp() throws Exception {
    workspace = ResourcesPlugin.getWorkspace();

    // Turn off auto building
    IWorkspaceDescription description = workspace.getDescription();
    description.setAutoBuilding(false);
    workspace.setDescription(description);

    // Turn off index updating
    IEclipsePreferences store = new DefaultScope().getNode(IMavenConstants.PLUGIN_ID);
    store.putBoolean(MavenPreferenceConstants.P_UPDATE_INDEXES, false);

    mavenConfiguration = MavenPlugin.getMavenConfiguration();

    if (settingsFile != null) {
        oldUserSettingsFile = mavenConfiguration.getUserSettingsFile();
        File settings = new File(settingsFile).getCanonicalFile();
        if (settings.canRead()) {
            String userSettingsFile = settings.getAbsolutePath();
            System.out.println("Setting user settings file: " + userSettingsFile);
            mavenConfiguration.setUserSettingsFile(userSettingsFile);
        } else {
            fail("User settings file cannot be read: " + settings);
        }
    }

    cleanWorkspace();
    waitForJobs();

}
项目:Eclipse-Postfix-Code-Completion    文件:CoreUtility.java   
/**
* Sets whether building automatically is enabled in the workspace or not and returns the old
* value.
* 
* @param state <code>true</code> if automatically building is enabled, <code>false</code>
*            otherwise
* @return the old state
* @throws CoreException thrown if the operation failed
*/
  public static boolean setAutoBuilding(boolean state) throws CoreException {
      IWorkspace workspace= ResourcesPlugin.getWorkspace();
      IWorkspaceDescription desc= workspace.getDescription();
      boolean isAutoBuilding= desc.isAutoBuilding();
      if (isAutoBuilding != state) {
          desc.setAutoBuilding(state);
          workspace.setDescription(desc);
      }
      return isAutoBuilding;
  }
项目:sya    文件:CTestPlugin.java   
public static void enableAutobuild(boolean enable) throws CoreException {
    // disable auto build
    IWorkspace workspace= CTestPlugin.getWorkspace();
    IWorkspaceDescription desc= workspace.getDescription();
    desc.setAutoBuilding(enable);
    workspace.setDescription(desc);
}
项目:idecore    文件:SimpleTestCase.java   
protected void switchAutoBuild(boolean bool) {
    IWorkspace ws = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = ws.getDescription();
    desc.setAutoBuilding(bool);
    try {
        ws.setDescription(desc);
    } catch (CoreException e) {
        System.err.println("Unable to disable auto building: " + e.getMessage());
        e.printStackTrace();
    }
}
项目:idecore    文件:IdeProjectFixture.java   
public void switchAutoBuild(boolean bool) throws IdeTestException {
    IWorkspace ws = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = ws.getDescription();
    desc.setAutoBuilding(bool);
    try {
        ws.setDescription(desc);
    } catch (CoreException e) {
        IdeTestException.wrapAndThrowException("Unable to disable auto building: " + e);
    }

    logger.debug((bool ? "Enabled" : "Disabled") + " autobuild");
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CoreUtility.java   
/**
* Sets whether building automatically is enabled in the workspace or not and returns the old
* value.
* 
* @param state <code>true</code> if automatically building is enabled, <code>false</code>
*            otherwise
* @return the old state
* @throws CoreException thrown if the operation failed
*/
  public static boolean setAutoBuilding(boolean state) throws CoreException {
      IWorkspace workspace= ResourcesPlugin.getWorkspace();
      IWorkspaceDescription desc= workspace.getDescription();
      boolean isAutoBuilding= desc.isAutoBuilding();
      if (isAutoBuilding != state) {
          desc.setAutoBuilding(state);
          workspace.setDescription(desc);
      }
      return isAutoBuilding;
  }
项目:FindBug-for-Domino-Designer    文件:FindBugsAction.java   
@Override
public void run(final IAction action) {
    if (selection == null || selection.isEmpty()) {
        return;
    }
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    if (!description.isAutoBuilding() && getClass().equals(FindBugsAction.class)) {
        boolean confirm = MessageDialog.openConfirm(null, "Project -> 'Build Automatically' disabled",
                "You are going to run FindBugs analysis on a not compiled or partially compiled project.\n\n"
                        + "To get reliable analysis results, you should make sure that project is compiled first.\n\n"
                        + "Continue with FindBugs analysis?");
        if (!confirm) {
            return;
        }
    }

    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sSelection = (IStructuredSelection) selection;

        dialogAlreadyShown = false;
        Map<IProject, List<WorkItem>> projectMap = ResourceUtils.getResourcesPerProject(sSelection);
        for (Map.Entry<IProject, List<WorkItem>> e : projectMap.entrySet()) {
            work(targetPart, e.getKey(), e.getValue());
        }
        targetPart = null;
        selection = null;
    }
}
项目:eclipse.spellchecker    文件:CoreUtility.java   
/**
* Sets whether building automatically is enabled in the workspace or not and returns the old
* value.
*
* @param state <code>true</code> if automatically building is enabled, <code>false</code>
*            otherwise
* @return the old state
* @throws CoreException thrown if the operation failed
*/
  public static boolean setAutoBuilding(boolean state) throws CoreException {
      IWorkspace workspace= ResourcesPlugin.getWorkspace();
      IWorkspaceDescription desc= workspace.getDescription();
      boolean isAutoBuilding= desc.isAutoBuilding();
      if (isAutoBuilding != state) {
          desc.setAutoBuilding(state);
          workspace.setDescription(desc);
      }
      return isAutoBuilding;
  }
项目:goclipse    文件:CommonCoreTest.java   
protected static void disableAutoBuild() {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc= workspace.getDescription();
    desc.setAutoBuilding(false);
    try {
        workspace.setDescription(desc);
    } catch (CoreException e) {
        throw melnorme.utilbox.core.ExceptionAdapter.unchecked(e);
    }
}
项目:MMINT    文件:MMINTTest.java   
@BeforeClass
public static void init() throws CoreException {

    //TODO MMINT[TESTS] Run it just once
    //TODO MMINT[TESTS] Warm-up z3
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    description.setAutoBuilding(false);
    workspace.setDescription(description);
    MMINT.setPreference(MMINTConstants.PREFERENCE_TESTS_ENABLED, "true");
}
项目:reflectify    文件:AbstractJavaModelTests.java   
public void setUpSuite() throws Exception {
    super.setUpSuite();

    // ensure autobuilding is turned off
    IWorkspaceDescription description = getWorkspace().getDescription();
    if (description.isAutoBuilding()) {
        description.setAutoBuilding(false);
        getWorkspace().setDescription(description);
    }
}
项目:egradle    文件:IDEUtil.java   
public static void setWorkspaceAutoBuild(boolean flag) throws CoreException {
    IWorkspace workspace = getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    description.setAutoBuilding(flag);
    workspace.setDescription(description);
}
项目:egradle    文件:IDEUtil.java   
public static boolean isWorkspaceAutoBuildEnabled() throws CoreException {
    IWorkspace workspace = getWorkspace();
    IWorkspaceDescription description = workspace.getDescription();
    return description.isAutoBuilding();
}
项目:che    文件:Workspace.java   
@Override
public IWorkspaceDescription getDescription() {
  WorkspaceDescription workingCopy = defaultWorkspaceDescription();
  //        description.copyTo(workingCopy);
  return workingCopy;
}
项目:che    文件:Workspace.java   
@Override
public void setDescription(IWorkspaceDescription iWorkspaceDescription) throws CoreException {
  throw new UnsupportedOperationException();
}
项目:cmake4cdt    文件:newCMakeProject.java   
protected final void turnOffAutoBuild(IWorkspace workspace) throws CoreException {
    IWorkspaceDescription workspaceDesc = workspace.getDescription();
    savedAutoBuildingValue = workspaceDesc.isAutoBuilding();
    workspaceDesc.setAutoBuilding(false);
    workspace.setDescription(workspaceDesc);
}