本文整理匯總了Java中org.eclipse.core.runtime.jobs.Job.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Job.getName方法的具體用法?Java Job.getName怎麽用?Java Job.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.jobs.Job
的用法示例。
在下文中一共展示了Job.getName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getJobNameAndStatus
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
/**
* 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);
}
}
示例2: done
import org.eclipse.core.runtime.jobs.Job; //導入方法依賴的package包/類
public void done(IJobChangeEvent event) {
final Job j = event.getJob();
if(j.belongsTo(ToolboxJob.FAMILY)) {
final String jobName = j.getName();
if(jobName.endsWith(model.getName())) {
job = j;
}
}
}