Issue #1214 Made VizGlobalsManager check for null window before calling getPage() since getInstance() still returns succesfully when null window is passed in. Change TimeMatchingJob to be shutdown when core plugin stops and cancels existing jobs.
Amend: Removed println Change-Id: I3559b13074eb025e9bf931685cda3e804037baff Former-commit-id:51e565c6ff
[formerly4b2467e639
] [formerly51e565c6ff
[formerly4b2467e639
] [formerlyedfd7fd22f
[formerly fc617c1392d9585d2e91e371af74aad4b24acfbb]]] Former-commit-id:edfd7fd22f
Former-commit-id:f0376e0240
[formerly63c30eafc2
] Former-commit-id:e021aee0c8
This commit is contained in:
parent
284ab4c3bf
commit
471e8249b2
2 changed files with 44 additions and 13 deletions
|
@ -24,6 +24,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
@ -163,8 +164,12 @@ public class VizGlobalsManager {
|
|||
*/
|
||||
public void updateUI(IDisplayPaneContainer editor,
|
||||
IRenderableDisplay display) {
|
||||
if (window.getActivePage().getActiveEditor() != editor) {
|
||||
return;
|
||||
if (window != null) {
|
||||
// Check the active editor on the window
|
||||
IWorkbenchPage page = window.getActivePage();
|
||||
if (page != null && page.getActiveEditor() != editor) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (editor != null && display != null) {
|
||||
Map<String, Object> globals = display.getGlobalsMap();
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.services.IDisposable;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -57,6 +58,17 @@ public class TimeMatchingJob extends Job {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TimeMatchingJob.class);
|
||||
|
||||
static {
|
||||
Activator.getDefault().registerDisposable(new IDisposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean running = true;
|
||||
|
||||
private static Map<IDescriptor, TimeMatchingJob> map = new ConcurrentHashMap<IDescriptor, TimeMatchingJob>();
|
||||
|
||||
private IDescriptor request;
|
||||
|
@ -68,20 +80,35 @@ public class TimeMatchingJob extends Job {
|
|||
this.request = desc;
|
||||
}
|
||||
|
||||
public static synchronized void scheduleTimeMatch(IDescriptor desc) {
|
||||
if (desc != null && desc.getTimeMatcher() != null) {
|
||||
TimeMatchingJob job = map.get(desc);
|
||||
if (job == null) {
|
||||
job = new TimeMatchingJob(desc);
|
||||
job.setSystem(true);
|
||||
} else {
|
||||
job.keepAround = true;
|
||||
public static void scheduleTimeMatch(IDescriptor desc) {
|
||||
synchronized (TimeMatchingJob.class) {
|
||||
if (running == false) {
|
||||
return;
|
||||
}
|
||||
if (desc != null && desc.getTimeMatcher() != null) {
|
||||
TimeMatchingJob job = map.get(desc);
|
||||
if (job == null) {
|
||||
job = new TimeMatchingJob(desc);
|
||||
job.setSystem(true);
|
||||
} else {
|
||||
job.keepAround = true;
|
||||
}
|
||||
map.put(desc, job);
|
||||
job.schedule();
|
||||
}
|
||||
map.put(desc, job);
|
||||
job.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
private static void shutdown() {
|
||||
synchronized (TimeMatchingJob.class) {
|
||||
running = false;
|
||||
}
|
||||
for (TimeMatchingJob job : map.values()) {
|
||||
job.cancel();
|
||||
}
|
||||
map.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -111,7 +138,6 @@ public class TimeMatchingJob extends Job {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Error redoing time matching", e);
|
||||
|
|
Loading…
Add table
Reference in a new issue