| Summary: | Support AdvancedPropertySheet by providing mechanism for registering an AdapterFacotry against ContainerShapeEditPart | ||
|---|---|---|---|
| Product: | [Modeling] Graphiti | Reporter: | Rhett Hudson <rhett.hudson> |
| Component: | Core | Assignee: | Project Inbox <graphiti-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | matthias.gorning, michael.wenz, refsdal.ivar, sgandon |
| Version: | 0.7.0 | Flags: | michael.wenz:
juno+
|
| Target Milestone: | 0.9.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=357632 | ||
| Whiteboard: | Juno M6 Theme_round_offs | ||
|
Description
Rhett Hudson
Here's a link to the original forum discussion of this feature request. http://www.eclipse.org/forums/index.php?t=msg&th=205597 I have been able to make the warning go away by registering the adapter against org.eclipse.gef.editparts.AbstractGraphicalEditPart instead of ContainerShapeEditPart. AbstractGraphicalEditPart is a GEF superclass of ContainerShapeEditPart that isn't internal. This might have unintended side effects for an application using more than one GEF-based feature. Would like to target for Juno I was also looking at EEF (http://www.eclipse.org/modeling/emft/?project=eef) that is an eclipse project that generates a Tabbed property sheet from an EMF model. and I am facing the same problem, that is the selection is not an EObject. EEF is trying to resolve the selection this way : /** * @param object * @return */ protected EObject resolveSemanticObject(Object object) { if (object instanceof EObject) { return (EObject)object; } else if (object instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable)object; if (adaptable.getAdapter(SemanticAdapter.class) != null) { SemanticAdapter semanticAdapter = (SemanticAdapter)adaptable .getAdapter(SemanticAdapter.class); return semanticAdapter.getEObject(); } else if (adaptable.getAdapter(EObject.class) != null) { return (EObject)adaptable.getAdapter(EObject.class); } } return null; } So we definitly need a way to register AdapterFactory to the Graphiti ContainerShapeEditPart. That would be very helpful. Just a remark about adapting to IPropertySource, looking at the graphiti code, it seems that org.eclipse.graphiti.ui.internal.parts.PictogramElementDelegate.getAdapter(Class) is delegating to the IToolBehaviorProvider. And this is a class you can provide in you type provider by overrinding : org.eclipse.graphiti.dt.AbstractDiagramTypeProvider.getCurrentToolBehaviorProvider(). Does'nt it fits your need Rhett ? It looks like it might. Though it's not clear that that behavior is a documented feature of a public interface. So, my choice would seem to be relying on undocumented behavior of an internal method or registering an adapter factory against an internal class. I think I prefer the later. I'd at least get a compiler error if the class went away. :) *** Bug 357632 has been marked as a duplicate of this bug. *** Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=357632 gives more details on how to reuse generated EMF property sheets. The solution provided to solve this bug should also enable to scenerio described there. This is now solved in a way very similar to what Rhett proposed as first alternative. Graphiti now provides a public-API base class for its edit parts for Shapes (org.eclipse.graphiti.ui.platform.GraphitiShapeEditPart) and one for the edit parts for connections (org.eclipse.graphiti.ui.platform.GraphitiConnectionEditPart); these classes can now be used to define an adapter factory extension without API-warnings that adapts the selected edit part to an IPropertySource. The interface solution does not help since the Eclipse adapter factory only works with class objects here. Besides I added a small example in the tutorial implementation (a tabular property section for EReferences showing the name of the selected connection) and a short description of that in the tutorial page on properties. I hope this also works out for the EEF issue, Sebastien just let me know in case it doesn't. Checked-in and pushed to Eclipse: commit c82ab708a20a5a25f3d424f90d1562dbd2189176 Author: mwenz <michael.wenz@sap.com> 2012-02-21 12:37:35 Committer: mwenz <michael.wenz@sap.com> 2012-02-21 12:37:35 Parent: 3f4b57fdc30f3634bfb140aa21b714d026198528 (Bug 371671 - addGraphicalRepresentation returns null in dark mode * added test) Branches: origin/master, master Bookkeeping: Set target release Part of Graphiti 0.9.0 (Eclipse Juno) |