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


Java WorkspaceJob類代碼示例

本文整理匯總了Java中org.eclipse.core.resources.WorkspaceJob的典型用法代碼示例。如果您正苦於以下問題:Java WorkspaceJob類的具體用法?Java WorkspaceJob怎麽用?Java WorkspaceJob使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: resfreshFileInContainer

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
/**
 * @param folder
 * @param filetorefresh
 * @return
 * @throws CoreException
 * @throws InterruptedException
 */
public static IResource resfreshFileInContainer(IContainer folder, String filetorefresh)
		throws CoreException, InterruptedException {
	final IResource buildfile = find(folder, filetorefresh);
	Job job = new WorkspaceJob("Refresh folders") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			if (buildfile != null && buildfile.exists()) {
				try {
					buildfile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
				} catch (CoreException e) {
					ResourceManager.logException(e);
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();

	return buildfile;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:28,代碼來源:ResourceManager.java

示例2: updateBuildPolicyFileFor

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的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

示例3: run

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
protected void run ( final String name ) throws URISyntaxException
{
    final WorkspaceJob job = new WorkspaceJob ( String.format ( "Run recipe: %s", name ) ) {

        @Override
        public IStatus runInWorkspace ( final IProgressMonitor monitor ) throws CoreException
        {
            try
            {
                RecipeHelper.processFile ( DefinitionContributionItem.this.parent, DefinitionContributionItem.this.definition, getProfile (), monitor );
            }
            catch ( final Exception e )
            {
                logger.warn ( "Failed to process", e );
                return StatusHelper.convertStatus ( Activator.PLUGIN_ID, e );
            }
            return Status.OK_STATUS;
        }
    };
    job.setUser ( true );
    job.setSystem ( false );
    job.schedule ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:DefinitionContributionItem.java

示例4: apply

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的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

示例5: update

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的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

示例6: performFinish

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public boolean performFinish() {
	final Collection<ProjectDescriptor> projectDescriptors = getProjectDescriptors();
	
	WorkspaceJob job = new WorkspaceJob("Unzipping Projects") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			monitor.beginTask("Unzipping Projects", projectDescriptors.size());
			//System.out.println("Unzipping projects...");
			for ( ProjectDescriptor desc : projectDescriptors ) {
				unzipProject(desc, monitor);
				monitor.worked(1);
			}
			//System.out.println("Projects unzipped");
			return Status.OK_STATUS;
		}
	};
	job.setRule(ResourcesPlugin.getWorkspace().getRoot());
	job.schedule();
	return true;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:21,代碼來源:AbstractExampleWizard.java

示例7: execute

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的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

示例8: earlyStartup

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的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

示例9: DocumentLifeCycleHandler

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public DocumentLifeCycleHandler(JavaClientConnection connection, PreferenceManager preferenceManager, ProjectsManager projectsManager, boolean delayValidation) {
	this.connection = connection;
	this.preferenceManager = preferenceManager;
	this.projectsManager = projectsManager;
	this.sharedASTProvider = SharedASTProvider.getInstance();
	if (delayValidation) {
		this.validationTimer = new WorkspaceJob("Validate documents") {
			@Override
			public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
				return performValidation(monitor);
			}

			/* (non-Javadoc)
			 * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
			 */
			@Override
			public boolean belongsTo(Object family) {
				return DOCUMENT_LIFE_CYCLE_JOBS.equals(family);
			}
		};
		this.validationTimer.setRule(ResourcesPlugin.getWorkspace().getRoot());
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:24,代碼來源:DocumentLifeCycleHandler.java

示例10: setResourceChangeListeners

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public static void setResourceChangeListeners(IProject newProjectHandle) {
	Edk2ModuleObservablesManager.getProjectModuleModificationObservable()
	.filter(event -> event.getProject() == newProjectHandle)
	.map(ev -> {
		return new WorkspaceJob("Updating project"){
			@Override 
			public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
				Edk2Module module = ev.getNewModule();

				updateIncludePaths(ev.getProject(), module);
				UpdateProjectStructureFromModuleDiff(ev.getProject(), ev.getOldModule(), module);
				ev.getProject().refreshLocal(IResource.DEPTH_INFINITE,monitor);

				return Status.OK_STATUS;
			}
		};
	})
	.subscribe(job -> job.schedule());
}
 
開發者ID:ffmmjj,項目名稱:uefi_edk2_wizards_plugin,代碼行數:20,代碼來源:ProjectStructureUpdater.java

示例11: scheduleRebuild

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
/**
 * Schedules a full rebuild on a project.
 * 
 * @param project the project to rebuild
 */
public static void scheduleRebuild(final IProject project) {
  WorkspaceJob buildJob = new WorkspaceJob("Building " + project.getName()) {
    @Override
    public boolean belongsTo(Object family) {
      return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
    }

    @Override
    public IStatus runInWorkspace(IProgressMonitor monitor)
        throws CoreException {
      project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
      return Status.OK_STATUS;
    }
  };

  buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
  buildJob.setUser(true);
  buildJob.schedule();
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:25,代碼來源:BuilderUtilities.java

示例12: jobSetupFacets

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
private void jobSetupFacets(final IProject project) {
  // Facet setup is done in a workspace job since this can be long running,
  // hence shouldn't be from the UI thread.
  WorkspaceJob setupFacetsJob = new WorkspaceJob("Setting up facets") {
    @Override
    public IStatus runInWorkspace(IProgressMonitor monitor) {
      try {
        // Create faceted project
        IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor);
        // Add Java facet by default
        IProjectFacet javaFacet = ProjectFacetsManager.getProjectFacet(FACET_JST_JAVA);
        facetedProject.installProjectFacet(javaFacet.getDefaultVersion(), null, monitor);
        return Status.OK_STATUS;
      } catch (CoreException e) {
        // Log and continue
        GdtPlugin.getLogger().logError(e);
        return new Status(IStatus.ERROR, GdtPlugin.PLUGIN_ID, e.toString(), e);
      }
    }
  };
  setupFacetsJob.schedule();
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:23,代碼來源:WebAppProjectCreator.java

示例13: renameProduct

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public static void renameProduct(final IProductModel productModel, final String newId) {
	Job job = new WorkspaceJob("Renaming Product") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			productModel.getProduct().setId(newId);
			((IEditableModel) productModel).save();

			IResource productFile = productModel.getUnderlyingResource();
			productFile.move(getNewLocation(productFile, newId + ".product"), false, monitor);

			return Status.OK_STATUS;
		}
	};
	job.setRule(ResourcesPlugin.getWorkspace().getRoot());
	job.schedule();
}
 
開發者ID:secondfiddle,項目名稱:pep-tools,代碼行數:17,代碼來源:RefactoringSupport.java

示例14: internalRenamePlugin

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public static void internalRenamePlugin(final IPluginModelBase pluginModel, final String newName) {
	Job renamePluginJob = new WorkspaceJob("Renaming Plugin") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			// rename plugin
			setPluginId(pluginModel, newName);

			// update references
			String oldName = pluginModel.getPluginBase().getId();
			updatePluginReferences(oldName, newName);

			return Status.OK_STATUS;
		}
	};
	renamePluginJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
	renamePluginJob.schedule();
}
 
開發者ID:secondfiddle,項目名稱:pep-tools,代碼行數:18,代碼來源:RefactoringSupport.java

示例15: internalRenameFeature

import org.eclipse.core.resources.WorkspaceJob; //導入依賴的package包/類
public static void internalRenameFeature(final IFeatureModel featureModel, final String newName) {
	Job renameFeatureJob = new WorkspaceJob("Renaming Feature") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			// update references
			String oldName = featureModel.getFeature().getId();
			updateFeatureReferences(oldName, newName);

			// rename feature
			featureModel.getFeature().setId(newName);
			((IEditableModel) featureModel).save();

			return Status.OK_STATUS;
		}
	};
	renameFeatureJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
	renameFeatureJob.schedule();
}
 
開發者ID:secondfiddle,項目名稱:pep-tools,代碼行數:19,代碼來源:RefactoringSupport.java


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