问题
I have a requirement where I need to open my editor in a dialog.
The things I have are
My Editor Plugin
A button listener in a different plugin where I need to open this editor in a dialog
I tried one way , below is code inside that button listener
//this opens up a new workbench window
PlatformUI.getWorkbench().openWorkbenchWindow("<provide perspective id here>", null);
//this gets active window, which is the above one and opens our editor
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(myEditorInput, "editor.plugin.id");
But using above I have to hide a thousands of things from that newly opened window like Menu Bar, Other Views.
My question is can anyone help me opening the editor in a newly created dialog which comes without those menu bars and views.
Thanks in advance !
回答1:
Eclipse does not support opening editors in a dialog. Editors rely on too many things in the Eclipse framework which are not available in a dialog.
You can use the JFace SourceViewer
or TextViewer
classes which form the core of many text editor in a dialog.
来源:https://stackoverflow.com/questions/38603527/open-up-eclipse-editor-in-a-dialog