Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » any method for getting a driagram?
any method for getting a driagram? [message #180930] Wed, 11 May 2005 15:37 Go to next message
Eclipse UserFriend
Originally posted by: i92deosj.uco.es

Hello everyone,

i am developing a gef-based application and i have created a diagram
using. Now i would like to get the entire diagram; is there any method to
do this? if so, how can i travel across the connections for getting each
of the figures contained in the diagram? Please, any idea.

Thank you very much.
Re: any method for getting a driagram? [message #181029 is a reply to message #180930] Wed, 11 May 2005 23:31 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
getFigure() from the root (or contents) editpart. The editor also provides
it from its getAdapter() method.

"Manuel" <i92deosj@uco.es> wrote in message
news:b0d6175c509735bcfa135581f16c7316$1@www.eclipse.org...
> Hello everyone,
>
> i am developing a gef-based application and i have created a diagram
> using. Now i would like to get the entire diagram; is there any method to
> do this? if so, how can i travel across the connections for getting each
> of the figures contained in the diagram? Please, any idea.
>
> Thank you very much.
>
Re: any method for getting a driagram? [message #181266 is a reply to message #181029] Fri, 13 May 2005 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: i92deosj.uco.es

Well, and when I get the diagram completely, how could I visit all the
figures (nodes) of the diagram, traveling across the connections between
the nodes?

Thank you very much
Re: any method for getting a driagram? [message #181305 is a reply to message #181266] Fri, 13 May 2005 17:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gslade.no.spam.us.ibm.com

ask the root for it children

Guy

Manuel wrote:
> Well, and when I get the diagram completely, how could I visit all the
> figures (nodes) of the diagram, traveling across the connections between
> the nodes?
>
> Thank you very much
>
Re: any method for getting a driagram? [message #181435 is a reply to message #181305] Mon, 16 May 2005 08:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

I have the following problem: when I get the root figure by calling the
getAdapter() method of the editor, I get null. The code I am using is the
following:



IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow
().getActivePage().getActiveEditor();
IEditorInput input = editor.getEditorInput();

IFigure rootFigure = (IFigure)input.getAdapter(IFigure.class);
if(rootFigure==null){
System.out.println("rootFigure is null");
System.exit(1);
}
//List listaHijos=rootFigure.getChildren();

System.out.println("The number of children is
"+rootFigure.getChildren().size());



Well, this code always goes into the conditional and the program ends with
the System.exit() method. Why do I get a null rootFigure?

Please help, I need to solve this as soon as possible.

Thank you very much.
Re: any method for getting a driagram? [message #181458 is a reply to message #181435] Mon, 16 May 2005 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gslade.no.spam.us.ibm.com

It's the editor you should be calling getAdapter on.

Stop and think about this for a second. The IEditorInput is normally
just a file, how in the world is it going to know anything about
editparts and figures????

and asking the editor for IFigure.class is not going to work either....
take a look at the editors implementation of getAdapter and it's easy to
see what you should be asking for.

Guy



Manuel wrote:
> I have the following problem: when I get the root figure by calling the
> getAdapter() method of the editor, I get null. The code I am using is
> the following:
>
>
>
> IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow
> ().getActivePage().getActiveEditor();
> IEditorInput input = editor.getEditorInput();
>
> IFigure rootFigure = (IFigure)input.getAdapter(IFigure.class);
> if(rootFigure==null){
> System.out.println("rootFigure is null");
> System.exit(1);
> }
> //List listaHijos=rootFigure.getChildren();
>
> System.out.println("The number of children is
> "+rootFigure.getChildren().size());
>
>
>
> Well, this code always goes into the conditional and the program ends
> with the System.exit() method. Why do I get a null rootFigure?
>
> Please help, I need to solve this as soon as possible.
>
> Thank you very much.
>
Re: any method for getting a driagram? [message #181480 is a reply to message #181458] Mon, 16 May 2005 16:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jdelgad.correo.ugr.es

Thank you Guy. I have taken a look to the implementation of the
getAdapter() method and I have noticed that the argument this method is
EditorPart.class. But now, I have another problem. In this way, the
connections between the figures aren't provided. How can I obtain them?

Thank you again.
Re: any method for getting a driagram? [message #181495 is a reply to message #181480] Mon, 16 May 2005 17:12 Go to previous message
Eclipse UserFriend
Originally posted by: gslade.no.spam.us.ibm.com

IAdaptable.getAdapter(Class class)

getAdapter can accept any Class argument. You editor is a GEF editor,
right? Look at your editors implementation of getAdadpter and the
implementation of this method all the way up the class hierarchy of your
editor. Look at the Class arguments that they are able to handle. You
should be able to see what you should be passing and what it gives you
back. Remember, you want the root edit part...right?

Guy

Manuel wrote:
> Thank you Guy. I have taken a look to the implementation of the
> getAdapter() method and I have noticed that the argument this method is
> EditorPart.class. But now, I have another problem. In this way, the
> connections between the figures aren't provided. How can I obtain them?
>
> Thank you again.
>
Previous Topic:size of a view
Next Topic:Shapes example - creating a shape
Goto Forum:
  


Current Time: Thu Mar 28 11:55:51 GMT 2024

Powered by FUDForum. Page generated in 0.48689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top