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


Java WorkspaceJob.setPriority方法代碼示例

本文整理匯總了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();
}
 
開發者ID:mulesoft,項目名稱:mule-tooling-incubator,代碼行數:34,代碼來源:SynchronizeProjectGradleBuildJob.java

示例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();
}
 
開發者ID:mulesoft,項目名稱:mule-tooling-incubator,代碼行數:55,代碼來源:TasksView.java


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