Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » AddFeature in Palette(How to support AddFeature in Palette?)
AddFeature in Palette [message #851968] Sat, 21 April 2012 14:20 Go to next message
Harshad RJ is currently offline Harshad RJFriend
Messages: 5
Registered: April 2012
Junior Member
Hi,

I am new to Graphiti and the entire Eclipse Plugin development system. Over the last week I have managed to follow tutorials and create a simple Graphiti Editor using non EMF domain model.

I have lots of questions in my mind, one of them being:

Is there a way to create a palette entry that only adds pictogram elements for existing model objects?

My use-case is that model objects will be created programmatically; the user should not be allowed to create them. The user can however add them to the diagram and change some attributes.

In the GFPaletteRoot class, I found that the PaletteEntries are added only if they are an instance of ICreationToolEntry, IStackToolEntry or IPaletteSeparatorEntry. So my hunch is that adding existing objects is not supported currently.

Assuming that is true:

* Can I (mis) use a create feature to return existing model objects (without actually creating a new object)?
* Is there a better approach to what I am trying to do?

thanks,
Harshad
Re: AddFeature in Palette [message #853617 is a reply to message #851968] Mon, 23 April 2012 07:17 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias GorningFriend
Messages: 81
Registered: April 2010
Location: Germany
Member
Hi Harshad,

you can/should use the create feature for your purpose. It is a valid approach to return an existing model object.

We also have an example (sketch) where we have create features which create only the graphical representation (pictogram model) and they simply return the main pictogram element.

BR,
Matthias

Re: AddFeature in Palette [message #854167 is a reply to message #853617] Mon, 23 April 2012 18:26 Go to previous messageGo to next message
Harshad RJ is currently offline Harshad RJFriend
Messages: 5
Registered: April 2012
Junior Member
Thanks Matthias, I was able to use a create feature with existing model objects.

Another question:
Does Graphiti have a way to add size and position constraints to containers and their children? I searched for "graphiti layout" but that returns results for layouting the whole graph. What I am interested in is something like HTML+CSS kind of layouting. For example, if a container has ten children, with different widths, the container should automatically get the width equal to the maximum width of its children.

It seems to me that GEF and Draw2D support such layouting, but I am not familiar with them to know for sure.

Regardless, does Graphiti support something like this? Or we have to manually code it?

cheers,
Harshad
Re: AddFeature in Palette [message #854202 is a reply to message #854167] Mon, 23 April 2012 19:17 Go to previous messageGo to next message
Harshad RJ is currently offline Harshad RJFriend
Messages: 5
Registered: April 2012
Junior Member
Answering my own question:

Further searching revealed this feature request:
Bug #352097 : Better support for layout - provide standard layouts (Can't post links since I am new to forum)

So looks like it isn't supported right now.
Re: AddFeature in Palette [message #854722 is a reply to message #854202] Tue, 24 April 2012 07:33 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Right, currently you will have to implement it yourself. It would be great
if you could post your findings/issues/needs on this in that bug.

Thanks,
Michael
Re: AddFeature in Palette [message #857072 is a reply to message #854722] Thu, 26 April 2012 08:12 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
I have a similar use case:
I would like to drop an existing Business Object (e.g., from a jface viewer using DND) onto the graphiti editor.

Graphiti should be able to handle objects not created by the tool palette, but instead call the AddFeature to create the pictogram element...
Does that sound reasonable/doable?
Re: AddFeature in Palette [message #857348 is a reply to message #857072] Thu, 26 April 2012 13:19 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
That's possible today. See the tutorial: you can add EClasses created in
other diagrams from the project explorer to a diagram simply by drag&drop.
In that case the AddFeature is called.

Michael
Re: AddFeature in Palette [message #1060533 is a reply to message #851968] Sun, 26 May 2013 10:53 Go to previous messageGo to next message
A R is currently offline A RFriend
Messages: 5
Registered: April 2013
Junior Member
I implemented a Feature like this, by using the tutorial Code, and call an existing AddFeature.

But eclipse always throws an "IllegalStateException: Cannot modify resource set without write transaction" at the link(shape,addedClass) command.

Any ideas why?
Re: AddFeature in Palette [message #1060692 is a reply to message #1060533] Mon, 27 May 2013 21:20 Go to previous messageGo to next message
A R is currently offline A RFriend
Messages: 5
Registered: April 2013
Junior Member
OK i found the problem. I used the wring transactionalEditingDomain.
But now only stuff like this is added to the diagram file:
<pictogramLinks href="#//@link"/>
<pictogramLinks href="#//@children.0/@children.1/@link"/>
<pictogramLinks href="#//@children.0/@children.2/@link"/>

There is no graphical representation?
Re: AddFeature in Palette [message #1060770 is a reply to message #1060692] Tue, 28 May 2013 11:51 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Maybe you don't add the stuff to the resource?

Michael
Previous Topic:Graphiti and EMF Properties View
Next Topic:The accelerator does not work
Goto Forum:
  


Current Time: Fri Mar 29 00:17:19 GMT 2024

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

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

Back to the top