本文整理匯總了Java中org.eclipse.core.resources.WorkspaceJob.setPriority方法的典型用法代碼示例。如果您正苦於以下問題:Java WorkspaceJob.setPriority方法的具體用法?Java WorkspaceJob.setPriority怎麽用?Java WorkspaceJob.setPriority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.WorkspaceJob
的用法示例。
在下文中一共展示了WorkspaceJob.setPriority方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scheduleRemoveZipFiles
import org.eclipse.core.resources.WorkspaceJob; //導入方法依賴的package包/類
private void scheduleRemoveZipFiles(final IJavaProject javaProject) {
WorkspaceJob removeZipsJob = new WorkspaceJob("removeGradleZips") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor)
throws CoreException {
translatePlugins();
GradlePluginUtils.removeZipLibrariesFromProject(javaProject, new NullProgressMonitor());
IResource buildFile = javaProject.getProject().getFile(GradlePluginConstants.MAIN_BUILD_FILE);
//the build file might not be phisically present
if (!buildFile.exists()) {
return Status.OK_STATUS;
}
//markers should be removed regardless there are orphan nodes or not.
removeMarkers(buildFile);
if (orphanPlugins != null) {
addBuildScriptMarkers(orphanPlugins, buildFile);
}
return Status.OK_STATUS;
}
};
removeZipsJob.setUser(false);
removeZipsJob.setPriority(Job.SHORT);
removeZipsJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
removeZipsJob.schedule();
}
示例2: selectionChanged
import org.eclipse.core.resources.WorkspaceJob; //導入方法依賴的package包/類
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (this.viewer.isBusy()) {
return;
}
if (!(selection instanceof TreeSelection)) {
return;
}
if (selection.isEmpty())
return;
if (!isMuleProject(selection)) {
return;
}
final ISelection currentSelection = selection;
final String convertingMsg = "Listing gradle tasks...";
final WorkspaceJob refreshDevkitViewJob = new WorkspaceJob(convertingMsg) {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException {
if (currentSelection instanceof IStructuredSelection) {
Object selected = ((IStructuredSelection) currentSelection).getFirstElement();
// sometimes project might be a simple project.
if (selected instanceof IJavaProject) {
// convert into a java project
selected = ((IJavaProject) selected).getProject();
}
if (selected instanceof IProject) {
project = (IProject) selected;
final GradleProject gradleProject = GradlePluginUtils.getProjectModelForProject(project);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
viewer.setInput(gradleProject);
}
});
}
}
return Status.OK_STATUS;
}
};
refreshDevkitViewJob.setUser(false);
refreshDevkitViewJob.setPriority(Job.SHORT);
refreshDevkitViewJob.schedule();
}