本文整理汇总了Java中org.eclipse.core.runtime.jobs.Job.setRule方法的典型用法代码示例。如果您正苦于以下问题:Java Job.setRule方法的具体用法?Java Job.setRule怎么用?Java Job.setRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.jobs.Job
的用法示例。
在下文中一共展示了Job.setRule方法的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();
}
示例2: 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();
}
示例3: 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();
}
示例4: configure
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
/**
* Configures a {@link Job} instance using the configuration data held in
* this {@link JobOptions}.
*
* @param job
* a {@link Job} to configure (must not be <code>null</code>)
*/
public void configure(final Job job) {
Check.notNull(job, "job"); //$NON-NLS-1$
job.setPriority(priority);
job.setSystem(system);
job.setUser(user);
job.setRule(schedulingRule);
for (final Iterator it = properties.keySet().iterator(); it.hasNext();) {
final QualifiedName key = (QualifiedName) it.next();
final Object value = properties.get(key);
job.setProperty(key, value);
}
}
示例5: 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
示例6: earlyStartup
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void earlyStartup() {
workbench = PlatformUI.getWorkbench();
workspace = ResourcesPlugin.getWorkspace();
Job projectUpdater = new WorkspaceJob(Messages.getString("updating.projects.jobname")) { //$NON-NLS-1$
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 40);
progress.subTask(Messages.getString("searching.for.projects")); //$NON-NLS-1$
Collection<IProject> projects = findCandidates(progress.newChild(10));
if (projects.isEmpty()) {
return Status.OK_STATUS;
}
projects = promptUser(projects, progress.newChild(5));
if (projects.isEmpty()) {
return Status.OK_STATUS;
}
progress.subTask(Messages.getString("updating.projects")); //$NON-NLS-1$
return upgradeProjects(projects, progress.newChild(25));
}
};
projectUpdater.setRule(workspace.getRoot());
projectUpdater.setUser(true);
projectUpdater.schedule(500);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:27,代码来源:CloudToolsEclipseProjectNotifier.java
示例7: 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;
}
示例8: 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;
}
示例9: update
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
/**
* @param graphFile
* @throws CoreException
* @throws IOException
* @throws InterruptedException
*/
public void update(List<BuildPolicy> policies) throws CoreException, IOException, InterruptedException {
Job job = new WorkspaceJob("Updating cache") {
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
IFile fileCache = getCache();
Properties p = ResourceManager.loadIFileAsProperties(fileCache,
getFileCacheName(resource.getProject().getName()));
String serialized = serialize(policies);
if (serialized == null) {
log("BuildPoliciesCache.update " + fileCache + " failed to updated for resource " + resource
+ " " + policies.toString());
return Status.OK_STATUS;
}
p.put(resource.getName(), System.currentTimeMillis() + ":" + serialized);
log("BuildPoliciesCache.update " + fileCache + " updated for resource " + resource + " "
+ p.toString());
save(p, monitor);
return Status.OK_STATUS;
} catch (Exception e) {
ResourceManager.logException(e);
return Status.CANCEL_STATUS;
}
}
};
job.setRule(resource.getProject());
job.setUser(true);
job.schedule();
}
示例10: run
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void run(IMarker marker) {
Job job = new WorkspaceJob("GW4E QuickFix Job") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
fix(marker, monitor);
return Status.OK_STATUS;
}
};
job.setRule(marker.getResource().getProject());
job.setUser(true);
job.schedule();
}
示例11: run
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void run(IMarker marker) {
Job job = new WorkspaceJob("GW4E Fix Job") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
fix(marker, monitor);
return Status.OK_STATUS;
}
};
job.setRule(marker.getResource().getProject());
job.setUser(true);
job.schedule();
}
示例12: run
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void run(IMarker marker) {
IWorkbenchWindow ww= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Job job = new WorkspaceJob("GW4E Synchronization Job") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
fix(marker,ww,monitor);
return Status.OK_STATUS;
}
};
job.setRule(marker.getResource().getProject());
job.setUser(true);
job.schedule();
}
示例13: run
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
public void run(IMarker marker) {
Job job = new WorkspaceJob("GW4E Fix Job") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
fix(marker, monitor);
return Status.OK_STATUS;
}
};
job.setRule(marker.getResource().getProject());
job.setUser(true);
job.schedule();
}
示例14: openclose
import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
public void openclose() {
Job job = new WorkspaceJob("GW4E Open/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 (previousPath.equals(feditorInput.getFile().getFullPath())) {
IEditorPart editorPart = iEditorReference.getEditor(false);
page.closeEditor(editorPart, false);
JDTManager.openEditor(currentFile,PreferenceManager.getGW4EEditorName(),null);
}
}
} 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();
}
示例15: 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();
}