本文整理汇总了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;
}
}
}