Issue #590 fixed context activation for GFE when non GFE views/editors are active. Generalized so any perspective can take advantage of it.
Change-Id: I98fa8bd80d2235d605f94f227490e4438ef70ca5 Former-commit-id: 75fb17528d393b767df8d8a34abd5e41f007b771
This commit is contained in:
parent
22d4de96fd
commit
130692aefd
7 changed files with 339 additions and 198 deletions
|
@ -19,14 +19,14 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.d2d.ui.perspectives;
|
package com.raytheon.uf.viz.d2d.ui.perspectives;
|
||||||
|
|
||||||
import org.eclipse.ui.IPartListener2;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.IWorkbenchPartReference;
|
import org.eclipse.ui.IWorkbenchPartReference;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.ContextManager;
|
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
|
import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
|
||||||
|
import com.raytheon.viz.ui.perspectives.AbstractWorkbenchPartContextActivator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates context for D2D UI for IDisplayPaneContainers with
|
* Activates context for D2D UI for IDisplayPaneContainers with
|
||||||
|
@ -46,15 +46,20 @@ import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class D2DContextActivator implements IPartListener2 {
|
public class D2DContextActivator extends AbstractWorkbenchPartContextActivator {
|
||||||
|
|
||||||
private ContextManager contextManager;
|
D2DContextActivator(IWorkbenchPage page) {
|
||||||
|
super(page);
|
||||||
D2DContextActivator(ContextManager contextManager) {
|
|
||||||
this.contextManager = contextManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasD2DDisplay(IWorkbenchPartReference partRef) {
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.perspectives.AbstractPerspectiveContextManager#
|
||||||
|
* isPerspectivePart(org.eclipse.ui.IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected boolean isPerspectivePart(IWorkbenchPartReference partRef) {
|
||||||
if (partRef != null) {
|
if (partRef != null) {
|
||||||
IWorkbenchPart part = partRef.getPart(false);
|
IWorkbenchPart part = partRef.getPart(false);
|
||||||
if (part instanceof IDisplayPaneContainer) {
|
if (part instanceof IDisplayPaneContainer) {
|
||||||
|
@ -69,104 +74,4 @@ public class D2DContextActivator implements IPartListener2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deactivate(IWorkbenchPartReference partRef) {
|
|
||||||
if (hasD2DDisplay(partRef)) {
|
|
||||||
contextManager.deactivateContexts(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void activate(IWorkbenchPartReference partRef) {
|
|
||||||
if (hasD2DDisplay(partRef)) {
|
|
||||||
contextManager.activateContexts(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partActivated(IWorkbenchPartReference partRef) {
|
|
||||||
activate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partBroughtToTop(IWorkbenchPartReference partRef) {
|
|
||||||
activate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partClosed(IWorkbenchPartReference partRef) {
|
|
||||||
deactivate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partDeactivated(IWorkbenchPartReference partRef) {
|
|
||||||
deactivate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partOpened(IWorkbenchPartReference partRef) {
|
|
||||||
activate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partHidden(IWorkbenchPartReference partRef) {
|
|
||||||
deactivate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partVisible(IWorkbenchPartReference partRef) {
|
|
||||||
activate(partRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.
|
|
||||||
* IWorkbenchPartReference)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void partInputChanged(IWorkbenchPartReference partRef) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.ContextManager;
|
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
|
@ -119,13 +118,9 @@ public class D2DPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
|
|
||||||
private static Map<Object, AbstractRightClickAction> legendActions = new HashMap<Object, AbstractRightClickAction>();
|
private static Map<Object, AbstractRightClickAction> legendActions = new HashMap<Object, AbstractRightClickAction>();
|
||||||
|
|
||||||
private D2DContextActivator contextActivator;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
contextActivator = new D2DContextActivator(
|
contextActivator = new D2DContextActivator(page);
|
||||||
ContextManager.getInstance(perspectiveWindow));
|
|
||||||
page.addPartListener(contextActivator);
|
|
||||||
Procedure procedure = new Procedure();
|
Procedure procedure = new Procedure();
|
||||||
List<Bundle> bundles = new ArrayList<Bundle>();
|
List<Bundle> bundles = new ArrayList<Bundle>();
|
||||||
for (MapScale scale : MapScales.getInstance().getScales()) {
|
for (MapScale scale : MapScales.getInstance().getScales()) {
|
||||||
|
@ -455,53 +450,4 @@ public class D2DPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
return new ChangeLegendModeAction(mode, rsc);
|
return new ChangeLegendModeAction(mode, rsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.perspectives.AbstractCAVEPerspectiveManager#
|
|
||||||
* activateInternal()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void activateInternal() {
|
|
||||||
super.activateInternal();
|
|
||||||
page.addPartListener(contextActivator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#deactivate
|
|
||||||
* ()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void deactivate() {
|
|
||||||
super.deactivate();
|
|
||||||
page.removePartListener(contextActivator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#
|
|
||||||
* activateContexts(com.raytheon.uf.viz.core.ContextManager)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void activateContexts(ContextManager manager) {
|
|
||||||
super.activateContexts(manager);
|
|
||||||
contextActivator.partActivated(page.getActivePartReference());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#
|
|
||||||
* deactivateContexts(com.raytheon.uf.viz.core.ContextManager)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void deactivateContexts(ContextManager manager) {
|
|
||||||
super.deactivateContexts(manager);
|
|
||||||
contextActivator.partDeactivated(page.getActivePartReference());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1855,8 +1855,10 @@
|
||||||
|
|
||||||
|
|
||||||
<extension id="com.raytheon.viz.ui.bindings" point="org.eclipse.ui.bindings">
|
<extension id="com.raytheon.viz.ui.bindings" point="org.eclipse.ui.bindings">
|
||||||
<key commandId="com.raytheon.viz.gfe.toggleLegend" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
<key commandId="com.raytheon.viz.gfe.toggleLegend"
|
||||||
sequence="NUMPAD_ENTER">
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
|
||||||
|
sequence="NUMPAD_ENTER"
|
||||||
|
contextId="com.raytheon.viz.gfe.GFEShortCutContext">
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
@ -2048,9 +2050,6 @@
|
||||||
<contextId
|
<contextId
|
||||||
id="com.raytheon.viz.gfe.GFEContext">
|
id="com.raytheon.viz.gfe.GFEContext">
|
||||||
</contextId>
|
</contextId>
|
||||||
<contextId
|
|
||||||
id="com.raytheon.viz.gfe.GFEShortCutContext">
|
|
||||||
</contextId>
|
|
||||||
</classContext>
|
</classContext>
|
||||||
<classContext
|
<classContext
|
||||||
class="com.raytheon.viz.gfe.GridManagerView">
|
class="com.raytheon.viz.gfe.GridManagerView">
|
||||||
|
@ -2058,5 +2057,11 @@
|
||||||
id="com.raytheon.viz.ui.loopContext">
|
id="com.raytheon.viz.ui.loopContext">
|
||||||
</contextId>
|
</contextId>
|
||||||
</classContext>
|
</classContext>
|
||||||
|
<classContext
|
||||||
|
class="com.raytheon.viz.gfe.perspective.GFEContextActivator">
|
||||||
|
<contextId
|
||||||
|
id="com.raytheon.viz.gfe.GFEShortCutContext">
|
||||||
|
</contextId>
|
||||||
|
</classContext>
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.gfe.perspective;
|
||||||
|
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartReference;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
|
import com.raytheon.viz.gfe.GridManagerView;
|
||||||
|
import com.raytheon.viz.gfe.core.GFEMapRenderableDisplay;
|
||||||
|
import com.raytheon.viz.ui.perspectives.AbstractWorkbenchPartContextActivator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Context activator for GFE perspective parts
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jun 21, 2012 mschenke Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GFEContextActivator extends AbstractWorkbenchPartContextActivator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param page
|
||||||
|
*/
|
||||||
|
GFEContextActivator(IWorkbenchPage page) {
|
||||||
|
super(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.perspectives.AbstractPerspectiveContextActivator#
|
||||||
|
* isPerspectivePart(org.eclipse.ui.IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected boolean isPerspectivePart(IWorkbenchPartReference partRef) {
|
||||||
|
if (GridManagerView.ID.equals(partRef.getId())) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
IWorkbenchPart part = partRef.getPart(false);
|
||||||
|
if (part instanceof IDisplayPaneContainer) {
|
||||||
|
IDisplayPaneContainer container = (IDisplayPaneContainer) part;
|
||||||
|
for (IDisplayPane pane : container.getDisplayPanes()) {
|
||||||
|
if (pane.getRenderableDisplay() instanceof GFEMapRenderableDisplay) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.gfe.perspective;
|
package com.raytheon.viz.gfe.perspective;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.commands.Command;
|
import org.eclipse.core.commands.Command;
|
||||||
|
@ -100,12 +99,15 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
/** The GFE Perspective Class */
|
/** The GFE Perspective Class */
|
||||||
public static final String GFE_PERSPECTIVE = "com.raytheon.viz.ui.GFEPerspective";
|
public static final String GFE_PERSPECTIVE = "com.raytheon.viz.ui.GFEPerspective";
|
||||||
|
|
||||||
|
private static boolean keybindingsCreated = false;
|
||||||
|
|
||||||
public GFEPerspectiveManager() {
|
public GFEPerspectiveManager() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
|
contextActivator = new GFEContextActivator(page);
|
||||||
loadDefaultBundle("gfe/default-procedure.xml");
|
loadDefaultBundle("gfe/default-procedure.xml");
|
||||||
|
|
||||||
AbstractEditor gfeEditor = (AbstractEditor) EditorUtil
|
AbstractEditor gfeEditor = (AbstractEditor) EditorUtil
|
||||||
|
@ -127,7 +129,10 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
mapMgr.loadMapByBundleName(map);
|
mapMgr.loadMapByBundleName(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
defineKeys();
|
if (!keybindingsCreated) {
|
||||||
|
registerKeyBindings();
|
||||||
|
keybindingsCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
DataManager dm = DataManager.getInstance(perspectiveWindow);
|
DataManager dm = DataManager.getInstance(perspectiveWindow);
|
||||||
IRenderableDisplay display = pane.getRenderableDisplay();
|
IRenderableDisplay display = pane.getRenderableDisplay();
|
||||||
|
@ -256,7 +261,7 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void defineKeys() {
|
private static void registerKeyBindings() {
|
||||||
ICommandService commandService = (ICommandService) PlatformUI
|
ICommandService commandService = (ICommandService) PlatformUI
|
||||||
.getWorkbench().getService(ICommandService.class);
|
.getWorkbench().getService(ICommandService.class);
|
||||||
|
|
||||||
|
@ -275,21 +280,9 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
PythonPreferenceStore prefs = Activator.getDefault()
|
PythonPreferenceStore prefs = Activator.getDefault()
|
||||||
.getPreferenceStore();
|
.getPreferenceStore();
|
||||||
try {
|
try {
|
||||||
Scheme scheme = bindingManager.getScheme(schemeId);
|
|
||||||
scheme.define(activeScheme.getName(),
|
|
||||||
activeScheme.getDescription(), activeScheme.getParentId());
|
|
||||||
|
|
||||||
// get currentBindings and remove any GFE ShortCut bindings
|
// get currentBindings and remove any GFE ShortCut bindings
|
||||||
String contextId = "com.raytheon.viz.gfe.GFEShortCutContext";
|
String contextId = "com.raytheon.viz.gfe.GFEShortCutContext";
|
||||||
Binding[] currentBindings = bindingService.getBindings();
|
bindingManager.setBindings(bindingService.getBindings());
|
||||||
List<Binding> newBindings = new ArrayList<Binding>();
|
|
||||||
for (Binding binding : currentBindings) {
|
|
||||||
if (!binding.getContextId().equals(contextId)) {
|
|
||||||
newBindings.add(binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bindingManager.setBindings(newBindings
|
|
||||||
.toArray(new Binding[newBindings.size()]));
|
|
||||||
|
|
||||||
for (int i = 1; i < 201; i++) {
|
for (int i = 1; i < 201; i++) {
|
||||||
String shortCut = "ShortCut" + i;
|
String shortCut = "ShortCut" + i;
|
||||||
|
@ -386,10 +379,10 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
|
||||||
// add the binding
|
// add the binding
|
||||||
bindingManager.addBinding(new KeyBinding(keySequence,
|
bindingManager.addBinding(new KeyBinding(keySequence,
|
||||||
parmCmd, schemeId, contextId, null, null, null,
|
parmCmd, schemeId, contextId, null, null, null,
|
||||||
Binding.USER));
|
Binding.SYSTEM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bindingService.savePreferences(bindingManager.getScheme(schemeId),
|
bindingService.savePreferences(activeScheme,
|
||||||
bindingManager.getBindings());
|
bindingManager.getBindings());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IViewReference;
|
import org.eclipse.ui.IViewReference;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.viz.core.ContextManager;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||||
|
@ -54,10 +55,60 @@ import com.raytheon.viz.ui.statusline.TimeDisplay;
|
||||||
public abstract class AbstractCAVEPerspectiveManager extends
|
public abstract class AbstractCAVEPerspectiveManager extends
|
||||||
AbstractVizPerspectiveManager {
|
AbstractVizPerspectiveManager {
|
||||||
|
|
||||||
|
/** Optional workbench part context activator for the perspective */
|
||||||
|
protected AbstractWorkbenchPartContextActivator contextActivator;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#
|
||||||
|
* activateContexts(com.raytheon.uf.viz.core.ContextManager)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void activateContexts(ContextManager manager) {
|
||||||
|
super.activateContexts(manager);
|
||||||
|
if (contextActivator != null) {
|
||||||
|
contextActivator.partActivated(page.getActivePartReference());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#deactivate
|
||||||
|
* ()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deactivate() {
|
||||||
|
super.deactivate();
|
||||||
|
if (contextActivator != null) {
|
||||||
|
page.removePartListener(contextActivator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#
|
||||||
|
* deactivateContexts(com.raytheon.uf.viz.core.ContextManager)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void deactivateContexts(ContextManager manager) {
|
||||||
|
super.deactivateContexts(manager);
|
||||||
|
if (contextActivator != null) {
|
||||||
|
contextActivator.partDeactivated(page.getActivePartReference());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void activateInternal() {
|
protected void activateInternal() {
|
||||||
super.activateInternal();
|
super.activateInternal();
|
||||||
|
|
||||||
|
if (contextActivator != null) {
|
||||||
|
page.addPartListener(contextActivator);
|
||||||
|
}
|
||||||
|
|
||||||
// repaint containers
|
// repaint containers
|
||||||
for (IEditorReference ref : page.getEditorReferences()) {
|
for (IEditorReference ref : page.getEditorReferences()) {
|
||||||
IEditorPart part = ref.getEditor(false);
|
IEditorPart part = ref.getEditor(false);
|
||||||
|
@ -91,18 +142,6 @@ public abstract class AbstractCAVEPerspectiveManager extends
|
||||||
return new IInputHandler[0];
|
return new IInputHandler[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager#open()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void open() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.ui.perspectives;
|
||||||
|
|
||||||
|
import org.eclipse.ui.IPartListener2;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchPartReference;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.ContextManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that activates contexts registered for the object with the
|
||||||
|
* com.raytheon.uf.viz.core.classContext extension point based on workbench
|
||||||
|
* parts
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jun 21, 2012 mschenke Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class AbstractWorkbenchPartContextActivator implements
|
||||||
|
IPartListener2 {
|
||||||
|
|
||||||
|
protected IWorkbenchPage page;
|
||||||
|
|
||||||
|
private ContextManager contextManager;
|
||||||
|
|
||||||
|
protected AbstractWorkbenchPartContextActivator(IWorkbenchPage page) {
|
||||||
|
this.page = page;
|
||||||
|
this.contextManager = ContextManager.getInstance(page
|
||||||
|
.getWorkbenchWindow());
|
||||||
|
register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register() {
|
||||||
|
page.addPartListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unregister() {
|
||||||
|
page.removePartListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean isPerspectivePart(IWorkbenchPartReference partRef);
|
||||||
|
|
||||||
|
private void deactivate(IWorkbenchPartReference partRef) {
|
||||||
|
if (isPerspectivePart(partRef)) {
|
||||||
|
contextManager.deactivateContexts(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void activate(IWorkbenchPartReference partRef) {
|
||||||
|
if (isPerspectivePart(partRef)) {
|
||||||
|
contextManager.activateContexts(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partActivated(IWorkbenchPartReference partRef) {
|
||||||
|
activate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partBroughtToTop(IWorkbenchPartReference partRef) {
|
||||||
|
activate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partClosed(IWorkbenchPartReference partRef) {
|
||||||
|
deactivate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partDeactivated(IWorkbenchPartReference partRef) {
|
||||||
|
deactivate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partOpened(IWorkbenchPartReference partRef) {
|
||||||
|
activate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partHidden(IWorkbenchPartReference partRef) {
|
||||||
|
deactivate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partVisible(IWorkbenchPartReference partRef) {
|
||||||
|
activate(partRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.
|
||||||
|
* IWorkbenchPartReference)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void partInputChanged(IWorkbenchPartReference partRef) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue