Issue #1018 disable many toolbar and menu items when the current editor is not a display pane container

Former-commit-id: 7ae4af9778cfa58fc755041479aadec5e6ad90b0
This commit is contained in:
Ben Steffensmeier 2012-08-14 10:25:38 -05:00
parent 559efb19fb
commit 0857d971b5
9 changed files with 85 additions and 9 deletions

View file

@ -1400,6 +1400,11 @@
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.TimeOptionsAction"
commandId="com.raytheon.uf.viz.d2d.ui.actions.timeOptionsAction">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.LocateCursorAction"
@ -1485,6 +1490,11 @@
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.CopyOutAWIPSProcedure"
commandId="com.raytheon.viz.ui.copyOutAWIPSProcedure">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.SetPerspectiveHandler"
@ -1497,6 +1507,11 @@
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.ShowPrintDialog"
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.IncreaseBlendAmount"
@ -1509,6 +1524,11 @@
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.ToggleTool"
commandId="com.raytheon.uf.viz.d2d.ui.actions.toggleTool">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
</extension>
<extension

View file

@ -68,6 +68,9 @@ public class TimeOptionsAction extends AbstractTool {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
super.execute(event);
if (this.editor == null) {
return null;
}
IRenderableDisplay iDisplay = this.editor.getActiveDisplayPane()
.getRenderableDisplay();
D2DTimeMatcher matcher = ((D2DTimeMatcher) iDisplay.getDescriptor()

View file

@ -208,6 +208,11 @@
<handler
class="com.raytheon.viz.ui.actions.ImagePropertiesAction"
commandId="com.raytheon.viz.ui.imageProperties">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.personalities.awips.ClosePerspectiveHandler"

View file

@ -70,22 +70,47 @@
<handler
class="com.raytheon.viz.ui.tools.looping.CombinedFrameTool"
commandId="com.raytheon.viz.ui.tools.looping.frameTool">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.tools.looping.LoopTool"
commandId="com.raytheon.viz.ui.tools.looping.loop">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.tools.looping.LoopPropertiesTool"
commandId="com.raytheon.viz.ui.tools.looping.loopProperties">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.tools.looping.FasterLoopSpeedTool"
commandId="com.raytheon.viz.ui.tools.looping.fasterLoop">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.tools.looping.SlowerLoopSpeedTool"
commandId="com.raytheon.viz.ui.tools.looping.slowerLoop">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
</extension>

View file

@ -50,7 +50,9 @@ public class FasterLoopSpeedTool extends AbstractTool {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
super.execute(arg0);
PageUpDownKey.handlePageUp(editor);
if (editor != null) {
PageUpDownKey.handlePageUp(editor);
}
return null;
}
}

View file

@ -58,9 +58,9 @@ public class LoopPropertiesTool extends AbstractTool {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
LoopPropertiesDialog.openDialog(shell, this.editor);
if (editor != null) {
LoopPropertiesDialog.openDialog(shell, this.editor);
}
return null;
}

View file

@ -50,7 +50,9 @@ public class SlowerLoopSpeedTool extends AbstractTool {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
super.execute(arg0);
PageUpDownKey.handlePageDown(editor);
if (editor != null) {
PageUpDownKey.handlePageDown(editor);
}
return null;
}

View file

@ -451,10 +451,20 @@
<handler
class="com.raytheon.viz.ui.actions.SaveBundle"
commandId="com.raytheon.viz.ui.saveBundle">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.actions.SaveProcedure"
commandId="com.raytheon.viz.ui.saveProcedure">
<activeWhen>
<with variable="activeEditor">
<instanceof value="com.raytheon.uf.viz.core.IDisplayPaneContainer"/>
</with>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.ui.actions.LoadSerializedXml"

View file

@ -242,11 +242,20 @@ public class LoadSerializedXml extends AbstractHandler {
final boolean multiEditor = container instanceof IMultiPaneEditor;
if (multiEditor) {
while (container.getDisplayPanes().length > b.getDisplays().length) {
((IMultiPaneEditor) container)
.removePane(container.getDisplayPanes()[container
.getDisplayPanes().length - 1]);
if (container.getDisplayPanes().length > b.getDisplays().length) {
VizApp.runSync(new Runnable() {
@Override
public void run() {
while (container.getDisplayPanes().length > b
.getDisplays().length) {
((IMultiPaneEditor) container).removePane(container
.getDisplayPanes()[container
.getDisplayPanes().length - 1]);
}
}
});
}
}
List<AbstractRenderableDisplay> orderedDisplays = Arrays.asList(b
.getDisplays());