use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project tmdm-studio-se by Talend.
the class MDMValidationRunner method validate.
public static IModelValidateResult validate(List<IRepositoryViewObject> viewObjs, IValidationPreference validationPref, boolean forbidShowResultDialog) {
MDMValidationRunner runner = new MDMValidationRunner(viewObjs, validationPref, forbidShowResultDialog);
IJobChangeListener listener = new JobChangeAdapter() {
@Override
public void aboutToRun(IJobChangeEvent event) {
running = true;
}
@Override
public void done(IJobChangeEvent event) {
running = false;
}
};
runner.addJobChangeListener(listener);
runner.schedule();
try {
runner.join();
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
}
return runner.validateResult;
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project eclipse.jdt.ls by eclipse.
the class MavenBuildSupportTest method testIgnoreInnerPomChanges.
@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);
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project liferay-ide by liferay.
the class MavenGoalAction method run.
public void run(IAction action) {
if (fSelection instanceof IStructuredSelection) {
Object[] elems = ((IStructuredSelection) fSelection).toArray();
IFile pomXml = null;
IProject project = null;
Object elem = elems[0];
if (elem instanceof IFile) {
pomXml = (IFile) elem;
project = pomXml.getProject();
} else if (elem instanceof IProject) {
project = (IProject) elem;
pomXml = project.getFile(IMavenConstants.POM_FILE_NAME);
}
if (FileUtil.exists(pomXml)) {
IProject p = project;
IFile pomXmlFile = pomXml;
try {
String pluginKey = ILiferayMavenConstants.LIFERAY_MAVEN_PLUGINS_GROUP_ID + ":" + ILiferayMavenConstants.LIFERAY_MAVEN_PLUGIN_ARTIFACT_ID;
plugin = MavenUtil.getPlugin(MavenUtil.getProjectFacade(p), pluginKey, new NullProgressMonitor());
if (plugin == null) {
plugin = MavenUtil.getPlugin(MavenUtil.getProjectFacade(p), getGroupId() + ":" + getPluginKey(), new NullProgressMonitor());
}
} catch (CoreException ce) {
}
Job job = new Job(p.getName() + " - " + getMavenGoals()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
if (plugin == null) {
return ProjectUI.createErrorStatus("Can't find any plugins for " + getMavenGoals());
}
monitor.beginTask(getMavenGoals(), 100);
_runMavenGoal(pomXmlFile, getMavenGoals(), monitor);
monitor.worked(80);
p.refreshLocal(IResource.DEPTH_INFINITE, monitor);
monitor.worked(10);
updateProject(p, monitor);
monitor.worked(10);
} catch (Exception e) {
return ProjectUI.createErrorStatus("Error running Maven goal " + getMavenGoals(), e);
}
return Status.OK_STATUS;
}
};
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
afterGoal();
}
});
job.schedule();
}
}
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project mylyn.docs by eclipse.
the class MarkupEditor method scheduleOutlineUpdate.
private void scheduleOutlineUpdate() {
synchronized (MarkupEditor.this) {
if (updateJobScheduled) {
return;
}
}
updateOutlineJob = new UIJob(Messages.MarkupEditor_updateOutline) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
synchronized (MarkupEditor.this) {
updateJobScheduled = false;
}
if (!outlineDirty) {
return Status.CANCEL_STATUS;
}
updateOutline();
return Status.OK_STATUS;
}
};
updateOutlineJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void scheduled(IJobChangeEvent event) {
synchronized (MarkupEditor.this) {
updateJobScheduled = true;
}
}
@Override
public void done(IJobChangeEvent event) {
synchronized (MarkupEditor.this) {
updateJobScheduled = false;
updateOutlineJob = null;
}
}
});
updateOutlineJob.setUser(false);
updateOutlineJob.setSystem(true);
updateOutlineJob.setPriority(Job.INTERACTIVE);
updateOutlineJob.schedule(600);
}
use of org.eclipse.core.runtime.jobs.IJobChangeEvent in project egit by eclipse.
the class FindToolbar method createFinder.
private FindToolbarJob createFinder() {
if (job != null) {
job.cancel();
}
final String currentPattern = getSearchPattern();
job = new FindToolbarJob(MessageFormat.format(UIText.HistoryPage_findbar_find, currentPattern), findResults);
job.pattern = currentPattern;
job.fileRevisions = fileRevisions;
job.ignoreCase = caseItem.getSelection();
if (allItem.getSelection()) {
job.findInCommitId = true;
job.findInComments = true;
job.findInAuthor = true;
job.findInCommitter = true;
job.findInReference = true;
} else {
job.findInCommitId = commitIdItem.getSelection();
job.findInComments = commentsItem.getSelection();
job.findInAuthor = authorItem.getSelection();
job.findInCommitter = committerItem.getSelection();
job.findInReference = referenceItem.getSelection();
}
job.addJobChangeListener(new JobChangeAdapter() {
private final FindToolbarJob myJob = job;
@Override
public void done(final IJobChangeEvent event) {
if (event.getResult().isOK()) {
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (myJob != job || myJob.fileRevisions != fileRevisions) {
// changed
return;
}
if (!isDisposed()) {
findCompletionUpdate(currentPattern, findResults.isOverflow());
}
}
});
}
}
});
return job;
}
Aggregations