How to get the RootEditPart from Editor [message #218115] |
Mon, 19 June 2006 20: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 #218228 is a reply to message #218199] |
Tue, 20 June 2006 18:49 |
Eclipse User |
|
|
|
Originally posted by: mliu.technicacorp.com
This is a multi-part message in MIME format.
------=_NextPart_000_003B_01C69478.BA8088D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
getGraphicalViewer() is a protected method and can only be called from a =
subclass. However in my case, I have the implementation of a =
IEditorActionDelegate class.
<mmostafa@ca.ibm.com> wrote in message =
news:e79cc1$vsj$1@utils.eclipse.org...
You can call getGraphicalViewer().getRootEditPart() on your Graphical =
Editor
------=_NextPart_000_003B_01C69478.BA8088D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>getGraphicalViewer() is a protected =
method and can=20
only be called from a subclass. However in my case, I have the =
implementation of=20
a IEditorActionDelegate class.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><<A =
href=3D"mailto:mmostafa@ca.ibm.com">mmostafa@ca.ibm.com</A>>=20
wrote in message <A=20
=
href=3D"news:e79cc1$vsj$1@utils.eclipse.org">news:e79cc1$vsj$1@utils.ecli=
pse.org</A>...</DIV><BR><FONT=20
face=3Dsans-serif size=3D2>You can call </FONT><FONT face=3D"Courier =
New"=20
size=3D2>getGraphicalViewer().getRootEditPart()</FONT><FONT =
face=3Dsans-serif=20
size=3D2> on your Graphical Editor</FONT></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_003B_01C69478.BA8088D0--
|
|
|
|
Powered by
FUDForum. Page generated in 0.02775 seconds