From 16bf4c4e485208c719cfab718370af218e082468 Mon Sep 17 00:00:00 2001 From: cdumoulin Date: Thu, 26 Apr 2012 13:57:57 +0000 Subject: Change the way the current editor is found. --- .../fulleditor/texteditor/CreateTextEditorCommandHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples/core') diff --git a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/CreateTextEditorCommandHandler.java b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/CreateTextEditorCommandHandler.java index 262fc18751b..b308d2719ff 100644 --- a/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/CreateTextEditorCommandHandler.java +++ b/examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/CreateTextEditorCommandHandler.java @@ -24,6 +24,7 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; /** * Command to create a new TextEditor. @@ -41,7 +42,7 @@ public class CreateTextEditorCommandHandler extends AbstractHandler implements I // Create the Editor Model IEditorModel model = new TextEditorPartModel(); // Get the Sashwindow model - ISashWindowsContentProvider contentProvider = getSashWindowsContentProvider(); + ISashWindowsContentProvider contentProvider = getSashWindowsContentProvider(event); if(contentProvider == null) { showErrorDialog("Can't create Editor. Reason: Can't get current editor ContentProvider."); } @@ -77,11 +78,14 @@ public class CreateTextEditorCommandHandler extends AbstractHandler implements I /** * Get the shared object. + * @param event * * @return + * @throws ExecutionException */ - protected ISashWindowsContentProvider getSashWindowsContentProvider() { - IEditorPart editor = getMultiDiagramEditor(); + protected ISashWindowsContentProvider getSashWindowsContentProvider(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditorChecked(event); +// IEditorPart editor = getMultiDiagramEditor(); ISashWindowsContentProvider contentProvider = (ISashWindowsContentProvider)editor.getAdapter(ISashWindowsContentProvider.class); return contentProvider; -- cgit v1.2.3