Community
Participate
Working Groups
When using this extension point one can specify Id's and attributes for the color, bordercolor and bordersize. These definitions are required in the grammar (though the PDE tooling is not enforcing anything), failing to put those will lead to a crash when opening the diagram, for instance: ```java.lang.StringIndexOutOfBoundsException: String index out of range: 11 at java.lang.String.substring(String.java:1963) at org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure.getNewStyle(BundledImageFigure.java:399) at org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure.updateDocumentColors(BundledImageFigure.java:289) at org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure.updateColors(BundledImageFigure.java:210) at org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure.refreshFigure(BundledImageFigure.java:415) at org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure.createImageFigure(BundledImageFigure.java:164) at org.eclipse.sirius.diagram.ui.internal.edit.parts.BundledImageEditPart.createNodeShape(BundledImageEditPart.java:118) at org.eclipse.sirius.diagram.ui.internal.edit.parts.BundledImageEditPart.createNodeFigure(BundledImageEditPart.java:176) at org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart.createFigure(ShapeNodeEditPart.java:90) at org.eclipse.gef.editparts.AbstractGraphicalEditPart.getFigure(AbstractGraphicalEditPart.java:494) at org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart.addChildVisual(AbstractBorderedShapeEditPart.java:90) at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:211) `` when having a definition with none of these attributes defined. As a user I would have expected that Sirius would have had used the image "as is" without any replacement, and not fail like that.
Agreed. It seems there are two aspects: * improve the extension point definition to help PDE help the user; * make the code more robust in the presence of invalid configuration. In case of miconfiguration, the code should: * log an error/warning with enough information about what is wrong and what is expected for the specifier to fix the problem (i.e. not just "An error occured", but "Id 'foo' should denote a gradient stop (or whatever) but none could be found in 'bar.svg'"); * fallback to using the raw SVG (or maybe with only the correctly configured style adjustments) instead of crashing.
I'm still fighting to get my shapes working as I expect, it seems there is an assumption that a color is a gradient for instance... (I'm not 100%, I don't have errors now but the color is still not changing). As a user, it feels like pure and simple variable substitution in the SVG would be much simpler and less error prone.
New Gerrit change created: https://git.eclipse.org/r/105418
Gerrit change https://git.eclipse.org/r/105418 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=a5dbd7c3fc0197146c554f02b1a26aa34e6457fa
Created attachment 270295 [details] The plugin which contains the extension for testing.
Created attachment 270296 [details] The modeling project using the extension.
Steps to reproduce: * import in your workspace the plugin project from bundleShapeExtension.zip archive, * launch a runtime, * import in the runtime workspace the modeling project from modelingProject.zip * open the errorLog view, * open the diagram "new myPackage" -> The diagram should have opened without Exception * Ensure that the ring to describe the class is blue (as specified in the odesign file and possible thanks to the extension) ->OK * Ensure that a warning is displayed in the error Log about incomplete extension -> OK
Fixed.
Validated on Sirius Stable 5.1.0.201709221508
Available in Sirius 5.1.0, see https://wiki.eclipse.org/Sirius/5.1.0.