当前位置: 首页>>代码示例>>Java>>正文


Java Job.schedule方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.jobs.Job.schedule方法的典型用法代码示例。如果您正苦于以下问题:Java Job.schedule方法的具体用法?Java Job.schedule怎么用?Java Job.schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.jobs.Job的用法示例。


在下文中一共展示了Job.schedule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tryValidateManifest

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
private void tryValidateManifest(final IResourceDelta delta) {
	final String fullPath = delta.getFullPath().toString();
	final URI folderUri = URI.createPlatformResourceURI(fullPath, true);
	final IN4JSProject project = core.findProject(folderUri).orNull();
	if (null != project && project.exists()) {
		final URI manifestLocation = project.getManifestLocation().orNull();
		if (null != manifestLocation) {
			final IFile manifest = delta.getResource().getProject().getFile(N4MF_MANIFEST);
			final ResourceSet resourceSet = core.createResourceSet(Optional.of(project));
			final Resource resource = resourceSet.getResource(manifestLocation, true);
			final Job job = Job.create("", monitor -> {
				validatorExtension.updateValidationMarkers(manifest, resource, ALL, monitor);
				return OK_STATUS;
			});
			job.setPriority(INTERACTIVE);
			job.schedule();
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:N4JSAllContainersState.java

示例2: generateOffline

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
public static void generateOffline(final IResource resource, IPackageFragment pkg, String classfile , BuildPolicy[]  generators, int timeout, IWorkbenchWindow aww) {
	Job job = new Job("GW4E Offline Generation Source Job") {
		@Override
		public IStatus run(IProgressMonitor monitor) {
			try {
				if (resource instanceof IFile) {
					SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
					IFile file = (IFile) resource;
					if (PreferenceManager.isGraphModelFile(file)) {
						AbstractPostConversion converter = getOfflineConversion(file,pkg,classfile,generators,timeout);
						ConversionRunnable runnable = converter.createConversionRunnable(aww);
						subMonitor.subTask("Processing converter ");
						SubMonitor child = subMonitor.split(1);
						runnable.run(child);
					}						
				}
			} catch (Exception e) {
				e.printStackTrace();
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:27,代码来源:GraphWalkerContextManager.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: performFinish

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public boolean performFinish() {
	final Configuration configuration = new Configuration();
	configuration.setValue(TRACE_FILE, optionsPage.getTraceFile());
	configuration.setValue(ACTION_WEIGHTS, optionsPage.getWeightsFile());
	configuration.setValue(ANALYSIS_IMPACT_MAX_ACTIONS, optionsPage.getActions());

	final Job job = new Job("Pipelining algorithmic impact analysis") {

		@Override
		protected IStatus run(IProgressMonitor monitor) {
			try {
				new PipeliningAlgorithmicImpactAnalysisCli().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,代码行数:27,代码来源:PipeliningAlgorithmicImpactAnalysisWizard.java

示例5: appEngineWebWithJava8Runtime_Java7_Web25

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Test
public void appEngineWebWithJava8Runtime_Java7_Web25()
    throws CoreException, IOException, InterruptedException, SAXException {
  IFacetedProject project = projectCreator
      .withFacetVersions(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25).getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:ConversionTests.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: refresh

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
public void refresh(final boolean async) {
    if (!async) {
        refresh(new NullProgressMonitor());
    } else if (!isRefreshing) {
        final String messageFormat = Messages.getString("TFSServer.ProgressTitleFormat"); //$NON-NLS-1$
        final String message = MessageFormat.format(messageFormat, connection.getName());
        final Job refreshJob = new Job(message) {
            @Override
            protected IStatus run(final IProgressMonitor monitor) {
                refresh(monitor);
                return Status.OK_STATUS;
            }
        };
        refreshJob.schedule();
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:17,代码来源:TFSServer.java

示例8: start

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void start() {
    synchronized (lock) {
        if (started) {
            return;
        }
    }
    /*
     * Schedule this in a job so that it will be started when the workbench
     * is started. (If we're restoring a view, the workbench is not fully
     * started when this method is called. This will prevent deadlocking.)
     */
    final Job connectorJob = new Job(Messages.getString("UIAutoConnector.ConnectingToServer")) //$NON-NLS-1$
    {
        @Override
        protected IStatus run(final IProgressMonitor progressMonitor) {
            startInternal();
            return Status.OK_STATUS;
        }
    };
    connectorJob.setSystem(true);
    connectorJob.schedule();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:24,代码来源:UIAutoConnector.java

示例9: setProject

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void setProject(final IProject project) {
    log.debug(MessageFormat.format("Opening repository for project {0}", project.getName())); //$NON-NLS-1$

    /**
     * The runtime and UI may not be fully formed here. We need to connect
     * as a Job, this will run as soon as the JobManager is fully formed. We
     * cannot block here, as Job#join() will fail immediately.
     */
    final Job connectJob =
        new Job(MessageFormat.format(
            Messages.getString("TFSRepositoryProvider.ConnectingProjectFormat"), //$NON-NLS-1$
            project.getName())) {
            @Override
            protected IStatus run(final IProgressMonitor monitor) {
                TFSEclipseClientPlugin.getDefault().getProjectManager().connectIfNecessary(project);

                return Status.OK_STATUS;
            }
        };

    connectJob.setSystem(true);
    connectJob.schedule();

    super.setProject(project);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:27,代码来源:TFSRepositoryProvider.java

示例10: appEngineWebWithJava8Runtime_Java8_Web31

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Test
public void appEngineWebWithJava8Runtime_Java8_Web31()
    throws CoreException, IOException, InterruptedException, SAXException {
  IFacetedProject project = projectCreator
      .withFacetVersions(JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31).getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:ConversionTests.java

示例11: insertEntry

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
private void insertEntry ( final String value )
{
    final Job job = this.factoryInput.createCreateJob ( value );
    job.addJobChangeListener ( new JobChangeAdapter () {
        @Override
        public void done ( final IJobChangeEvent event )
        {
            refresh ();
        }
    } );
    job.schedule ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:13,代码来源:FactoryEditor.java

示例12: earlyStartup

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
@Override
public void earlyStartup() {

	/* Analyse les projets pour deviner la version du framework de chacun. */
	LegacyManager.getInstance().init();

	/* Liste et instancie les singletons des managers de ressources. */
	Manager[] managers = new Manager[] { KspManager.getInstance(), DaoManager.getInstance(), DtoManager.getInstance(), ServiceManager.getInstance(),
			WsRouteManager.getInstance(), JavaClassManager.getInstance() };

	/* Créé et programme un job pour démarrer chacun des managers de ressources. */
	for (Manager pluginManager : managers) {

		Job job = new Job("KspPluginInit" + pluginManager.getClass().getSimpleName()) {

			@Override
			protected IStatus run(IProgressMonitor monitor) {
				pluginManager.init();
				return Status.OK_STATUS;
			}

		};

		job.setPriority(Job.SHORT);
		job.schedule();
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:28,代码来源:KspPluginStartup.java

示例13: 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();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:40,代码来源:UpdateEditorAction.java

示例14: touchFolderForRebuild

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
/**
 * Touch the files located in the folder of the passed file
 * 
 * @param file
 */
public static void touchFolderForRebuild(final IFile file) {
	Job job = new WorkspaceJob("Touch folders") {
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			ResourceManager.touchFolderResources(file);
			return Status.OK_STATUS;
		}
	};
	job.schedule();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:ResourceManager.java

示例15: diff

import org.eclipse.core.runtime.jobs.Job; //导入方法依赖的package包/类
public void diff() {
    Log.log(Log.LOG_INFO, "Started DB update"); //$NON-NLS-1$
    if (warnCheckedElements() < 1 ||
            !OpenProjectUtils.checkVersionAndWarn(proj.getProject(), parent.getShell(), true)) {
        return;
    }

    IEclipsePreferences pref = proj.getPrefs();
    final Differ differ = new Differ(dbRemote.getDbObject(),
            dbProject.getDbObject(), diffTree.getRevertedCopy(), false,
            pref.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC));
    differ.setAdditionalDepciesSource(manualDepciesSource);
    differ.setAdditionalDepciesTarget(manualDepciesTarget);

    Job job = differ.getDifferJob();
    job.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(IJobChangeEvent event) {
            Log.log(Log.LOG_INFO, "Differ job finished with status " +  //$NON-NLS-1$
                    event.getResult().getSeverity());
            if (event.getResult().isOK()) {
                UiSync.exec(parent, () -> {
                    if (!parent.isDisposed()) {
                        try {
                            showEditor(differ);
                        } catch (PartInitException ex) {
                            ExceptionNotifier.notifyDefault(
                                    Messages.ProjectEditorDiffer_error_opening_script_editor, ex);
                        }
                    }
                });
            }
        }
    });
    job.setUser(true);
    job.schedule();
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:39,代码来源:ProjectEditorDiffer.java


注:本文中的org.eclipse.core.runtime.jobs.Job.schedule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。