Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Property sheet integration when domain objects not emf based
Property sheet integration when domain objects not emf based [message #631237] Wed, 06 October 2010 16:23 Go to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
In the Tutorial example, tabbed property sheet is displayed when an EClass is selected in the diagram. Both the property section class and the filter class use the following code to retrieve the business object:

Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogra mElement(pe);

However, the link service does not seem to work for non-emf based domain objects.

Feature provider seems to handle the mapping between pictogram objects and domain objects better through the use of independent solver. It's not very hard to get the feature provider in the property section class since it has access to the diagram type provider. However, I don't see a good way to access the feature provider in the filter class.

Any suggestions?

Shenxue
Re: Property sheet integration when domain objects not emf based [message #631605 is a reply to message #631237] Fri, 08 October 2010 07:53 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1914
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Actually quite a long chain to follow: ;-)
- in the accept (PictogramElement) method of your filter class (direved from
Graphiti's AbstractPropertySectionFilter) you get the selected
PictogramElement
- Go up the containment hierarchy (eConatiner()) until you reach the diagram
- Get the diagram id
- Use the diagram id to get the DiagramTypeProvider class
(GraphitiUI.getExtensionManager().getDiagramTypeProvider)
- Get the feature provider

Hope that helps.

Michael



"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i8i7l0$51b$1@news.eclipse.org...
> In the Tutorial example, tabbed property sheet is displayed when an EClass
> is selected in the diagram. Both the property section class and the filter
> class use the following code to retrieve the business object:
>
> Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogra
> mElement(pe);
>
> However, the link service does not seem to work for non-emf based domain
> objects.
> Feature provider seems to handle the mapping between pictogram objects and
> domain objects better through the use of independent solver. It's not very
> hard to get the feature provider in the property section class since it
> has access to the diagram type provider. However, I don't see a good way
> to access the feature provider in the filter class.
>
> Any suggestions?
>
> Shenxue
Re: Property sheet integration when domain objects not emf based [message #631829 is a reply to message #631605] Fri, 08 October 2010 23:34 Go to previous messageGo to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Michael Wenz wrote on Fri, 08 October 2010 01:53
Actually quite a long chain to follow: Wink
- in the accept (PictogramElement) method of your filter class (direved from
Graphiti's AbstractPropertySectionFilter) you get the selected
PictogramElement
- Go up the containment hierarchy (eConatiner()) until you reach the diagram
- Get the diagram id
- Use the diagram id to get the DiagramTypeProvider class
(GraphitiUI.getExtensionManager().getDiagramTypeProvider)
- Get the feature provider

Hope that helps.

Michael




Michael,

Thanks for your suggestion. I'll give it a try.

Shenxue
Re: Property sheet integration when domain objects not emf based [message #632355 is a reply to message #631829] Tue, 12 October 2010 16:20 Go to previous messageGo to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Michael,

I just tried:

String diagramTypeId = diagram.getDiagramTypeId();
String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(di agramTypeId);

Given the diagram provider id, I could not find a way to get the diagram type provider.

The ExtensionManager does not seem to have getDiagramTypeProvider(String diagramTypeId ) api. The createDiagramTypeProvider(Diagram diagram, String providerId) would create a new diagram type provider. It's not what I wanted.

Could ExtensionManager class be enhanced to keep a cache of created diagram type providers and provide api to access them given the diagram type id?

Thanks!
Re: Property sheet integration when domain objects not emf based [message #632563 is a reply to message #632355] Wed, 13 October 2010 13:04 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1914
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Your're right, the method you would need for that is private. :-(

In fact it would be useful to have this functionlality public. As a
workaround you might use the public method getDiagramTypes and search the
rigt one in the returned array yourself.

Yet another way: If you have access to the editor (DiagramEditor) you might
also get the DiagramTypeProvider class from there.

Michael


"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i921lt$rkf$1@news.eclipse.org...
> Michael,
>
> I just tried:
>
> String diagramTypeId = diagram.getDiagramTypeId();
> String providerId =
> GraphitiUi.getExtensionManager().getDiagramTypeProviderId(di agramTypeId);
>
> Given the diagram provider id, I could not find a way to get the diagram
> type provider.
> The ExtensionManager does not seem to have getDiagramTypeProvider(String
> diagramTypeId ) api. The createDiagramTypeProvider(Diagram diagram, String
> providerId) would create a new diagram type provider. It's not what I
> wanted.
>
> Could ExtensionManager class be enhanced to keep a cache of created
> diagram type providers and provide api to access them given the diagram
> type id?
>
> Thanks!
Previous Topic:How to have multidecorators
Next Topic:Listening selection change
Goto Forum:
  


Current Time: Sat Apr 04 19:35:40 GMT 2020

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

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

Back to the top