Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to create a new
How to create a new [message #235629] Wed, 13 June 2007 16:46 Go to next message
Eclipse UserFriend
Originally posted by: neliacatarina.portugalmail.pt

Hello,

I have this code to get the graphs that compose a diagram:

IEditorPart input = window.getActivePage().getActiveEditor();
FlowEditor editor = (FlowEditor)input;
RootEditPart rootEdit = editor.getRootEditPart();
EditPart contents = rootEdit.getContents();
List children = contents.getChildren();

From this "children" list, I create a xml file to save it's elements.
Now I want to open this file in the application and daw that diagram. I save the values of the xml file in a list but I don't know how to draw it's elements. Can anyone help me?
Thanks
Re: How to create a new diagram [message #235882 is a reply to message #235629] Mon, 18 June 2007 14:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: apexgroup07.gmail.com

Hello,

You should store model class of your diagram into XML file. and while reading you have to create the model object again and set into the editor.

Reading operaion can be done protected void setInput(IEditorInput input) method of the editor. Or can be done before opening an edior.
Re: How to create a new diagram [message #235903 is a reply to message #235882] Mon, 18 June 2007 16:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: neliacatarina.portugalmail.pt

I have this code to set figures in the editor.
actD is an instance of the class that extends EditPart and have all the children that were saved in XML file.


IEditorPart input = window.getActivePage().getActiveEditor();
FlowEditor editor = (FlowEditor)input;
RootEditPart root = editor.getRootEditPart();

EditPart x = root.getContents();

Activity a = actD.getActivity();
ActivityDiagram ad = new ActivityDiagram();
ad.setName(a.getName());
ad.setRole(a.getRole());
x.setModel(ad);
root.setContents(x);

editor.setRootEditPart(root);


With this code I only get the ActivityDiagram ok, with it's correct properties but with no figures in it. I think I have to do something that really draws the figures but I don't know what it is...
Re: How to create a new diagram [message #235951 is a reply to message #235903] Tue, 19 June 2007 08:25 Go to previous message
Eclipse UserFriend
Originally posted by: jakub.jurkiewicz.gmail.com

Hi Nelia,

I guess that if you have edit parts for the element you want to draw,
then the figures for these elements should be drawn by the GEF internal
mechanism.

--
Jakub Jurkiewicz
http://eclipser-blog.blogspot.com/

Nelia Santos wrote:
> I have this code to set figures in the editor.
> actD is an instance of the class that extends EditPart and have all the children that were saved in XML file.
>
>
> IEditorPart input = window.getActivePage().getActiveEditor();
> FlowEditor editor = (FlowEditor)input;
> RootEditPart root = editor.getRootEditPart();
>
> EditPart x = root.getContents();
>
> Activity a = actD.getActivity();
> ActivityDiagram ad = new ActivityDiagram();
> ad.setName(a.getName());
> ad.setRole(a.getRole());
> x.setModel(ad);
> root.setContents(x);
>
> editor.setRootEditPart(root);
>
>
> With this code I only get the ActivityDiagram ok, with it's correct properties but with no figures in it. I think I have to do something that really draws the figures but I don't know what it is...
Previous Topic:change Icon in Label
Next Topic:How can I configure an Plugin.xml file
Goto Forum:
  


Current Time: Fri Apr 19 23:24:26 GMT 2024

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

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

Back to the top