本文整理匯總了Java中org.eclipse.core.runtime.jobs.Job.setPriority方法的典型用法代碼示例。如果您正苦於以下問題:Java Job.setPriority方法的具體用法?Java Job.setPriority怎麽用?Java Job.setPriority使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.jobs.Job
的用法示例。
在下文中一共展示了Job.setPriority方法的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();
}
}
}
示例2: updateResults
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void updateResults() {
if (selectedBuildDefinition == null) {
return;
}
String message;
if (selectedBuildDefinition.getName() != null && !selectedBuildDefinition.getName().equals("*")) //$NON-NLS-1$
{
final String messageFormat = Messages.getString("QueueEditorPage.QuerySpecificBuildQueueTextFormat"); //$NON-NLS-1$
message = MessageFormat.format(messageFormat, selectedBuildDefinition.getName());
} else {
message = Messages.getString("QueueEditorPage.QueryAllBuildQueueText"); //$NON-NLS-1$
}
final Job populateJob = new Job(message) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
query(selectedBuildDefinition, selectedQueueStatus, selectedBuildController, selectedUser, false);
CodeMarkerDispatch.dispatch(QueueEditorPage.CODEMARKER_TABLE_UPDATED);
return Status.OK_STATUS;
}
};
populateJob.setUser(false);
populateJob.setPriority(Job.SHORT);
populateJob.schedule();
}
示例3: updateResults
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void updateResults() {
if (selectedBuildDefinition == null || selectedDateFilter == null) {
return;
}
String message;
if (selectedBuildDefinition.getName() != null && !selectedBuildDefinition.getName().equals("*")) //$NON-NLS-1$
{
final String messageFormat = Messages.getString("BuildEditorPage.QuerySpecificBuildsTextFormat"); //$NON-NLS-1$
message = MessageFormat.format(messageFormat, selectedBuildDefinition.getName());
} else {
message = Messages.getString("BuildEditorPage.QueryAllBuildsText"); //$NON-NLS-1$
}
final Job populateJob = new Job(message) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
query(selectedBuildDefinition, selectedQualityFilter, selectedDateFilter, selectedUser, false);
CodeMarkerDispatch.dispatch(BuildEditorPage.CODEMARKER_TABLE_UPDATED);
return Status.OK_STATUS;
}
};
populateJob.setUser(false);
populateJob.setPriority(Job.SHORT);
populateJob.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: createJob
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
private Job createJob(final ISessionManager sm,
final Collection<ICoverageSession> sessions, final String description) {
final Job job = new Job(UIMessages.MergingSessions_task) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
sm.mergeSessions(sessions, description, monitor);
} catch (CoreException e) {
return EclEmmaStatus.MERGE_SESSIONS_ERROR.getStatus(e);
}
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
return job;
}
示例6: setValue
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
private void setValue(IProject project, String propertyValue) {
/*
* On fait l'action dans un job asynchrone pour éviter une ResourceException: The resource tree is locked for modifications
*/
Job job = new Job("KspPreferenceSaving") {
@Override
protected IStatus run(IProgressMonitor monitor) {
IEclipsePreferences node = getProjectPluginNode(project);
if (node == null) {
LogUtils.info("Set " + propertyName + " : node null !");
return Status.OK_STATUS;
}
if (VertigoStringUtils.isEmpty(propertyValue)) {
node.remove(propertyName);
} else {
node.put(propertyName, propertyValue);
}
try {
node.flush();
} catch (BackingStoreException e) {
ErrorUtils.handle(e);
}
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
job.schedule();
}
示例7: 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();
}
}
示例8: runOnWorkbenchStartup
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public static void runOnWorkbenchStartup(String name, final Runnable runnable) {
Check.notNull(runnable, "runnable"); //$NON-NLS-1$
if (name == null) {
name = Messages.getString("WorkbenchHelper.WorkbenchStartupJobName"); //$NON-NLS-1$
}
final Job startupJob = new WorkbenchStartupJob(name, runnable);
startupJob.setPriority(Job.INTERACTIVE);
startupJob.setSystem(true);
startupJob.schedule();
}
示例9: calculatePosition
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
protected void calculatePosition() {
if (!buildServer.getBuildServerVersion().isV1()) {
position.setText(Messages.getString("QueueBuildDialog.Recalculating")); //$NON-NLS-1$
final IBuildRequest request = getBuildRequest();
final String messageFormat = Messages.getString("QueueBuildDialog.CalculatingQueuePositionLabelTextFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(messageFormat, getSelectedBuildDefinition().getName());
final Job populateJob = new Job(message) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
try {
final IQueuedBuild queuedBuild = buildServer.queueBuild(request, QueueOptions.PREVIEW);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
if (!position.isDisposed()) {
position.setText(Integer.toString(queuedBuild.getQueuePosition()));
}
}
});
} catch (final Exception e) {
/*
* Suppress the internal error message box
*/
}
return Status.OK_STATUS;
}
};
populateJob.setUser(false);
populateJob.setPriority(Job.SHORT);
populateJob.schedule(100);
} else {
position.setText(""); //$NON-NLS-1$
}
}
示例10: pollResults
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
protected void pollResults() {
// May possibly have come to this from an outstanding job.
if (isDisposed()) {
return;
}
/*
* Perform refresh. If we're not isConnected, defer this refresh, but
* queue the next one. (Otherwise, we wouldn't auto-refresh after
* reconnecting.)
*/
if (isConnected) {
refresh();
}
// Reschedule a new pollJob
pollJob = new Job(Messages.getString("BuildExplorer.RefreshingBuildStatus")) //$NON-NLS-1$
{
@Override
protected IStatus run(final IProgressMonitor monitor) {
pollResults();
return Status.OK_STATUS;
}
};
pollJob.setUser(false);
pollJob.setSystem(true);
pollJob.setPriority(Job.DECORATE);
pollJob.schedule(pollInterval);
}
示例11: init
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public void init(final String secondaryId, final IMemento memento) throws PartInitException {
super.init(secondaryId, memento);
// reset secondaryId -- otherwise it will persist the original
// secondaryId set by the constructor and you'll have multiple
// persisted syncs. yoinks!
setSecondaryId(secondaryId);
// load the list of resources from the last synchronization for this
// secondaryId. (usually because a synchronization state is being
// restored.)
if (memento != null) {
final IMemento settings = memento.getChild(PARTICIPANT_SETTINGS);
if (settings != null) {
setResources(settings);
}
}
// this is called when Eclipse starts with the synchronize view open,
// this is our best chance to refresh. (otherwise the synchronize view
// will always start with no changes to display.)
final RefreshSubscriberCommand refreshCommand =
new RefreshSubscriberCommand(SynchronizeSubscriber.getInstance(), getResources(), IResource.DEPTH_INFINITE);
final Job refreshJob = new JobCommandAdapter(refreshCommand);
refreshJob.setName(Messages.getString("SynchronizeParticipant.RefreshJobName")); //$NON-NLS-1$
refreshJob.setPriority(Job.LONG);
refreshJob.schedule();
try {
final ISynchronizeParticipantDescriptor descriptor =
TeamUI.getSynchronizeManager().getParticipantDescriptor(PARTICIPANT_ID);
setInitializationData(descriptor);
} catch (final CoreException e) {
throw new PartInitException(e.getMessage());
}
}
示例12: createAutoAddJob
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
* Create and schedule an auto-add job
*/
private static synchronized void createAutoAddJob(IProject project) {
Job j = new AutoAddJob(project);
j.setSystem(true);
j.setPriority(Job.SHORT);
j.setRule(ResourcesPlugin.getWorkspace().getRoot());
j.schedule();
}
示例13: earlyStartup
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public void earlyStartup() {
plugin = this;
preferencesPath = getStateLocation();
Job j = new StartupJob();
j.setPriority(Job.INTERACTIVE);
j.schedule();
}
示例14: createCenteringListener
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
private void createCenteringListener(final Label centeringValue, final Map<String, ScaleBox> boxes) {
// We listen to the topic and when a complete bean comes through, we take this
// as the current center for the UI
// Use job because connection might timeout.
final Job topicJob = new Job("Create topic listener") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
topicMonitor = service.createSubscriber(new URI(Activator.getJmsUri()), "dataacq.xcen.STATUS_TOPIC");
topicMonitor.addListener(new IBeanListener<XcenBean>() {
@Override
public void beanChangePerformed(BeanEvent<XcenBean> evt) {
final XcenBean bean = evt.getBean();
if (bean.getStatus()==org.eclipse.scanning.api.event.status.Status.COMPLETE) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
centeringValue.setText(bean.getName());
boxes.get("x").setValue(bean.getX());
boxes.get("y").setValue(bean.getY());
boxes.get("z").setValue(bean.getZ());
}
});
}
}
@Override
public Class<XcenBean> getBeanClass() {
return XcenBean.class;
}
});
return Status.OK_STATUS;
} catch (Exception ne) {
logger.error("Cannot listen to topic changes because command server is not there", ne);
return Status.CANCEL_STATUS;
}
}
};
topicJob.setPriority(Job.INTERACTIVE);
topicJob.setSystem(true);
topicJob.setUser(false);
topicJob.schedule();
}
示例15: execute
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
final ITextEditor editor = (ITextEditor) window.getActivePage().getActiveEditor();
if (editor == null) {
return null;
}
String workSql = null;
final boolean isSelection;
if (editor.getSelectionProvider().getSelection() instanceof TextSelection) {
workSql = ((TextSelection) editor.getSelectionProvider().getSelection()).getText();
}
if (workSql == null || "".equals(workSql)) {
workSql = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
isSelection = false;
} else {
isSelection = true;
}
final String sql = workSql;
// format async
Job job = new Job("uroboroSQL Format Thread") {
@Override
protected IStatus run(IProgressMonitor monitor) {
final PyEngine engine = UroborosqlFormatterPlugin.getDefault().getPyEngine();
engine.put("sql", sql);
// bind python config
PyConfigBinder binder = new PyConfigBinder();
binder.bind(engine);
window.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
try {
engine.eval("f = uroborosqlfmt.format_sql(sql, config)");
String fmtText = engine.get("f");
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (isSelection) {
TextSelection selection = (TextSelection) editor.getSelectionProvider().getSelection();
int offset = selection.getOffset();
int length = selection.getLength();
doc.replace(offset, length, fmtText);
editor.selectAndReveal(offset, fmtText.length());
} else {
doc.set(fmtText);
}
} catch (RuntimeException | BadLocationException ex) {
UroborosqlFormatterPlugin.getDefault().getLog().log(new Status(IStatus.ERROR,
UroborosqlFormatterPlugin.PLUGIN_ID, "Format failed!", ex));
MessageDialog.openError(window.getShell(), "Eclipse uroboroSQL, Formatter",
"Format failed!");
}
}
});
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
job.schedule();
return null;
}