diff options
author | cdumoulin | 2012-04-26 13:57:57 +0000 |
---|---|---|
committer | cdumoulin | 2012-04-26 13:57:57 +0000 |
commit | 16bf4c4e485208c719cfab718370af218e082468 (patch) | |
tree | fffd9bca420ce79160605908bed1afa1b9097d2a /examples | |
parent | 4d3bd02725e4b65194df446b77f90ac5ff7976d9 (diff) | |
download | org.eclipse.papyrus-16bf4c4e485208c719cfab718370af218e082468.tar.gz org.eclipse.papyrus-16bf4c4e485208c719cfab718370af218e082468.tar.xz org.eclipse.papyrus-16bf4c4e485208c719cfab718370af218e082468.zip |
Change the way the current editor is found.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/core/org.eclipse.papyrus.example.core.sashwindows.fulleditor/src/org/eclipse/papyrus/example/core/sashwindows/fulleditor/texteditor/CreateTextEditorCommandHandler.java | 10 |
1 files changed, 7 insertions, 3 deletions
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;
|