public ISchedulingRule getSchedulingRule(IValidationContext helper) { if (helper instanceof IWorkbenchContext) { /* * Use a single build rule when running batch validation. */ return ResourcesPlugin.getWorkspace().getRuleFactory().buildRule(); } /* * For other kinds of validation, use no specific rule */ return null; }
public ISchedulingRule getSchedulingRule() { Set projs = gatherDependentProjects(getComponent(), new HashSet()); ISchedulingRule combinedRule = null; IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); for (Iterator iter = projs.iterator(); iter.hasNext();) { IProject proj = (IProject) iter.next(); ISchedulingRule rule = ruleFactory.createRule(proj); combinedRule = MultiRule.combine(rule, combinedRule); } combinedRule = MultiRule.combine(ruleFactory.buildRule(), combinedRule); return combinedRule; }
public static Job getBuildJob(final IProject[] projects) { Assert.isNotNull(projects); Job buildJob = new BuildJob(PDEUIMessages.BuildJob_building, projects); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; } }
private void doFullBuild(final IProject project) { Job buildJob = new Job(PDEUIMessages.CompilersConfigurationBlock_building) { @Override public boolean belongsTo(Object family) { return ResourcesPlugin.FAMILY_MANUAL_BUILD == family; } @Override protected IStatus run(IProgressMonitor monitor) { try { project.build(IncrementalProjectBuilder.FULL_BUILD, JavaCore.BUILDER_ID, null, monitor); } catch (CoreException e) { } return Status.OK_STATUS; } }; buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.schedule(); }
/** * Returns a build job that will perform a full build on the given projects. * * If <code>projects</code> are null, then an AssertionFailedException is * thrown * * @param projects the projects to build * @return the build job * @throws AssertionFailedException if the given projects are null */ public static Job getBuildJob(final IProject[] projects) { Assert.isNotNull(projects); Job buildJob = new BuildJob(UtilMessages.Util_4, projects); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
/** * Starts a job that will build the workspace */ private void runBuildJob() { Job buildJob = new Job(PDEUIMessages.CompilersConfigurationBlock_building) { @Override public boolean belongsTo(Object family) { return ResourcesPlugin.FAMILY_AUTO_BUILD == family; } @Override protected IStatus run(IProgressMonitor monitor) { try { PDEPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); } catch (CoreException e) { } return Status.OK_STATUS; } }; buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.schedule(); }
/** * Returns a build job * @param project The project to build or <code>null</code> to build the workspace. * @return the build job */ public static Job getBuildJob(final IProject project) { Job buildJob= new BuildJob(JavaUIMessages.CoreUtility_job_title, project); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
/** * Returns a build job * @param project The project to build or <code>null</code> to build the workspace. */ public static Job getBuildJob(final IProject project) { Job buildJob= new BuildJob(JavaUIMessages.CoreUtility_job_title, project); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
@Override protected Job getBuildJob(IProject project) { Job buildJob = new OptionsConfigurationBlock.BuildJob(Messages.BuilderConfigurationBlock_BuildJob_Title0, project); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
public BuildJob(String name, List<IProject> projects) { super(name); setRule(workspace.getRuleFactory().buildRule()); updateTaskName(projects); }
/** * Returns a build job * @param project The project to build or <code>null</code> to build the workspace. * @return the build job */ public static Job getBuildJob(final IProject project) { Job buildJob= new BuildJob(JavaUIMessages.CoreUtility_job_title, project); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
/** * Returns a build job that will return the build that corresponds to the * given build kind on the given projects. * * If <code>projects</code> are null, then an AssertionFailedException is * thrown * * @param projects the projects to build * @param buildKind the given build kind * @return the build job * @throws AssertionFailedException if the given projects are null */ public static Job getBuildJob(final IProject[] projects, int buildKind) { Assert.isNotNull(projects); Job buildJob = new BuildJob(UtilMessages.Util_4, projects, buildKind); buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); return buildJob; }
cleanJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); cleanJob.setUser(true); cleanJob.setProperty(IProgressConstants2.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
@Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { doClean(cleanAll, monitor); //see if a build was requested if (buildAll) { // Only build what was requested if (globalBuild) { //start an immediate workspace build GlobalBuildAction build = new GlobalBuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD); build.doBuild(); } else { // Only build what was cleaned IProject[] projects = new IProject[selection.length]; for (int i = 0; i < selection.length; i++) { projects[i] = (IProject) selection[i]; } ProjectSubsetBuildAction projectBuild = new ProjectSubsetBuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD, projects); projectBuild.runInBackground( ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); } } return Status.OK_STATUS; } };
/** * Called before checking the pre-conditions of an operation. Optionally supply * a scheduling rule to determine when the operation is safe to run. If a scheduling * rule is supplied, this method will block until it is safe to run. * * @param rule the scheduling rule that describes what this operation intends to modify. */ public void prepareOperation(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { try { //make sure autobuild is not running if it conflicts with this operation ISchedulingRule buildRule = getRuleFactory().buildRule(); if (rule != null && buildRule != null && (rule.isConflicting(buildRule) || buildRule.isConflicting(rule))) buildManager.interrupt(); } finally { getWorkManager().checkIn(rule, monitor); } if (!isOpen()) { String message = Messages.resources_workspaceClosed; throw new ResourceException(IResourceStatus.OPERATION_FAILED, null, message, null); } }
/** * Called before checking the pre-conditions of an operation. Optionally supply * a scheduling rule to determine when the operation is safe to run. If a scheduling * rule is supplied, this method will block until it is safe to run. * * @param rule the scheduling rule that describes what this operation intends to modify. */ public void prepareOperation(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { try { //make sure autobuild is not running if it conflicts with this operation ISchedulingRule buildRule = getRuleFactory().buildRule(); if (rule != null && buildRule != null && (rule.isConflicting(buildRule) || buildRule.isConflicting(rule))) buildManager.interrupt(); } finally { getWorkManager().checkIn(rule, monitor); } if (!isOpen()) { String message = Messages.resources_workspaceClosed; throw new ResourceException(IResourceStatus.OPERATION_FAILED, null, message, null); } }
/** * Called before checking the pre-conditions of an operation. Optionally supply * a scheduling rule to determine when the operation is safe to run. If a scheduling * rule is supplied, this method will block until it is safe to run. * * @param rule the scheduling rule that describes what this operation intends to modify. */ public void prepareOperation(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { try { //make sure autobuild is not running if it conflicts with this operation ISchedulingRule buildRule = getRuleFactory().buildRule(); if (rule != null && buildRule != null && (rule.isConflicting(buildRule) || buildRule.isConflicting(rule))) buildManager.interrupt(); } finally { getWorkManager().checkIn(rule, monitor); } if (!isOpen()) { String message = Messages.resources_workspaceClosed; throw new ResourceException(IResourceStatus.OPERATION_FAILED, null, message, null); } }
try { monitor.beginTask("", Policy.opWork); //$NON-NLS-1$ final ISchedulingRule rule = workspace.getRuleFactory().buildRule(); try { workspace.prepareOperation(rule, monitor);
try { monitor.beginTask("", Policy.opWork); //$NON-NLS-1$ final ISchedulingRule rule = workspace.getRuleFactory().buildRule(); try { workspace.prepareOperation(rule, monitor);
private void doBuild(IProgressMonitor monitor) throws CoreException, OperationCanceledException { SubMonitor subMonitor = SubMonitor.convert(monitor, Policy.opWork + 1); final ISchedulingRule rule = workspace.getRuleFactory().buildRule(); try { workspace.prepareOperation(rule, subMonitor.split(1)); workspace.beginOperation(true); final int trigger = IncrementalProjectBuilder.AUTO_BUILD; workspace.broadcastBuildEvent(workspace, IResourceChangeEvent.PRE_BUILD, trigger); IStatus result = Status.OK_STATUS; try { if (shouldBuild()) result = workspace.getBuildManager().build(workspace.getBuildOrder(), ICoreConstants.EMPTY_BUILD_CONFIG_ARRAY, trigger, subMonitor.split(Policy.opWork)); } finally { //always send POST_BUILD if there has been a PRE_BUILD workspace.broadcastBuildEvent(workspace, IResourceChangeEvent.POST_BUILD, trigger); } if (!result.isOK()) { throw new ResourceException(result); } buildNeeded = false; } finally { //building may close the tree, but we are still inside an // operation so open it if (workspace.getElementTree().isImmutable()) { workspace.newWorkingTree(); } workspace.endOperation(rule, false); } }