Closed GavriYashar closed 7 years ago
EditorWrapper
import com.mathworks.mde.liveeditor.LiveEditor; import com.mathworks.mde.liveeditor.LiveEditorApplication; import com.mathworks.mde.liveeditor.LiveEditorClient; ... /** returns true if current editor is an LiveEditor */ public static boolean isActiveEditorLive() { LiveEditorClient liveEditorClient = LiveEditorApplication.getLastActiveLiveEditorClient(); return liveEditorClient != null; } /** returns active LiveEditor. Check first if current editor is an LiveEditor with EditorWrapper.isActiveEditorLive() */ public static LiveEditor getActiveLiveEditor() { return LiveEditorApplication.getLastActiveLiveEditorClient().getLiveEditor(); } ... public static InputMap getInputMap() { if (EditorWrapper.isActiveEditorLive()) { return LiveEditorApplication.getLastActiveLiveEditorClient().getInputMap(); } return EditorWrapper.getInputMap(gae()); } ... public static File getFile() { if (EditorWrapper.isActiveEditorLive()) { return new File(EditorWrapper.getActiveLiveEditor().getLongName()); } return EditorWrapper.getFile(gae()); } ... public static String getShortName() { if (EditorWrapper.isActiveEditorLive()) { return EditorWrapper.getActiveLiveEditor().getShortName(); } return EditorWrapper.getShortName(gae()); } ... public static String getLongName() { if (EditorWrapper.isActiveEditorLive()) { return EditorWrapper.getActiveLiveEditor().getLongName(); } return EditorWrapper.getLongName(gae()); }
EditorWrapper