/** * Gets the text of the clean dialog, depending on whether the * workspace is currently in autobuild mode. * @return String the question the user will be asked. */ private static String getQuestion() { boolean autoBuilding = ResourcesPlugin.getWorkspace().isAutoBuilding(); if (autoBuilding) { return IDEWorkbenchMessages.CleanDialog_buildCleanAuto; } return IDEWorkbenchMessages.CleanDialog_buildCleanManual; }
/** * This method returns true if the global auto-build setting is turned on. */ public boolean isGlobalAutoBuildEnabled() { return ResourcesPlugin.getWorkspace().isAutoBuilding(); }
/** * Creates a new ToggleAutoBuildAction * @param window The window for parenting dialogs associated with this action */ public ToggleAutoBuildAction(IWorkbenchWindow window) { super(IDEWorkbenchMessages.Workbench_buildAutomatically); this.window = window; setChecked(ResourcesPlugin.getWorkspace().isAutoBuilding()); }
protected void createAutoBuildPref(Composite composite) { autoBuildButton = new Button(composite, SWT.CHECK); autoBuildButton.setText(IDEWorkbenchMessages.IDEWorkspacePreference_autobuild); autoBuildButton.setToolTipText(IDEWorkbenchMessages.IDEWorkspacePreference_autobuildToolTip); autoBuildButton.setSelection(ResourcesPlugin.getWorkspace() .isAutoBuilding()); }
/** * Returns whether a build command with the given trigger should * be enabled for the given selection. * @param projects The projects to use to determine enablement * @param trigger The build trigger (<code>IncrementalProjectBuilder.*_BUILD</code> constants). * @return <code>true</code> if the action should be enabled, and * <code>false</code> otherwise. */ public static boolean isEnabled(IProject[] projects, int trigger) { //incremental build is only enabled if all projects are not autobuilding if (trigger == IncrementalProjectBuilder.INCREMENTAL_BUILD && ResourcesPlugin.getWorkspace().isAutoBuilding()) { if (!matchingTrigger(projects, IncrementalProjectBuilder.AUTO_BUILD, false)) { return false; } } //finally we are building only if there is a builder that accepts the trigger return matchingTrigger(projects, trigger, true); }
private boolean disableAutobuild() throws CoreException { IWorkspace workspace = ResourcesPlugin.getWorkspace(); boolean autobuild = workspace.isAutoBuilding(); if (autobuild) { IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(false); workspace.setDescription(description); } return autobuild; }
/** * Updates the enablements of this page's controls. Subclasses may extend. */ protected void updateWidgetEnablements() { boolean saveDescription= fSaveDescriptionCheckbox.getSelection(); fDescriptionFileGroup.setEnabled(saveDescription); fDescriptionFileBrowseButton.setEnabled(saveDescription); fDescriptionFileText.setEnabled(saveDescription); fDescriptionFileLabel.setEnabled(saveDescription); boolean exportClassFiles= fJarPackage.areClassFilesExported() && !fJarPackage.areOutputFoldersExported(); fExportWarningsCheckbox.setEnabled(exportClassFiles); fExportErrorsCheckbox.setEnabled(exportClassFiles); boolean isAutobuilding= ResourcesPlugin.getWorkspace().isAutoBuilding(); fBuildIfNeededCheckbox.setEnabled(exportClassFiles && !isAutobuilding); fUseSourceFoldersCheckbox.setEnabled(fJarPackage.areJavaFilesExported() && !fJarPackage.areGeneratedFilesExported()); }
/** * Updates the enablements of this page's controls. Subclasses may extend. */ protected void updateWidgetEnablements() { boolean saveDescription= fSaveDescriptionCheckbox.getSelection(); fDescriptionFileGroup.setEnabled(saveDescription); fDescriptionFileBrowseButton.setEnabled(saveDescription); fDescriptionFileText.setEnabled(saveDescription); fDescriptionFileLabel.setEnabled(saveDescription); boolean exportClassFiles= fJarPackage.areClassFilesExported() && !fJarPackage.areOutputFoldersExported(); fExportWarningsCheckbox.setEnabled(exportClassFiles); fExportErrorsCheckbox.setEnabled(exportClassFiles); boolean isAutobuilding= ResourcesPlugin.getWorkspace().isAutoBuilding(); fBuildIfNeededCheckbox.setEnabled(exportClassFiles && !isAutobuilding); fUseSourceFoldersCheckbox.setEnabled(fJarPackage.areJavaFilesExported() && !fJarPackage.areGeneratedFilesExported()); }
/** * Updates the enablements of this page's controls. Subclasses may extend. */ protected void updateWidgetEnablements() { boolean saveDescription= fSaveDescriptionCheckbox.getSelection(); fDescriptionFileGroup.setEnabled(saveDescription); fDescriptionFileBrowseButton.setEnabled(saveDescription); fDescriptionFileText.setEnabled(saveDescription); fDescriptionFileLabel.setEnabled(saveDescription); boolean exportClassFiles= fJarPackage.areClassFilesExported() && !fJarPackage.areOutputFoldersExported(); fExportWarningsCheckbox.setEnabled(exportClassFiles); fExportErrorsCheckbox.setEnabled(exportClassFiles); boolean isAutobuilding= ResourcesPlugin.getWorkspace().isAutoBuilding(); fBuildIfNeededCheckbox.setEnabled(exportClassFiles && !isAutobuilding); fUseSourceFoldersCheckbox.setEnabled(fJarPackage.areJavaFilesExported() && !fJarPackage.areGeneratedFilesExported()); }
public void elementChanged(ElementChangedEvent event) { if (workspace != null && workspace.isAutoBuilding()) { try { if (event.getDelta() != null) { Set<IJavaProject> javaProjects = getJavaProjectsWithClasspathChange(event.getDelta()); if (!javaProjects.isEmpty()) { Set<IProject> projects = Sets.newHashSet(Iterables.filter(Iterables.transform(javaProjects, new Function<IJavaProject, IProject>() { public IProject apply(IJavaProject from) { return from.getProject(); } }), Predicates.notNull())); buildManager.scheduleBuildIfNecessary(projects); } } } catch (WrappedException e) { log.error(e.getCause().getMessage(), e.getCause()); } catch (RuntimeException e) { log.error(e.getMessage(), e); } } }
/** * Updates the enablements of this page's controls. Subclasses may extend. */ protected void updateWidgetEnablements() { boolean saveDescription= fSaveDescriptionCheckbox.getSelection(); fDescriptionFileGroup.setEnabled(saveDescription); fDescriptionFileBrowseButton.setEnabled(saveDescription); fDescriptionFileText.setEnabled(saveDescription); fDescriptionFileLabel.setEnabled(saveDescription); boolean exportClassFiles= fJarPackage.areClassFilesExported() && !fJarPackage.areOutputFoldersExported(); fExportWarningsCheckbox.setEnabled(exportClassFiles); fExportErrorsCheckbox.setEnabled(exportClassFiles); boolean isAutobuilding= ResourcesPlugin.getWorkspace().isAutoBuilding(); fBuildIfNeededCheckbox.setEnabled(exportClassFiles && !isAutobuilding); fUseSourceFoldersCheckbox.setEnabled(fJarPackage.areJavaFilesExported() && !fJarPackage.areGeneratedFilesExported()); }
if (ResourcesPlugin.getWorkspace().isAutoBuilding()) { currentProject.touch(null); } else {
@Override public void fillContextMenu(IMenuManager menu) { ISelection selection= getContext().getSelection(); if (!ResourcesPlugin.getWorkspace().isAutoBuilding() && isBuildTarget(selection)) { appendToGroup(menu, fBuildAction); } appendToGroup(menu, fRefreshAction); super.fillContextMenu(menu); }
@Override public void fillContextMenu(IMenuManager menu) { ISelection selection= getContext().getSelection(); if (!ResourcesPlugin.getWorkspace().isAutoBuilding() && isBuildTarget(selection)) { appendToGroup(menu, fBuildAction); } appendToGroup(menu, fRefreshAction); super.fillContextMenu(menu); }
public void fillContextMenu(IMenuManager menu) { ISelection selection= getContext().getSelection(); if (!ResourcesPlugin.getWorkspace().isAutoBuilding() && isBuildTarget(selection)) { appendToGroup(menu, fBuildAction); } appendToGroup(menu, fRefreshAction); super.fillContextMenu(menu); }
public static boolean ensureValid(IFile file, IProgressMonitor monitor) throws CoreException { // Force the build if autobuild is off IProject project = file.getProject(); if (!project.getWorkspace().isAutoBuilding()) { String builderID = ICoreConstants.FEATURE_FILENAME_DESCRIPTOR.equals(file.getName()) ? PDE.FEATURE_BUILDER_ID : PDE.MANIFEST_BUILDER_ID; project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, builderID, null, monitor); } if (hasErrors(file)) { // There are errors against this file - abort MessageDialog.openError(null, PDEUIMessages.BuildAction_ErrorDialog_Title, PDEUIMessages.BuildAction_ErrorDialog_Message); return false; } return true; }
protected void createComputationsOption(Composite parent) { fAddFragmentsButton = SWTFactory.createCheckButton(parent, PDEUIMessages.ImportWizard_SecondPage_addFragments, null, true, 1); if (getDialogSettings().get(SETTINGS_ADD_FRAGMENTS) != null) fAddFragmentsButton.setSelection(getDialogSettings().getBoolean(SETTINGS_ADD_FRAGMENTS)); else fAddFragmentsButton.setSelection(true); if (!PDEPlugin.getWorkspace().isAutoBuilding()) { fAutoBuildButton = SWTFactory.createCheckButton(parent, PDEUIMessages.BaseImportWizardSecondPage_autobuild, null, getDialogSettings().getBoolean(SETTINGS_AUTOBUILD), 1); } }
@Override public void linkActivated(HyperlinkEvent e) { try { getPage().getEditor().doSave(null); IPluginModelBase model = PluginRegistry.findModel(project); if (model != null) { ClasspathComputer.setClasspath(project, model); if (PDEPlugin.getWorkspace().isAutoBuilding()) { doFullBuild(project); } } } catch (CoreException e1) { } } });
public Change perform(IProgressMonitor pm) throws CoreException { SubMonitor localmonitor = SubMonitor.convert(pm); localmonitor.beginTask(IApiToolsConstants.EMPTY_STRING, 1); localmonitor.setTaskName(WizardMessages.ProjectUpdateChange_adding_nature_and_builder); IProjectDescription description = this.fProject.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = ApiPlugin.NATURE_ID; description.setNatureIds(newNatures); this.fProject.setDescription(description, localmonitor); IJavaProject javaProject = JavaCore.create(this.fProject); // make sure we get rid of the previous api description file ApiDescriptionManager.getManager().clean(javaProject, true, true); // we want a full build of the converted project next time a build is triggered if (ResourcesPlugin.getWorkspace().isAutoBuilding()) { Util.getBuildJob(new IProject[] { this.fProject }).schedule(); } else { /* * If autobuild is off, clear the last build state to force a full build of * this project on the next build. */ BuildState.setLastBuiltState(this.fProject, null); } Util.updateMonitor(localmonitor, 1); return null; } }
@Override public Change perform(IProgressMonitor pm) throws CoreException { SubMonitor localmonitor = SubMonitor.convert(pm); localmonitor.beginTask(IApiToolsConstants.EMPTY_STRING, 1); localmonitor.setTaskName(WizardMessages.ProjectUpdateChange_adding_nature_and_builder); IProjectDescription description = this.fProject.getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = ApiPlugin.NATURE_ID; description.setNatureIds(newNatures); this.fProject.setDescription(description, localmonitor); IJavaProject javaProject = JavaCore.create(this.fProject); // make sure we get rid of the previous api description file ApiDescriptionManager.getManager().clean(javaProject, true, true); // we want a full build of the converted project next time a build is // triggered if (ResourcesPlugin.getWorkspace().isAutoBuilding()) { Util.getBuildJob(new IProject[] { this.fProject }).schedule(); } else { /* * If autobuild is off, clear the last build state to force a full * build of this project on the next build. */ BuildState.setLastBuiltState(this.fProject, null); } localmonitor.split(1); return null; } }