本文整理汇总了Java中org.eclipse.core.runtime.jobs.JobChangeAdapter类的典型用法代码示例。如果您正苦于以下问题:Java JobChangeAdapter类的具体用法?Java JobChangeAdapter怎么用?Java JobChangeAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobChangeAdapter类属于org.eclipse.core.runtime.jobs包,在下文中一共展示了JobChangeAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runContainerResolverJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public static void runContainerResolverJob(IJavaProject javaProject) {
IEclipseContext context = EclipseContextFactory.getServiceContext(
FrameworkUtil.getBundle(BuildPath.class).getBundleContext());
final IEclipseContext childContext =
context.createChild(LibraryClasspathContainerResolverJob.class.getName());
childContext.set(IJavaProject.class, javaProject);
Job job =
ContextInjectionFactory.make(LibraryClasspathContainerResolverJob.class, childContext);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
childContext.dispose();
}
});
job.schedule();
}
示例2: performSave
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
@SuppressWarnings ( "unchecked" )
public void performSave ( final IProgressMonitor monitor )
{
// provide a copy so that it can be accessed outside the realm
final UpdateJob updateJob = update ( new HashMap<String, String> ( this.dataMap ), null );
updateJob.setProgressGroup ( monitor, 2 );
updateJob.addJobChangeListener ( new JobChangeAdapter () {
@Override
public void done ( final IJobChangeEvent event )
{
performLoad ( monitor );
}
} );
updateJob.schedule ();
}
示例3: ReattachProjectBundleSourcesJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
/**
* @param name
*/
public ReattachProjectBundleSourcesJob() {
super("Collecting plugin projects");
addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult().isOK() && pluginContainerEntries != null && pluginContainerEntries.length > 0) {
// System.err.println("Reattaching bundle sources for " +
// pluginContainerEntries.length + " plugin containers entries");
AbstractSourceDownloadJob sourceAttacherJob = new AbstractSourceDownloadJob(
"Attaching project bundle sources", new CachedSourceLocator()) {
};
sourceAttacherJob.queue(pluginContainerEntries);
sourceAttacherJob.schedule();
}
}
});
}
示例4: getAutoShareJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public synchronized static AutoShareJob getAutoShareJob() {
if (autoShareJob == null) {
autoShareJob = new AutoShareJob();
autoShareJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
// Reschedule the job if it has unprocessed projects
if (!autoShareJob.isQueueEmpty()) {
autoShareJob.schedule();
}
}
});
autoShareJob.setSystem(true);
autoShareJob.setPriority(Job.SHORT);
// Must run with the workspace rule to ensure that projects added while we're running
// can be shared
autoShareJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
}
return autoShareJob;
}
示例5: setJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public void setJob(DeployJob newJob) {
DeployJob oldJob = job;
job = newJob;
firePropertyChange(this, PROPERTY_JOB, oldJob, newJob);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
setName(Messages.getString("job.terminated.template", getName()));
}
});
}
});
}
示例6: testIgnoreInnerPomChanges
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
@Test
public void testIgnoreInnerPomChanges() throws Exception {
IProject project = importMavenProject("archetyped");
assertEquals("The inner pom should not have been imported", 2, WorkspaceHelper.getAllProjects().size());
IFile innerPom = project.getFile("src/main/resources/archetype-resources/pom.xml");
preferences.setUpdateBuildConfigurationStatus(FeatureStatus.automatic);
boolean[] updateTriggered = new boolean[1];
IJobChangeListener listener = new JobChangeAdapter() {
@Override
public void scheduled(IJobChangeEvent event) {
if (event.getJob().getName().contains("Update project")) {
updateTriggered[0] = true;
}
}
};
try {
Job.getJobManager().addJobChangeListener(listener);
projectsManager.fileChanged(innerPom.getRawLocationURI().toString(), CHANGE_TYPE.CHANGED);
waitForBackgroundJobs();
assertFalse("Update project should not have been triggered", updateTriggered[0]);
} finally {
Job.getJobManager().removeJobChangeListener(listener);
}
}
示例7: getSiteDownloadJobChangeListener
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
private JobChangeAdapter getSiteDownloadJobChangeListener(
final File tempFile, final UpdateSiteToken token) {
return new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
IStatus result = event.getResult();
if (result != null && result.isOK()) {
Element rootElement = getRootElement(tempFile);
if (rootElement != null) {
List<UpdateInfo> updates =
updateCheckersMap.get(token).checkForUpdates(rootElement);
assert (updates != null);
if (!updates.isEmpty()) {
updateList.addAll(updates);
}
}
}
// Signal the parent on completion of the download.
siteXmlDownloadJobsCountDownLatch.countDown();
}
};
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:CompositeArtifactsDowloadJobChangeListener.java
示例8: initPreferencesStore
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
private void initPreferencesStore() {
IScopeContext projectScope = new ProjectScope(project);
preferences = projectScope.getNode(FileSyncPlugin.PLUGIN_ID);
buildPathMap(preferences);
preferences.addPreferenceChangeListener(this);
preferences.addNodeChangeListener(this);
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
manager.addValueVariableListener(this);
jobChangeAdapter = new JobChangeAdapter(){
@Override
public void done(IJobChangeEvent event) {
// XXX dirty trick to re-evaluate dynamic egit variables on branch change
if(!event.getJob().getClass().getName().contains("org.eclipse.egit.ui.internal.branch.BranchOperationUI")){
return;
}
rebuildPathMap();
}
};
Job.getJobManager().addJobChangeListener(jobChangeAdapter);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
示例9: upgradeProject
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public void upgradeProject(final File path) {
UpgradeJob job = new UpgradeJob("upgrade", path);
job.setUser(true);
job.schedule();
job.getState();
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (event.getResult().isOK())
Display.getDefault().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(null,
"upgrade is over", "SVN升级完毕,请重新操作!");
}
});
}
});
}
示例10: doCreateRefreshJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
@Override
protected WorkbenchJob doCreateRefreshJob() {
WorkbenchJob job = super.doCreateRefreshJob();
job.addJobChangeListener(new JobChangeAdapter() {
@SuppressWarnings("deprecation")
@Override
public void done(IJobChangeEvent event) {
if (event.getResult() != null && event.getResult().isOK() && !getViewer().getTree().isDisposed()) {
Set<String> joinChecked = new HashSet(getSelectedValues());
for(String i : getPartialValues()) {
getViewer().setGrayed(i, true);
joinChecked.add(i);
}
getViewer().setCheckedElements(joinChecked.toArray());
}
}
});
return job;
}
示例11: loadTemplatePlans
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
/**
* When the TreeViewer is refreshed, the template plans are re-loaded. Do this in a Job.
* @param viewer the TreeViewer being refreshed
*/
protected synchronized void loadTemplatePlans() {
if (loadJobInProgress) {
return;
}
final Job load = new TemplatePlanLoadingJob("Loading Template Plan", treeViewer);
load.addJobChangeListener(new JobChangeAdapter() {
/**
* When the Job is done, if it was successful clear the Job's name.
* @param event contains the Job's results, indicating whether successful
*/
@Override
public void done(IJobChangeEvent event) {
loadJobInProgress = false;
if (event.getResult().isOK())
load.setName("");
}
});
load.schedule();
loadJobInProgress = true;
}
示例12: doCreateRefreshJob
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
protected WorkbenchJob doCreateRefreshJob() {
WorkbenchJob filterJob = super.doCreateRefreshJob();
filterJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
getDisplay().asyncExec(new Runnable() {
public void run() {
if (checkboxViewer.getTree().isDisposed())
return;
checkboxViewer.restoreLeafCheckState();
}
});
}
}
});
return filterJob;
}
示例13: submit
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public void submit(PdfRequest request) {
// if There is no running job - Start it
// Else add to the Queue
synchronized (PdfScheduler.class) {
if (runningJob == null) {
runningJob = new PdfJob("PDF Something", request);
runningJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
runningJob = null;
}
});
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
runningJob.schedule();
return null;
}
});
}
}
}
示例14: start
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public void start() {
synchronized (PdfScheduler.class) {
if (runningJob == null) {
runningJob = new PdfJob("PDF Something", null);
runningJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
runningJob = null;
}
});
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
runningJob.schedule();
return null;
}
});
}
}
}
示例15: start
import org.eclipse.core.runtime.jobs.JobChangeAdapter; //导入依赖的package包/类
public static void start() {
synchronized (JobScheduler.class) {
if (runningJob == null) {
runningJob = new DemoJob("XPages Demo Database");
runningJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
runningJob = null;
}
});
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
runningJob.schedule();
return null;
}
});
}
}
}