Rhett Hudson Messages: 43 Registered: September 2010
Member
I'd like to add an AdvancedPropertySection tab to my property sheet, but my initial examination of the code leads me to believe that the object that gets selected (maybe an IPictogramElementDelegate?) implements IAdapaptable. So, I can't bind an IAdapterFactory to pass back the IPropertySource implementation. Even if I could, it's not obvious that I could get back to my PictogramElements or my domain model using public interfaces from there. Is there some mechanism for supplying an IPropertySource for a PictogramElement? Or do I have to implement my own version of AdvancedPropertySection that gets its data through the mechanism outlined in the Graphiti user's guide?
Thanks for you help. I continue to be impressed by the flexibility of your framework and the helpfulness of your forum.
Rhett Hudson Messages: 43 Registered: September 2010
Member
So, the answer to my question is that the AdapterFactory must convert between a 'org.eclipse.graphiti.ui.internal.parts.ContainerShapeEditPa rt' and IPropertySource. This is unfortunate since ContainerShapeEditPart is an internal class.
Since exposing the internal class probably isn't the best recourse, Graphiti could supply a service that registers an AdapterFactory on behalf of the user. Or perhaps provide an extension point that does it declaratively.
I'd like to add an AdvancedPropertySection tab to my property sheet, but my
initial examination of the code leads me to believe that the object that
gets selected (maybe an IPictogramElementDelegate?) implements IAdapaptable.
So, I can't bind an IAdapterFactory to pass back the IPropertySource
implementation. Even if I could, it's not obvious that I could get back to
my PictogramElements or my domain model using public interfaces from there.
Is there some mechanism for supplying an IPropertySource for a
PictogramElement? Or do I have to implement my own version of
AdvancedPropertySection that gets its data through the mechanism outlined in
the Graphiti user's guide?
Thanks for you help. I continue to be impressed by the flexibility of your
framework and the helpfulness of your forum.
Rhett Hudson Messages: 43 Registered: September 2010
Member
Michael,
Yes. I have several tabbed property sheets working. One tabbed property section that the Eclipse framework provides for reuse is an interface to the old tabular property sheet interface. I use this to augment my other tabs. The only trick is to be able to feed it data. My previous post outlined what is required to do that. It all works, the only issue is the reference to an internal Graphiti class. Even that works, it just comes at the cost of a warning.
Yes. I have several tabbed property sheets working. One tabbed property
section that the Eclipse framework provides for reuse is an interface to the
old tabular property sheet interface. I use this to augment my other tabs.
The only trick is to be able to feed it data. My previous post outlined what
is required to do that. It all works, the only issue is the reference to an
internal Graphiti class. Even that works, it just comes at the cost of a
warning.
I would like to do exactly what you described in your post: using an "old style" property sheet. I have adapted the ContainerShapeEditPart to an IPropertySource by registering an adapter factory with the platform adapter manager. The adapter factory I created serves a PropertySource for my model objects. Problem is I can not get this to work - the property view gets notified of selection changes in the graph, but never asks for the IPropertySource interface, so my adapter factory is never called. I have checked that a SelectionProvider is already registered with the DiagramEditor (selection provider is a org.eclipse.graphiti.ui.internal.editor.GraphitiScrollingGraphicalViewer).
Do you possibly have some source code (or comments) you could send that shows how you got this to work?
Rhett Hudson Messages: 43 Registered: September 2010
Member
That all sounds right. The only thing I can suggest off-hand is that one of the type filters for determining whether your factory is the factory that should be asked for an adapter is setup to filter the wrong type. Sometimes when I suspect that, I turn off all the type filtering and watch the object that gets passed in the debugger or a log message to make sure I understand what type it really is.
I can't get it to work that way - in the end I had to overload the getAdapter() method in DiagramEditorInternal and on request to adapt IPropertySheetPage.class I return an old style PropertySheetPage rather than the TabbedPropertySheetPage returned by default. By doing that the EditPart getAdapter() will finally receive requests to adapt IPropertySource.