Java Code Examples for org.eclipse.core.resources.IWorkspaceDescription#setAutoBuilding()
The following examples show how to use
org.eclipse.core.resources.IWorkspaceDescription#setAutoBuilding() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AutobuildUtils.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** Sets workspace auto-build according to the provided flag. Thrown exceptions are handled by logging. */ static public void set(boolean enable) { if (isWorkbenchRunning()) { IWorkspace workspace = getWorkspace(); IWorkspaceDescription workspaceDescription = workspace.getDescription(); if (null != workspaceDescription) { if (workspaceDescription.isAutoBuilding() != enable) { workspaceDescription.setAutoBuilding(enable); try { LOG.info("Turning auto-build " + (enable ? "on" : "off") + "..."); workspace.setDescription(workspaceDescription); LOG.info("Auto-build was successfully turned " + (enable ? "on" : "off") + "."); } catch (CoreException e) { throw new IllegalStateException("Error while trying to turn workspace autobuild " + (enable ? "on" : "off") + ".", e); } } } } else { LOG.info("Workbench is not running, cannot change autobuild settings."); } }
Example 2
Source File: Repository.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void enableBuild() { Job.getJobManager().wakeUp(ResourcesPlugin.FAMILY_AUTO_BUILD); final IWorkspaceDescription desc = workspace.getDescription(); if (desc != null && !desc.isAutoBuilding()) { final boolean enableAutobuild = PlatformUI.isWorkbenchRunning(); desc.setAutoBuilding(enableAutobuild); try { workspace.setDescription(desc); } catch (final CoreException e) { BonitaStudioLog.error(e, CommonRepositoryPlugin.PLUGIN_ID); } RepositoryManager.getInstance().getPreferenceStore().setValue(RepositoryPreferenceConstant.BUILD_ENABLE, enableAutobuild); } }
Example 3
Source File: ParserPreferencePage.java From tlaplus with MIT License | 6 votes |
/** * 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(); } } }
Example 4
Source File: XtextTestProjectManager.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** {@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; } }
Example 5
Source File: Repository.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void disableBuild() { final IWorkspaceDescription desc = workspace.getDescription(); if (desc != null && desc.isAutoBuilding()) { desc.setAutoBuilding(false); try { workspace.setDescription(desc); } catch (final CoreException e) { BonitaStudioLog.error(e, CommonRepositoryPlugin.PLUGIN_ID); } RepositoryManager.getInstance().getPreferenceStore().setValue(RepositoryPreferenceConstant.BUILD_ENABLE, false); } }
Example 6
Source File: BaseTest.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
public static Boolean setWorkspaceAutoBuild(boolean enabled) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription wsDescription = workspace.getDescription(); boolean origEnabled = wsDescription.isAutoBuilding(); if (enabled != origEnabled) { try { wsDescription.setAutoBuilding(enabled); workspace.setDescription(wsDescription); return origEnabled ? Boolean.TRUE : Boolean.FALSE; } catch (CoreException e) { TestUtil.print("Failed to set workspace auto build enabled to: " + enabled, e); } } return null; }
Example 7
Source File: CommonCoreTest.java From goclipse with Eclipse Public License 1.0 | 5 votes |
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); } }
Example 8
Source File: CoreUtility.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example 9
Source File: ProjectTestUtil.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * 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); } }
Example 10
Source File: BuildAffectionTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@AfterClass public static void tearDownProject() throws Exception { IResourcesSetupUtil.cleanWorkspace(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(BuildAffectionTest.wasAutoBuilding); workspace.setDescription(description); }
Example 11
Source File: BuildAffectionTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@BeforeClass public static void setUpProject() throws Exception { TargetPlatformUtil.setTargetPlatform(BuildAffectionTest.class); IResourcesSetupUtil.cleanWorkspace(); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IWorkspaceDescription description = workspace.getDescription(); BuildAffectionTest.wasAutoBuilding = description.isAutoBuilding(); description.setAutoBuilding(false); workspace.setDescription(description); WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME); }
Example 12
Source File: JavaProjectHelper.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Sets auto-building state for the test workspace. * * @param state * The new auto building state * @return The previous state * @throws CoreException * Change failed */ public static boolean setAutoBuilding(boolean state) throws CoreException { // disable auto build IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription desc = workspace.getDescription(); boolean result = desc.isAutoBuilding(); desc.setAutoBuilding(state); workspace.setDescription(desc); return result; }
Example 13
Source File: BuilderUtils.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
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; }
Example 14
Source File: JavaLanguageServerTestPlugin.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void start(BundleContext context) throws Exception { TestVMType.setTestJREAsDefault("1.8"); JavaCore.initializeAfterLoad(new NullProgressMonitor()); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(true); workspace.setDescription(description); }
Example 15
Source File: JavaSyntaxServerTestPlugin.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void start(BundleContext context) throws Exception { JavaCore.initializeAfterLoad(new NullProgressMonitor()); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(false); workspace.setDescription(description); }
Example 16
Source File: ProjectsManager.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static 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; }
Example 17
Source File: IResourcesSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static boolean setAutobuild(boolean enable) { IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription(); boolean oldValue = description.isAutoBuilding(); if (oldValue != enable) { description.setAutoBuilding(enable); try { ResourcesPlugin.getWorkspace().setDescription(description); } catch (CoreException e) { Exceptions.sneakyThrow(e); } } return oldValue; }
Example 18
Source File: InternalBuilderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static void setAutoBuild(boolean b) { System.out.println("Setting auto-build to " + b); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { IWorkspaceDescription desc = workspace.getDescription(); desc.setAutoBuilding(b); workspace.setDescription(desc); } catch (CoreException e) { e.printStackTrace(); } }