Merge "Issue #206 Made tear off menu dialog activate contexts for perspective" into 10-Tech_Blocked
Former-commit-id:b1eca1ae8f
[formerly54d27a840f
[formerly 1ca26738cc10a37119b939a405987198245a4d65]] Former-commit-id:54d27a840f
Former-commit-id:9893d3b246
This commit is contained in:
commit
167c03907d
4 changed files with 47 additions and 8 deletions
|
@ -29,9 +29,9 @@ import org.eclipse.core.runtime.IExtension;
|
|||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.contexts.IContextActivation;
|
||||
import org.eclipse.ui.contexts.IContextService;
|
||||
import org.eclipse.ui.services.IServiceLocator;
|
||||
|
||||
/**
|
||||
* Uses extension point to look up contexts for editors
|
||||
|
@ -61,7 +61,7 @@ public class ContextManager {
|
|||
|
||||
private static final String EXTENSION_POINT = "com.raytheon.uf.viz.core.classContext";
|
||||
|
||||
private static Map<IWorkbenchWindow, ContextManager> instanceMap = new HashMap<IWorkbenchWindow, ContextManager>();
|
||||
private static Map<IServiceLocator, ContextManager> instanceMap = new HashMap<IServiceLocator, ContextManager>();
|
||||
|
||||
private static synchronized String[] getContextsForClass(String name) {
|
||||
if (contexts == null) {
|
||||
|
@ -126,11 +126,11 @@ public class ContextManager {
|
|||
}
|
||||
|
||||
public static synchronized ContextManager getInstance(
|
||||
IWorkbenchWindow window) {
|
||||
ContextManager manager = instanceMap.get(window);
|
||||
IServiceLocator locator) {
|
||||
ContextManager manager = instanceMap.get(locator);
|
||||
if (manager == null) {
|
||||
manager = new ContextManager(window);
|
||||
instanceMap.put(window, manager);
|
||||
manager = new ContextManager(locator);
|
||||
instanceMap.put(locator, manager);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
@ -141,8 +141,8 @@ public class ContextManager {
|
|||
|
||||
private IContextService service;
|
||||
|
||||
private ContextManager(IWorkbenchWindow window) {
|
||||
service = (IContextService) window.getService(IContextService.class);
|
||||
private ContextManager(IServiceLocator locator) {
|
||||
service = (IContextService) locator.getService(IContextService.class);
|
||||
activeObjects = new HashSet<Object>();
|
||||
activeMap = new HashMap<String, ContextManager.Context>();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,10 @@ import org.eclipse.swt.widgets.Menu;
|
|||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Monitor;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.services.IServiceLocator;
|
||||
|
||||
import com.raytheon.uf.viz.core.ContextManager;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
@ -159,6 +162,37 @@ public class TearOffMenuDialog extends CaveSWTDialog {
|
|||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#opened()
|
||||
*/
|
||||
@Override
|
||||
protected void opened() {
|
||||
final IServiceLocator locator = PlatformUI.getWorkbench();
|
||||
|
||||
Listener activate = new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
ContextManager.getInstance(locator).activateContexts(
|
||||
perspectiveManager);
|
||||
}
|
||||
};
|
||||
Listener deactivate = new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
ContextManager.getInstance(locator).deactivateContexts(
|
||||
perspectiveManager);
|
||||
}
|
||||
};
|
||||
|
||||
addListener(SWT.Activate, activate);
|
||||
addListener(SWT.Deactivate, deactivate);
|
||||
addListener(SWT.Close, deactivate);
|
||||
|
||||
activate.handleEvent(new Event());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
for (Control control : fullComp.getChildren()) {
|
||||
|
|
|
@ -2042,6 +2042,9 @@
|
|||
point="com.raytheon.uf.viz.core.classContext">
|
||||
<classContext
|
||||
class="com.raytheon.viz.gfe.perspective.GFEPerspectiveManager">
|
||||
<contextId
|
||||
id="com.raytheon.viz.gfe.GFEActionSet">
|
||||
</contextId>
|
||||
<contextId
|
||||
id="com.raytheon.viz.gfe.GFEContext">
|
||||
</contextId>
|
||||
|
|
|
@ -1610,6 +1610,8 @@
|
|||
point="com.raytheon.uf.viz.core.classContext">
|
||||
<classContext
|
||||
class="com.raytheon.viz.mpe.ui.perspective.MPEPerspectiveManager">
|
||||
<contextId id="com.raytheon.viz.MPEActionSet">
|
||||
</contextId>
|
||||
<contextId id="com.raytheon.viz.mpe.ui.MPE">
|
||||
</contextId>
|
||||
<contextId id="com.raytheon.viz.ui.tools.nav.zoom">
|
||||
|
|
Loading…
Add table
Reference in a new issue