How to get the RootEditPart from Editor [message #218115] |
Mon, 19 June 2006 16:51  |
Eclipse User |
|
|
|
Originally posted by: mliu.technicacorp.com
I am a newbie so please bear with me.
I created an Eclipse Plugin that has a graphical editor using Draw2D
figures. I would like to add a button on the toolbar which, once clicked,
will perform some actions in the editor's view.
For example, I have some graphical objects on the editor view and I would
like to redo the layout for these graphical objects when a button on the
toolbar is clicked.
So for this, I created a class something like this:
public class RedoLayout implements IEditorActoinDelegate {
private IEditorPart targetPart;
public void run(IAction arg0)
{
targetPart =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActiveEditor();
MyGraphicalEditor editor = (MyGraphicalEditor)targetPart;
}
}
I can get a handle to the editor which by casting the targetPart in the code
above.
But now in order for me to redraw the layout, I need to be able to access
the RootEditPart of what's on the editor view. From the editor instance, how
do I get a hold of the RootEditPart of the GraphicalViewer so that I can
manuplate the properties of the graphical objects in the editor view?
Thanks for any help.
|
|
|
|
|
Re: How to get the RootEditPart from Editor [message #218327 is a reply to message #218228] |
Thu, 22 June 2006 13:02  |
Eclipse User |
|
|
|
This is a multipart message in MIME format.
--=_alternative 005DDB1085257195_=
Content-Type: text/plain; charset="US-ASCII"
if you can not use the getGraphicalViewer method because of the
visibility, try using getAdapter(GraphicalViewer.class)
--=_alternative 005DDB1085257195_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2 face="sans-serif">if you can not use the getGraphicalViewer
method because of the visibility, try using </font><font size=2 face="Courier New">getAdapter(GraphicalViewer.</font><font size=2 color=#820040 face="Courier New"><b>class</b></font><font size=2 face="Courier New">)</font>
--=_alternative 005DDB1085257195_=--
|
|
|
Powered by
FUDForum. Page generated in 0.04215 seconds