當前位置: 首頁>>代碼示例>>Java>>正文


Java Job.setUser方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.jobs.Job.setUser方法的典型用法代碼示例。如果您正苦於以下問題:Java Job.setUser方法的具體用法?Java Job.setUser怎麽用?Java Job.setUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.jobs.Job的用法示例。


在下文中一共展示了Job.setUser方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateBuildPolicyFileFor

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
 * @param file
 */
public static void updateBuildPolicyFileFor(IFile file) {
	Job job = new WorkspaceJob("Updating Build Policies from " + file.getName()) {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(file);
			if (compilationUnit != null) {
				if (JDTManager.isGraphWalkerExecutionContextClass(compilationUnit)) {
					updateBuildPolicyFileForCompilatioUnit(compilationUnit);
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.setRule(file.getProject());
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:21,代碼來源:ResourceManager.java

示例2: createJob

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
 * @param jobname
 * @param tasks
 * @return
 */
public static Job createJob(String jobname, List<UITask.Task> tasks) {
	Job job = new Job(jobname) {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			SubMonitor subMonitor = SubMonitor.convert(monitor, tasks.size());
			for (UITask.Task task : tasks) {
				try {
					subMonitor.setTaskName(task.getSummary());
					workOnTask(task, subMonitor.split(1));
				} catch (Exception e) {
					return Status.CANCEL_STATUS;
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	return job;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:UITask.java

示例3: apply

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void apply() throws CoreException {
	Job job = new WorkspaceJob("GW4E Conversion Job") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				_apply(monitor);
			} catch (Exception e) {
				DialogManager.displayErrorMessage(MessageUtil.getString("project_conversion"), MessageUtil.getString("an_error_has_occured_while_configuring_the_project"), e);
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(testInterface.getJavaProject().getProject());
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:18,代碼來源:TestConvertor.java

示例4: update

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
 * @param project
 * @param buildPolicyFile
 * @param graphFilePath
 * @param updatedGenerators
 * @throws IOException
 * @throws CoreException
 * @throws InterruptedException
 */
public static void update(IProject project, IFile buildPolicyFile, String graphFilePath,
		List<String> updatedGenerators) throws IOException, CoreException, InterruptedException {
	Job job = new WorkspaceJob("Updating policies") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			try {
				_update(project, buildPolicyFile, graphFilePath, updatedGenerators, monitor);
			} catch (FileNotFoundException e) {
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setRule(buildPolicyFile.getProject());
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:BuildPolicyManager.java

示例5: performFinish

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public boolean performFinish() {
	final Configuration configuration = new Configuration();
	configuration.setValue(TRACE_FILE, optionsPage.getTraceFile());

	final Job job = new Job("Intra-Action communication analysis") {

		@Override
		protected IStatus run(IProgressMonitor monitor) {
			try {
				new IntraActionCommunicationAnalysisCli().start(configuration, monitor);
				EclipseUtils.refreshWorkspace(monitor);
			} catch (Exception e) {
				Logger.error(e.getMessage());
			}
			return Status.OK_STATUS;
		}
	};

	job.setUser(true);
	job.schedule();

	return true;
}
 
開發者ID:turnus,項目名稱:turnus,代碼行數:25,代碼來源:IntraActionCommunicationAnalysisWizard.java

示例6: updateResults

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void updateResults() {
    if (selectedBuildDefinition == null) {
        return;
    }

    String message;
    if (selectedBuildDefinition.getName() != null && !selectedBuildDefinition.getName().equals("*")) //$NON-NLS-1$
    {
        final String messageFormat = Messages.getString("QueueEditorPage.QuerySpecificBuildQueueTextFormat"); //$NON-NLS-1$
        message = MessageFormat.format(messageFormat, selectedBuildDefinition.getName());
    } else {
        message = Messages.getString("QueueEditorPage.QueryAllBuildQueueText"); //$NON-NLS-1$
    }

    final Job populateJob = new Job(message) {
        @Override
        protected IStatus run(final IProgressMonitor monitor) {
            query(selectedBuildDefinition, selectedQueueStatus, selectedBuildController, selectedUser, false);
            CodeMarkerDispatch.dispatch(QueueEditorPage.CODEMARKER_TABLE_UPDATED);
            return Status.OK_STATUS;
        }
    };
    populateJob.setUser(false);
    populateJob.setPriority(Job.SHORT);
    populateJob.schedule();
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:27,代碼來源:QueueEditorPage.java

示例7: updateResults

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void updateResults() {
    if (selectedBuildDefinition == null || selectedDateFilter == null) {
        return;
    }

    String message;
    if (selectedBuildDefinition.getName() != null && !selectedBuildDefinition.getName().equals("*")) //$NON-NLS-1$
    {
        final String messageFormat = Messages.getString("BuildEditorPage.QuerySpecificBuildsTextFormat"); //$NON-NLS-1$
        message = MessageFormat.format(messageFormat, selectedBuildDefinition.getName());
    } else {
        message = Messages.getString("BuildEditorPage.QueryAllBuildsText"); //$NON-NLS-1$
    }

    final Job populateJob = new Job(message) {
        @Override
        protected IStatus run(final IProgressMonitor monitor) {
            query(selectedBuildDefinition, selectedQualityFilter, selectedDateFilter, selectedUser, false);
            CodeMarkerDispatch.dispatch(BuildEditorPage.CODEMARKER_TABLE_UPDATED);
            return Status.OK_STATUS;
        }
    };
    populateJob.setUser(false);
    populateJob.setPriority(Job.SHORT);
    populateJob.schedule();
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:27,代碼來源:BuildEditorPage.java

示例8: execute

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  final IProject project = ProjectFromSelectionHelper.getFirstProject(event);
  if (!CloudToolsEclipseProjectUpdater.hasOldContainers(project)) {
    throw new ExecutionException(Messages.getString("project.appears.up.to.date")); //$NON-NLS-1$
  }
  Job updateJob = new WorkspaceJob(MessageFormat.format(Messages.getString("updating.project"), project.getName())) { //$NON-NLS-1$
    @Override
    public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
      return CloudToolsEclipseProjectUpdater.updateProject(project, SubMonitor.convert(monitor));
    }
  };
  updateJob.setRule(project.getWorkspace().getRoot());
  updateJob.setUser(true);
  updateJob.schedule();
  return null;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:18,代碼來源:UpdateCloudToolsEclipseProjectHandler.java

示例9: execute

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) {
   
    Job job = new Job("[y] Platform Refresh and Build"){
        @Override
        protected IStatus run(IProgressMonitor monitor){
            
        	try
        	{
        		refreshAndFullBuild(monitor);
        		monitor.done();
	            return Status.OK_STATUS;
        	}
        	catch (Exception e)
        	{
        		throw new IllegalStateException("Failed to synchronize with the platform, see workspace logs for details", e);
        	}
        	
        }
    };
    job.setUser(true);
    job.schedule();
    return null;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:25,代碼來源:EclipseRefreshAndBuildHandler.java

示例10: execute

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) {

	Job job = new Job("[y] Refresh and Build") {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			IProject platform = ResourcesPlugin.getWorkspace().getRoot().getProject(PLATFORM_NAME);
			try {
				BuildUtils.refreshAndBuild(monitor, CFG_NAME, platform);
				monitor.done();
				return Status.OK_STATUS;
			} catch (Exception e) {
				Activator.logError("Failed to refresh and build", e);
				throw new IllegalStateException("Failed to refresh and build the platform, see the workspace logs for more details", e);
			}

		}
	};
	job.setUser(true);
	job.schedule();
	return null;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:23,代碼來源:YPlatformRefreshAndBuildHandler.java

示例11: execute

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	project = getSelectedExtension(HandlerUtil.getCurrentSelection(event));
	Job job = new Job("[y] Build") {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			try {
				if (FixProjectsUtils.isAHybrisExtension(project)) {
					BuildUtils.refreshAndBuild(monitor, CFG_NAME, project);
					monitor.done();
					return Status.OK_STATUS;
				} else {
					return Status.CANCEL_STATUS;
				}
			} catch (Exception e) {
				Activator.logError("Failed to build project", e);
				throw new IllegalStateException("Failed to build project", e);
			}

		}
	};
	job.setUser(true);
	job.schedule();
	return null;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:26,代碼來源:ExtensionCleanBuildHandler.java

示例12: execute

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	project = getSelectedExtension(HandlerUtil.getCurrentSelection(event));
	Job job = new Job("[y] Build") {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			try {
				if (FixProjectsUtils.isAHybrisExtension(project)) {
					BuildUtils.refreshAndBuild(monitor, CFG_NAME, project);
					monitor.done();
					return Status.OK_STATUS;
				} else {
					return Status.CANCEL_STATUS;
				}
			} catch (Exception e) {
				Activator.logError("Failed to build project", e);
				throw new IllegalStateException("Failed to build project, see workspace logs for details", e);
			}

		}
	};
	job.setUser(true);
	job.schedule();
	return null;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:26,代碼來源:ExtensionBuildHandler.java

示例13: getBuildJob

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
 * This method has been copied from org.eclipse.xtext.builder.preferences.BuilderConfigurationBlock.
 *
 * @param projectToBuild
 *            the project to build
 * @return the configured build job
 */
protected Job getBuildJob(IProject projectToBuild) {
	Job buildJob = new OptionsConfigurationBlock.BuildJob(Messages.BuilderConfigurationBlock_BuildJob_Title0,
			projectToBuild);
	buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
	buildJob.setUser(true);
	return buildJob;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:N4JSBuilderPreferencePage.java

示例14: run

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void run() {
	Job job = new WorkspaceJob("GW4E Close Editor Job") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			Display.getDefault().syncExec(new Runnable() {
				@Override
				public void run() {
					IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
					if (ww != null) {
						IWorkbenchPage page = ww.getActivePage();
						if (page != null) {
							IEditorReference[] editors = page.getEditorReferences();
							for (IEditorReference iEditorReference : editors) {
								try {
									IEditorInput input = iEditorReference.getEditorInput();
									if (input instanceof FileEditorInput) {
										FileEditorInput feditorInput = (FileEditorInput) input;
										if (path.equals(feditorInput.getFile().getFullPath())) {
											IEditorPart editorPart = iEditorReference.getEditor(false);
											page.closeEditor(editorPart, false);
										}
									}
								} catch (PartInitException e) {
									ResourceManager.logException(e);
								}
							}
						}
					}
				}
			});
			return Status.OK_STATUS;
		}
	};
	job.setRule(project); // lock so that we serialize the
									// refactoring
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:39,代碼來源:DeleteEditorAction.java

示例15: getValues

import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
 * Return the the preference values for the passed project and key
 * 
 * @param project
 * @param key
 * @return
 */
public static String[] getValues(IProject project, String key, boolean projectScoped) {

	IEclipsePreferences projectPreferences = null;
	if (projectScoped) {
		projectPreferences = getProjectPreference(project);
	} else {
		projectPreferences = getGlobalPreference();
	}
	String values = projectPreferences.get(key, "");
	if ((values == null) || (values.trim().length() == 0) && projectScoped) {
		IEclipsePreferences globalPreferences = getGlobalPreference();
		values = globalPreferences.get(key, "");
		final String gloablValues = values;

		Job job = new WorkspaceJob("GW4E Configure Project Preference Job") {
			@Override
			public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
				SubMonitor subMonitor = SubMonitor.convert(monitor, 60);
				try {
					putValues(project, key, fromString(gloablValues), projectScoped);
					return Status.OK_STATUS;
				} catch (Exception e) {
					ResourceManager.logException(e);
					return Status.CANCEL_STATUS;
				} finally {
					subMonitor.done();
				}
			}
		};
		job.setRule(project);
		job.setUser(true);
		job.schedule();
	}
	String[] ret = fromString(values);
	return ret;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:44,代碼來源:SettingsManager.java


注:本文中的org.eclipse.core.runtime.jobs.Job.setUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。