any method for getting a driagram? [message #180930] |
Wed, 11 May 2005 15:37 |
Eclipse User |
|
|
|
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 #181305 is a reply to message #181266] |
Fri, 13 May 2005 17:24 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.48689 seconds