Issue #1131 disable PanTool in Nsharp to avoid conflicting with nsharp mouse handlers.
Former-commit-id:c4e1d834c1
[formerlyc4e1d834c1
[formerly efe7d92966e8d53a1f071f62c5b73576d9c6793a]] Former-commit-id:50969cb7e2
Former-commit-id:9e0c697daf
This commit is contained in:
parent
4372a4e0d6
commit
c34e649e65
2 changed files with 22 additions and 113 deletions
|
@ -39,7 +39,7 @@
|
||||||
commandId="com.raytheon.viz.ui.actions.saveScreen">
|
commandId="com.raytheon.viz.ui.actions.saveScreen">
|
||||||
<activeWhen>
|
<activeWhen>
|
||||||
<with variable="activeEditorId">
|
<with variable="activeEditorId">
|
||||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpEditor"/>
|
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||||
</with>
|
</with>
|
||||||
</activeWhen>
|
</activeWhen>
|
||||||
</handler>
|
</handler>
|
||||||
|
@ -48,10 +48,27 @@
|
||||||
commandId="com.raytheon.viz.ui.actions.printScreenAction">
|
commandId="com.raytheon.viz.ui.actions.printScreenAction">
|
||||||
<activeWhen>
|
<activeWhen>
|
||||||
<with variable="activeEditorId">
|
<with variable="activeEditorId">
|
||||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpEditor"/>
|
<equals value="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"/>
|
||||||
</with>
|
</with>
|
||||||
</activeWhen>
|
</activeWhen>
|
||||||
</handler>
|
</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>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.d2d.nsharp.display;
|
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 gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
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.Event;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
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>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -51,45 +47,6 @@ import com.raytheon.viz.ui.tools.ModalToolManager;
|
||||||
*/
|
*/
|
||||||
public class D2DNSharpPaletteWindow extends NsharpPaletteWindow {
|
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
|
@Override
|
||||||
public void createDataControlGp(Composite parent) {
|
public void createDataControlGp(Composite parent) {
|
||||||
super.createDataControlGp(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