Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Input to GEF Editor - PLEASE HELP
Input to GEF Editor - PLEASE HELP [message #245771] Tue, 14 October 2008 11:08 Go to next message
Dushyanth is currently offline DushyanthFriend
Messages: 13
Registered: July 2009
Junior Member
Hi Friends

I am a newbie to GEF, RCP and Java. PLEASE HELP me.

In brief:

I am trying to create a model instatcne and simply display this in GEF
programmatically. But I am not sure of how I can provide a model instance
to GEF as input.


In detail:

I am trying to develop an RCP application that parses data from an Input
file and display this as graphical representation. To do this I choose GEF
and developed:

• A Java class to parse Business data from an input file (ParseInput.java).
• A model that represents Business and Visual data (Model, Figures, Parts).
• A GEF editor (GEFEditor.java). My editor is simply meant to display the
models Visual data (Rectangles) - No options(palette) are provided for
users to create new rectangles through the editor. However the RCP should
display "Properties" view to enable users to alter Business data
associated with a Rectangle - which eventually alters the model.

I have created a context menu action on Input file which calls
“ParseInput.java” which inturn: Extracts business data; Creates a new
Model instance (updated with Business and Visual data); Then opens a new
GEF editor page to display the updated Model.

• However I am not sure how I can provide a Model object(Updated) as input
to GEF editor. As far as I understand, for normal editors we use
“page.openEditor” and “init(IEditorSite, IEditorInput)” methods to provide
input. But how we do it in GEF?
• If that is not the case or not possible, the alternative that I am
thinking is to open the GEF editor first and then display the model by
calling GEF "Commands and requests" programatically??
• Or am I completely wrong?

In future I also wanted to store the Model if users make any changes to
the Models business data.

Can you please advise me what is the best soltion here in this situataion?

It will be easy for me to understand - if you could please provide me any
examples or tutorials.

Thanks very much for your time and help

Cheers

Dushi
Re: Input to GEF Editor - PLEASE HELP [message #245801 is a reply to message #245771] Wed, 15 October 2008 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ashar.kpitcummins.com

Hi Dushi,

If I am not wrong in understanding your requirement, all you have to do is,

In the initializeGraphicalViewer() method of your graphical editor,

1. Set the editpart factory for your model elements (make sure you create
an editpart factory for your model elements before coming here, which
returns an editpart for each instance of your model element, probably what
you are calling as rectangle here, that represents some component of your
model)
2. Read from your input file, create the model instance and hierarchy,
along with positioning details.
3. Set this model instance as the content of the graphical editor by
calling setContents() method on your graphical viewer

Hope this solves your problem.

Asha R.
Re: Input to GEF Editor - PLEASE HELP [message #245806 is a reply to message #245771] Wed, 15 October 2008 05:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: shady_86.sify.com

<i>I am a newbie to GEF, RCP and Java</i>

well you will have to make your java strong before trying RCP and GEF


<i>I am trying to develop an RCP application that parses data from an Input file and display this as graphical representation. To do this I choose GEF </i>

GEF have a model where every figure have a controller and a model.
you just have to populate the model with your input data before the root edit part is set
Re: Input to GEF Editor - PLEASE HELP [message #246002 is a reply to message #245806] Thu, 30 October 2008 12:43 Go to previous message
Dushyanth is currently offline DushyanthFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks Asha and sharad for your advice

What i have done is stored my model object as serialized java object in a
file, then opened using GEF editor. That solved my problem.

I understand that it is also possible to store my model in XML format.

Can anyone of you, please point to some example or reading on web?

Cheers

Dushyanth
Previous Topic:CreationTool not firing after change of Perspective
Next Topic:how I can customize my Outline View?
Goto Forum:
  


Current Time: Fri Mar 29 11:43:32 GMT 2024

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

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

Back to the top