Merge "Issue #1131 disable PanTool in Nsharp to avoid conflicting with nsharp mouse handlers." into development
Former-commit-id:e8acd359cc
[formerly6c9a544d99
[formerly ed562fb9d3dbe7d43884fdefb7bc6cd04afaf5f8]] Former-commit-id:6c9a544d99
Former-commit-id:b8001f13a7
This commit is contained in:
commit
5d27acefdd
2 changed files with 22 additions and 113 deletions
|
@ -39,7 +39,7 @@
|
|||
commandId="com.raytheon.viz.ui.actions.saveScreen">
|
||||
<activeWhen>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpEditor"/>
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
|
@ -48,10 +48,27 @@
|
|||
commandId="com.raytheon.viz.ui.actions.printScreenAction">
|
||||
<activeWhen>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpEditor"/>
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler
|
||||
class="com.raytheon.viz.ui.actions.NullAction"
|
||||
commandId="com.raytheon.viz.ui.tools.nav.PanTool">
|
||||
<!-- This will always disable the PanTool -->
|
||||
<activeWhen>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
<enabledWhen>
|
||||
<not>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||
</with>
|
||||
</not>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.d2d.nsharp.display;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -27,14 +26,11 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
|
||||
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
|
||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||
import com.raytheon.viz.ui.tools.AbstractModalTool;
|
||||
import com.raytheon.viz.ui.tools.ModalToolManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
* Extends NsharpPaletteWindow but overide load to prevent opening ncmapeditor.
|
||||
* Also disable unload since loading and unloading is being handled by time
|
||||
* matched resources.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -51,45 +47,6 @@ import com.raytheon.viz.ui.tools.ModalToolManager;
|
|||
*/
|
||||
public class D2DNSharpPaletteWindow extends NsharpPaletteWindow {
|
||||
|
||||
private static final String EDIT_TOOL_CATEGY = "com.raytheon.viz.ui.modalTool.nav";
|
||||
|
||||
private class EditTool extends AbstractModalTool {
|
||||
|
||||
public EditTool() {
|
||||
this.categoryId = EDIT_TOOL_CATEGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivateTool() {
|
||||
if (!graphEditBtn.isDisposed()) {
|
||||
editGraphOn = false;
|
||||
graphEditBtn.setText(EDIT_GRAPH_OFF);
|
||||
notifyRsc();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activateTool() {
|
||||
editGraphOn = true;
|
||||
graphEditBtn.setText(EDIT_GRAPH_ON);
|
||||
notifyRsc();
|
||||
}
|
||||
|
||||
private void notifyRsc() {
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if (rsc == null)
|
||||
return;
|
||||
|
||||
rsc.setEditGraphOn(editGraphOn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AbstractModalTool editTool = new EditTool();
|
||||
|
||||
private AbstractModalTool lastTool = null;
|
||||
|
||||
@Override
|
||||
public void createDataControlGp(Composite parent) {
|
||||
super.createDataControlGp(parent);
|
||||
|
@ -107,71 +64,6 @@ public class D2DNSharpPaletteWindow extends NsharpPaletteWindow {
|
|||
}
|
||||
});
|
||||
|
||||
for (Listener listener : graphEditBtn.getListeners(SWT.MouseUp)) {
|
||||
graphEditBtn.removeListener(SWT.MouseUp, listener);
|
||||
}
|
||||
graphEditBtn.addListener(SWT.MouseUp, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
if (editGraphOn) {
|
||||
disableEdit();
|
||||
} else {
|
||||
enableEdit();
|
||||
}
|
||||
}
|
||||
});
|
||||
NsharpResourceHandler rsc = getRscHandler();
|
||||
if (rsc != null && rsc.isEditGraphOn()) {
|
||||
enableEdit();
|
||||
} else {
|
||||
disableEdit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see gov.noaa.nws.ncep.ui.nsharp.palette.NsharpPaletteWindow#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
disableEdit();
|
||||
getSite().getPage().removePartListener(this);
|
||||
}
|
||||
|
||||
private void enableEdit() {
|
||||
AbstractVizPerspectiveManager perspMgr = VizPerspectiveListener
|
||||
.getCurrentPerspectiveManager();
|
||||
if (perspMgr == null) {
|
||||
return;
|
||||
}
|
||||
ModalToolManager mgr = perspMgr.getToolManager();
|
||||
lastTool = mgr.getSelectedModalTool(EDIT_TOOL_CATEGY);
|
||||
if (lastTool != editTool) {
|
||||
mgr.selectModalTool(editTool);
|
||||
editTool.activate();
|
||||
} else {
|
||||
lastTool = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void disableEdit() {
|
||||
AbstractVizPerspectiveManager perspMgr = VizPerspectiveListener
|
||||
.getCurrentPerspectiveManager();
|
||||
if (perspMgr == null) {
|
||||
return;
|
||||
}
|
||||
ModalToolManager mgr = perspMgr.getToolManager();
|
||||
if (mgr.getSelectedModalTool(EDIT_TOOL_CATEGY) == editTool) {
|
||||
mgr.deselectModalTool(editTool);
|
||||
if (lastTool != null) {
|
||||
mgr.selectModalTool(lastTool);
|
||||
lastTool.activate();
|
||||
lastTool = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue