本文整理匯總了Java中org.eclipse.core.runtime.jobs.Job.setSystem方法的典型用法代碼示例。如果您正苦於以下問題:Java Job.setSystem方法的具體用法?Java Job.setSystem怎麽用?Java Job.setSystem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.jobs.Job
的用法示例。
在下文中一共展示了Job.setSystem方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scheduleProgressMonitorJob
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
* Schedule the job that will open the progress monitor dialog
*
* @param dialog
* the dialog to open
*/
private void scheduleProgressMonitorJob(
final ProgressMonitorJobsDialog dialog) {
final Job updateJob = new UIJob(
ProgressMessages.ProgressManager_openJobName) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
setUserInterfaceActive(true);
if (ProgressManagerUtil.safeToOpen(dialog, null)) {
dialog.open();
}
return Status.OK_STATUS;
}
};
updateJob.setSystem(true);
updateJob.schedule(getLongOperationTime());
}
示例2: 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);
}
示例3: 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();
}
示例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: createCloseListener
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
* Returns a listener that will close the dialog when the job completes.
*
* @return IJobChangeListener
*/
private IJobChangeListener createCloseListener() {
return new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
// first of all, make sure this listener is removed
event.getJob().removeJobChangeListener(this);
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
// nothing to do if the dialog is already closed
if (getShell() == null) {
return;
}
Job closeJob = new UIJob(
ProgressMessages.ProgressMonitorFocusJobDialog_CLoseDialogJob) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
Shell currentShell = getShell();
if (currentShell == null || currentShell.isDisposed()) {
return Status.CANCEL_STATUS;
}
finishedRun();
return Status.OK_STATUS;
}
};
closeJob.setSystem(true);
closeJob.schedule();
}
};
}
示例6: start
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
plugin = this;
ResourcesPlugin.getWorkspace().addResourceChangeListener(
resourceChangedListener,
IResourceChangeEvent.POST_CHANGE);
/*
* Queue a job to notify the project repository manager to start. We
* cannot simply do this work (we must put it in a job) to ensure that
* the workbench is started. When the workbench is started, it will
* start the JobManager which will execute our startup hook here.
*/
final Job projectStartupJob = new Job(Messages.getString("TFSEclipseClientPlugin.ConnectintToTfsJobTitle")) //$NON-NLS-1$
{
@Override
protected IStatus run(final IProgressMonitor progressMonitor) {
projectManager.start();
return Status.OK_STATUS;
}
};
projectStartupJob.setSystem(true);
projectStartupJob.schedule();
TfsTelemetryHelper.sendSessionBegins();
}
示例7: 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();
}
示例8: 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);
}
示例9: 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();
}
示例10: 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();
}
示例11: createBlockedDialog
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
* Creates a progress monitor dialog under the given shell. It also sets the
* dialog's message. The dialog is opened automatically after a reasonable
* delay. When no longer needed, the dialog must be closed by calling
* <code>close(IProgressMonitor)</code>, where the supplied monitor is
* the same monitor passed to this factory method.
*
* @param parentShell
* The parent shell, or <code>null</code> to create a top-level
* shell. If the parentShell is not null we will open immediately
* as parenting has been determined. If it is <code>null</code>
* then the dialog will not open until there is no modal shell
* blocking it.
* @param blockedMonitor
* The monitor that is currently blocked
* @param reason
* A status describing why the monitor is blocked
* @param taskName
* A name to give the blocking task in the dialog
* @return BlockedJobsDialog
*/
public static BlockedJobsDialog createBlockedDialog(Shell parentShell,
IProgressMonitor blockedMonitor, IStatus reason, String taskName,
IProgressService progressService, FinishedJobs finishedJobs,
ProgressViewUpdater viewUpdater, ProgressManager progressManager) {
// use an existing dialog if available
if (singleton != null) {
return singleton;
}
singleton = new BlockedJobsDialog(parentShell, blockedMonitor, reason,
progressService, finishedJobs, viewUpdater, progressManager);
if (taskName == null || taskName.length() == 0)
singleton
.setBlockedTaskName(ProgressMessages.BlockedJobsDialog_UserInterfaceTreeElement);
else
singleton.setBlockedTaskName(taskName);
/**
* If there is no parent shell we have not been asked for a parent so we
* want to avoid blocking. If there is a parent then it is OK to open.
*/
if (parentShell == null) {
// create the job that will open the dialog after a delay.
Job dialogJob = new UIJob(
ProgressMessages.EventLoopProgressMonitor_OpenDialogJobName) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (singleton == null) {
return Status.CANCEL_STATUS;
}
if (ProgressManagerUtil.rescheduleIfModalShellOpen(this,
Services.getInstance().getProgressService())) {
return Status.CANCEL_STATUS;
}
singleton.open();
return Status.OK_STATUS;
}
};
// Wait for long operation time to prevent a proliferation
// of dialogs
dialogJob.setSystem(true);
dialogJob.schedule(Services.getInstance().getProgressService()
.getLongOperationTime());
} else {
singleton.open();
}
return singleton;
}