How can I put an IEditorPart in a modal dialog?
(I'm something of an Eclipse ne开发者_如何学编程wbie, so apologise for any dumbness on my part...)
I have a number of editors (derived from IEditorPart
) in my RCP app, and a requirement has arisen that one particular editor needs to be also available in a modal dialog box (along with some extra controls) opened by one of the other editor classes. The editor to be embedded consists of the main viewer control, toolbar, and a couple of dozen helper classes (label providers, comparators, etc).
The options before me appear to be:
Find a way to put an editor area,
IWorkbenchWindow
-style, into a (JFace or SWT)Dialog
.- Not had much luck searching for how to do this
Create a new
WorkBenchWindow
with a Perspective that just the editor area visible, and no views. Make this modal.- On trying this, the new window seemed to inherit things (menus etc) from its parent window.
Refactor the editor in question so all of it now resides on a single control, then embed this control in both the editor and the dialog.
- Potentially time-consuming, given the number of places the helper classes refer back to the main editor object.
If it turns out that this is a truly perverse and anti-idiomatic thing to want to do, in Eclipse terms, can you suggest a wiser course of action?
Thanks
EditorParts are meant to be inside workbenchwindows. There is a lot of code that depends on this behaviour. So I would suggest not to do (1). If the result is acceptable (a workbench window, which is modal), the easier way is to hang on to (2).
精彩评论