Issue #26 fix classes using HandlerUtil.getActiveEditor() for tear off menus
Former-commit-id:f4c5d7f94b
[formerly c12bae0a615198f6d409cf5e6d79a6a32e57494d] Former-commit-id:28e3da498e
This commit is contained in:
parent
88689efbfa
commit
ef18b8c47f
9 changed files with 34 additions and 22 deletions
|
@ -26,12 +26,12 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource;
|
||||
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource.LegendMode;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -68,8 +68,9 @@ public class ChangeLegendModeHandler extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IEditorPart part = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (part != null) {
|
||||
IDisplayPane[] panes = ((IDisplayPaneContainer) part)
|
||||
.getDisplayPanes();
|
||||
for (IDisplayPane pane : panes) {
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.eclipse.ui.handlers.HandlerUtil;
|
|||
import org.eclipse.ui.handlers.RadioState;
|
||||
|
||||
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -52,6 +54,9 @@ public class FontAction extends AbstractHandler {
|
|||
|
||||
String newVal = event.getParameter(RadioState.PARAMETER_ID);
|
||||
HandlerUtil.updateRadioState(event.getCommand(), newVal);
|
||||
if (EditorUtil.getActiveEditor() != null) {
|
||||
((AbstractEditor) EditorUtil.getActiveEditor()).refresh();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPEPolygonResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.input.EditableManager;
|
||||
|
||||
/**
|
||||
|
@ -51,8 +51,9 @@ public class DrawPolygonAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
||||
if (activeEditor instanceof IDisplayPaneContainer) {
|
||||
IEditorPart activeEditor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (activeEditor != null) {
|
||||
IDisplayPane first = ((IDisplayPaneContainer) activeEditor)
|
||||
.getDisplayPanes()[0];
|
||||
List<MPEPolygonResource> rscs = first.getDescriptor()
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
|
|||
import org.eclipse.ui.handlers.RadioState;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* Sets the font size on the display managers for an editor. Updates radio state
|
||||
|
@ -55,8 +56,9 @@ public class FontAction extends AbstractHandler {
|
|||
String newVal = event.getParameter(RadioState.PARAMETER_ID);
|
||||
HandlerUtil.updateRadioState(event.getCommand(), newVal);
|
||||
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IEditorPart part = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (part != null) {
|
||||
((IDisplayPaneContainer) part).refresh();
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -23,13 +23,13 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.DisplayFieldData;
|
||||
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
|
||||
import com.raytheon.viz.mpe.ui.rsc.XmrgResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
|
||||
|
||||
/**
|
||||
|
@ -61,8 +61,9 @@ public class SetDisplayField extends AbstractHandler {
|
|||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
String f = event.getParameter("Field");
|
||||
|
||||
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||
if (editor instanceof IDisplayPaneContainer) {
|
||||
IEditorPart editor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (editor != null) {
|
||||
return setDisplayField((IDisplayPaneContainer) editor, f);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.core.commands.ExecutionEvent;
|
|||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.commands.IElementUpdater;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.menus.UIElement;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
|
@ -56,8 +55,9 @@ public class ShowAddPseudoGage extends AbstractHandler implements
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
||||
if (activeEditor instanceof IDisplayPaneContainer) {
|
||||
IEditorPart activeEditor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (activeEditor != null) {
|
||||
IDisplayPane first = ((IDisplayPaneContainer) activeEditor)
|
||||
.getDisplayPanes()[0];
|
||||
List<AddPseudoGageResource> rscs = first.getDescriptor()
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.core.commands.ExecutionEvent;
|
|||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.commands.IElementUpdater;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
import org.eclipse.ui.menus.UIElement;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
|
@ -55,8 +54,9 @@ public class ShowDisplay7x7 extends AbstractHandler implements IElementUpdater {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
|
||||
if (activeEditor instanceof IDisplayPaneContainer) {
|
||||
IEditorPart activeEditor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (activeEditor != null) {
|
||||
IDisplayPane first = ((IDisplayPaneContainer) activeEditor)
|
||||
.getDisplayPanes()[0];
|
||||
List<MPEGageResource> rscs = first.getDescriptor()
|
||||
|
|
|
@ -25,11 +25,11 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.viz.mpe.ui.rsc.MPELegendResource;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -58,8 +58,9 @@ public class ToggleMpeInfo extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IEditorPart part = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (part != null) {
|
||||
IDisplayPane activePane = ((IDisplayPaneContainer) part)
|
||||
.getActiveDisplayPane();
|
||||
List<MPELegendResource> rscs = activePane.getDescriptor()
|
||||
|
|
|
@ -95,8 +95,9 @@ public abstract class AbstractTool extends AbstractHandler implements
|
|||
}
|
||||
}
|
||||
|
||||
IEditorPart eventEditor = HandlerUtil.getActiveEditor(event);
|
||||
if (eventEditor != null && eventEditor instanceof IDisplayPaneContainer) {
|
||||
IEditorPart eventEditor = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (eventEditor != null) {
|
||||
this.editor = (IDisplayPaneContainer) eventEditor;
|
||||
} else {
|
||||
IWorkbenchWindow window = HandlerUtil
|
||||
|
|
Loading…
Add table
Reference in a new issue