Java Code Examples for org.eclipse.jdt.internal.ui.util.CoreUtility#setAutoBuilding()

The following examples show how to use org.eclipse.jdt.internal.ui.util.CoreUtility#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: NewJavaProjectWizardPageTwo.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Called from the wizard on finish.
 *
 * @param monitor the progress monitor
 * @throws CoreException thrown when the project creation or configuration failed
 * @throws InterruptedException thrown when the user cancelled the project creation
 */
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
	try {
		monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3);
		if (fCurrProject == null) {
			updateProject(new SubProgressMonitor(monitor, 1));
		}
		String newProjectCompliance= fKeepContent ? null : fFirstPage.getCompilerCompliance();
		configureJavaProject(newProjectCompliance, new SubProgressMonitor(monitor, 2));
		
	} finally {
		monitor.done();
		fCurrProject= null;
		if (fIsAutobuild != null) {
			CoreUtility.setAutoBuilding(fIsAutobuild.booleanValue());
			fIsAutobuild= null;
		}
	}
}
 
Example 2
Source File: BuildSettingWizardPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
/**
 * Called from the wizard on finish.
 *
 * @param monitor the progress monitor
 * @throws CoreException thrown when the project creation or configuration failed
 * @throws InterruptedException thrown when the user canceled the project creation
 */
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
	final SubMonitor subMonitor = SubMonitor.convert(monitor, 4);
	try {
		monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3);
		if (this.currProject == null) {
			updateProject(subMonitor.newChild(1));
		}

		final String newProjectCompliance = this.keepContent ? null : this.firstPage.getCompilerCompliance();
		configureJavaProject(newProjectCompliance, subMonitor.newChild(1));
	} catch (Throwable e) {
		if (this.currProject != null) {
			removeProvisonalProject();
		}
		throw e;
	} finally {
		subMonitor.done();
		this.currProject = null;
		if (this.isAutobuild != null) {
			CoreUtility.setAutoBuilding(this.isAutobuild.booleanValue());
			this.isAutobuild = null;
		}
	}
}
 
Example 3
Source File: BuildSettingWizardPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
private void doRemoveProject(IProgressMonitor monitor) throws InvocationTargetException {
	// Test if the project is inside the workspace
	final boolean noProgressMonitor = this.currProjectLocation == null;
	final SubMonitor subMonitor = SubMonitor.convert(noProgressMonitor ? null : monitor, 3);
	subMonitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_remove, 3);
	try {
		try {
			final URI projLoc = this.currProject.getLocationURI();

			final boolean removeContent = !this.keepContent
					&& this.currProject.isSynchronized(IResource.DEPTH_INFINITE);
			if (!removeContent) {
				restoreExistingFolders(projLoc);
			}
			this.currProject.delete(removeContent, false, subMonitor.newChild(2));

			restoreExistingFiles(projLoc, subMonitor.newChild(1));
		} finally {
			// fIsAutobuild must be set
			CoreUtility.setAutoBuilding(this.isAutobuild.booleanValue());
			this.isAutobuild = null;
		}
	} catch (CoreException e) {
		throw new InvocationTargetException(e);
	} finally {
		subMonitor.done();
		this.currProject = null;
		this.keepContent = false;
	}
}
 
Example 4
Source File: BinaryRefactoringHistoryWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected RefactoringStatus aboutToPerformHistory(final IProgressMonitor monitor) {
	final RefactoringStatus status= new RefactoringStatus();
	try {
		fJavaProject= null;
		fSourceFolder= null;
		fProcessedFragments.clear();
		monitor.beginTask(JarImportMessages.JarImportWizard_prepare_import, 520);
		status.merge(super.aboutToPerformHistory(new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
		if (!status.hasFatalError()) {
			final IPackageFragmentRoot root= getPackageFragmentRoot();
			if (root != null) {
				status.merge(checkPackageFragmentRoots(root, new SubProgressMonitor(monitor, 90, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
				if (!status.hasFatalError()) {
					status.merge(checkSourceAttachmentRefactorings(new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
					if (!status.hasFatalError()) {
						final IJavaProject project= root.getJavaProject();
						if (project != null) {
							final IFolder folder= project.getProject().getFolder(SOURCE_FOLDER + String.valueOf(System.currentTimeMillis()));
							try {
								fAutoBuild= CoreUtility.setAutoBuilding(false);
								final RefactoringHistory history= getRefactoringHistory();
								if (history != null && !history.isEmpty())
									configureClasspath(project, root, folder, new SubProgressMonitor(monitor, 300, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
							} catch (CoreException exception) {
								status.merge(RefactoringStatus.createFatalErrorStatus(exception.getLocalizedMessage()));
								try {
									project.setRawClasspath(project.readRawClasspath(), false, new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
								} catch (CoreException throwable) {
									JavaPlugin.log(throwable);
								}
							} finally {
								if (!status.hasFatalError()) {
									fJavaProject= project;
									fSourceFolder= folder;
								}
							}
						}
					}
				}
			}
		}
	} finally {
		monitor.done();
	}
	return status;
}