Issue #206 Made tear off menu dialog activate contexts for perspective

Former-commit-id: b58c024d63 [formerly 83de7660b6] [formerly c410a4eb33] [formerly c410a4eb33 [formerly 5f8d30bb43]] [formerly b58c024d63 [formerly 83de7660b6] [formerly c410a4eb33] [formerly c410a4eb33 [formerly 5f8d30bb43]] [formerly e422b13ded [formerly c410a4eb33 [formerly 5f8d30bb43] [formerly e422b13ded [formerly 56103eb133de5325d62bb3453b2353e5d5e23ddd]]]]]
Former-commit-id: e422b13ded
Former-commit-id: 0d84e1a734 [formerly 2683c94927] [formerly 2185e1a31e] [formerly 624cffa8938b4f55a1d6f10225291f695228f57b [formerly e58fc953c960af41fe0d16f529fdd017ca742ce6] [formerly 2185e1a31e [formerly 3a26b0cea5]]]
Former-commit-id: 20f616eaac99e312bedaf8a0ee8de24db97e415a [formerly 24fc32448fdd1698623b35041a064809142646d4] [formerly 0f4a0c7948 [formerly 1954b637a4]]
Former-commit-id: 0f4a0c7948
Former-commit-id: 53a9af140e
This commit is contained in:
Max Schenkelberg 2012-02-01 17:03:20 -06:00
parent 7584f0f574
commit a43b8a6a24
4 changed files with 47 additions and 8 deletions

View file

@ -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>();
}

View file

@ -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()) {

View file

@ -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>

View file

@ -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">