本文整理汇总了Java中org.eclipse.core.runtime.jobs.Job.RUNNING属性的典型用法代码示例。如果您正苦于以下问题:Java Job.RUNNING属性的具体用法?Java Job.RUNNING怎么用?Java Job.RUNNING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.runtime.jobs.Job
的用法示例。
在下文中一共展示了Job.RUNNING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisplayStringWithStatus
/**
* Get the display string based on the current status and the name of the
* job.
* @param showProgress a boolean to indicate if we should
* show progress or not.
*
* @return String
*/
private String getDisplayStringWithStatus(boolean showProgress) {
if (isCanceled()) {
return NLS.bind(ProgressMessages.JobInfo_Cancelled, (new Object[] { getJob().getName() }));
}
if (isBlocked()) {
return NLS.bind(ProgressMessages.JobInfo_Blocked, (new Object[] { getJob().getName(),
blockedStatus.getMessage() }));
}
if (getJob().getState() == Job.RUNNING) {
TaskInfo info = getTaskInfo();
if (info == null) {
return getJob().getName();
}
return info.getDisplayString(showProgress);
}
if (getJob().getState() == Job.SLEEPING) {
return NLS.bind(ProgressMessages.JobInfo_Sleeping, (new Object[] { getJob().getName() }));
}
return NLS.bind(ProgressMessages.JobInfo_Waiting, (new Object[] { getJob().getName() }));
}
示例2: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final de.darwinspl.preferences.resource.dwprofile.IDwprofileTextResource resource, final de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例3: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionTextResource resource, final eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例4: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaTextResource resource, final eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例5: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueTextResource resource, final eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例6: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.feature.mapping.resource.hymapping.IHymappingTextResource resource, final eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例7: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsTextResource resource, final eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例8: parse
/**
* Schedules a task for background parsing that will be started after a delay.
*/
public void parse(final String contents, final eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestTextResource resource, final eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor editor, long delay) {
if (resource == null) {
return;
}
if (contents == null) {
return;
}
// this synchronization is needed to avoid the creation of multiple tasks. without
// the synchronization this could easily happen, when this method is accessed by
// multiple threads. the creation of multiple tasks would imply that multiple
// background parsing threads for one editor are created, which is not desired.
synchronized (lock) {
if (job == null || job.getState() != Job.RUNNING) {
// schedule new task
job = new ParsingJob();
job.resource = resource;
job.editor = editor;
job.newContents = contents;
job.schedule();
} else {
job.newContents = contents;
}
}
}
示例9: getJobNameAndStatus
/**
* Get the name and status for a jobInfo
*
* @param jobInfo
*
* @return String
*/
public String getJobNameAndStatus(JobInfo jobInfo) {
Job job = jobInfo.getJob();
String name = job.getName();
if (job.isSystem()) {
name = NLS.bind(ProgressMessages.JobInfo_System, name);
}
if (jobInfo.isCanceled()) {
if (job.getState() == Job.RUNNING)
return NLS
.bind(ProgressMessages.JobInfo_Cancel_Requested, name);
return NLS.bind(ProgressMessages.JobInfo_Cancelled, name);
}
if (jobInfo.isBlocked()) {
IStatus blockedStatus = jobInfo.getBlockedStatus();
return NLS.bind(ProgressMessages.JobInfo_Blocked, name,
blockedStatus.getMessage());
}
switch (job.getState()) {
case Job.RUNNING:
return name;
case Job.SLEEPING: {
return NLS.bind(ProgressMessages.JobInfo_Sleeping, name);
}
case Job.NONE: // Only happens for kept jobs
return getJobInfoFinishedString(job, true);
default:
return NLS.bind(ProgressMessages.JobInfo_Waiting, name);
}
}
示例10: isRunning
/**
* Return whether or not the receiver is being displayed as running.
*
* @return boolean
*/
private boolean isRunning() {
JobInfo[] infos = getJobInfos();
for (int i = 0; i < infos.length; i++) {
int state = infos[i].getJob().getState();
if (state == Job.WAITING || state == Job.RUNNING)
return true;
}
return false;
}
示例11: updateStagingLocations
/**
* Fetch the staging locations from GCS in a background task and update the Staging Locations
* combo.
*/
@VisibleForTesting
void updateStagingLocations(long scheduleDelay) {
Credential credential = accountSelector.getSelectedCredential();
String selectedEmail = accountSelector.getSelectedEmail();
GcpProject project = projectInput.getProject();
// Retrieving staging locations requires an authenticated user and project.
// Check if there is an update is in progress; if it matches our user and project,
// then quick-return, otherwise it is stale and should be cancelled.
if (fetchStagingLocationsJob != null) {
if (project != null
&& Objects.equals(project.getId(), fetchStagingLocationsJob.getProjectId())
&& Objects.equals(selectedEmail, fetchStagingLocationsJob.getAccountEmail())
&& fetchStagingLocationsJob.getState() == Job.RUNNING) {
return;
}
fetchStagingLocationsJob.abandon();
}
fetchStagingLocationsJob = null;
if (project != null && credential != null) {
fetchStagingLocationsJob =
new FetchStagingLocationsJob(getGcsClient(), selectedEmail, project.getId());
fetchStagingLocationsJob.onSuccess(displayExecutor, new Consumer<SortedSet<String>>() {
@Override
public void accept(SortedSet<String> stagingLocations) {
updateStagingLocations(stagingLocations);
validate(); // reports message back to UI
}});
fetchStagingLocationsJob.onError(displayExecutor, new Consumer<Exception>() {
@Override
public void accept(Exception exception) {
DataflowUiPlugin.logError(exception, "Exception while retrieving staging locations"); //$NON-NLS-1$
validate();
}});
fetchStagingLocationsJob.schedule(scheduleDelay);
}
}
示例12: startStagingLocationCheck
/**
* Ensure the staging location specified in the input combo is valid.
*/
@VisibleForTesting
void startStagingLocationCheck(long schedulingDelay) {
String accountEmail = getAccountEmail();
String stagingLocation = getStagingLocation();
if (verifyStagingLocationJob != null) {
if (Objects.equals(accountEmail, verifyStagingLocationJob.getEmail())
&& Objects.equals(stagingLocation, verifyStagingLocationJob.getStagingLocation())
&& verifyStagingLocationJob.getState() == Job.RUNNING) {
// an update is in progress
return;
}
// Cancel any existing verifyStagingLocationJob
verifyStagingLocationJob.abandon();
verifyStagingLocationJob = null;
}
if (Strings.isNullOrEmpty(accountEmail) || Strings.isNullOrEmpty(stagingLocation)) {
return;
}
verifyStagingLocationJob =
new VerifyStagingLocationJob(getGcsClient(), accountEmail, stagingLocation);
verifyStagingLocationJob.onSuccess(displayExecutor, new Runnable() {
@Override
public void run() {
validate();
}
});
verifyStagingLocationJob.schedule(schedulingDelay);
}
示例13: stopObligation
/**
* Sends a signal to the prover indicating that the obligation,
* whose status is represented by marker, should be stopped.
*
* The marker should by of the type {@link #OBLIGATION_MARKER}.
*
* This method assumes that there is at most one prover job currently
* running and that this marker is for an obligation from that prover
* job.
*
* @param marker
*/
public static void stopObligation(IMarker marker)
{
ProverUIActivator.getDefault().logDebug("Stop obligation " + marker.getAttribute(OBLIGATION_ID, -1));
// a count of running prover jobs for debugging
// check to see that there is at most 1
int numProverJobs = 0;
Job[] jobs = Job.getJobManager().find(new ProverJob.ProverJobMatcher());
for (int i = 0; i < jobs.length; i++)
{
if (jobs[i] instanceof ProverJob && jobs[i].getState() == Job.RUNNING)
{
numProverJobs++;
ProverJob proverJob = (ProverJob) jobs[i];
proverJob.stopObligation(marker.getAttribute(OBLIGATION_ID, -1));
}
}
if (numProverJobs > 1)
{
ProverUIActivator.getDefault().logDebug("We found " + numProverJobs + " running when obligation "
+ marker.getAttribute(OBLIGATION_ID, -1) + " was stopped. This is a bug.");
}
}
示例14: update
public void update() {
if (state != State.READY) return;
switch (getState()) {
case Job.WAITING:
case Job.RUNNING:
schedule(store.getInt(Prefs.VIEW_UPDATE_DELAY));
break;
default:
schedule(SHORT);
break;
}
}
示例15: dumpJob
private void dumpJob(StringBuilder sb, String linePrefix, Job job, Thread thread) {
String status;
switch (job.getState()) {
case Job.RUNNING:
status = "RUNNING";
break;
case Job.WAITING:
status = "WAITING";
break;
case Job.SLEEPING:
status = "SLEEPING";
break;
case Job.NONE:
status = "NONE";
break;
default:
status = "UNKNOWN(" + job.getState() + ")";
break;
}
Object blockingJob = null;
try {
blockingJob = ReflectionUtil.invoke(Job.getJobManager(), "findBlockingJob",
InternalJob.class, new Class<?>[] {InternalJob.class}, job);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException ex) {
System.err.println("Unable to fetch blocking-job: " + ex);
}
sb.append("\n").append(linePrefix);
//@formatter:off
sb.append(String.format(" %s%s{pri=%d%s%s%s%s} %s (%s)%s",
status,
(job.isBlocking() ? "<BLOCKING>" : ""),
job.getPriority(),
(job.isSystem() ? ",system" : ""),
(job.isUser() ? ",user" : ""),
(job.getRule() != null ? ",rule=" + job.getRule() : ""),
(thread != null ? ",thr=" + thread : ""),
job,
job.getClass().getName(),
(job.getJobGroup() != null ? " [group=" + job.getJobGroup() + "]" : "")));
if (blockingJob != null) {
sb.append("\n").append(linePrefix)
.append(String.format(" - blocked by: %s (%s)", blockingJob, blockingJob.getClass()));
}
//@formatter:on
}