| Summary: | Exception on workspace image setting with different image format | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Esteban DUGUEPEROUX <esteban.dugueperoux> | ||||||||
| Component: | Diagram | Assignee: | Laurent Redor <laurent.redor> | ||||||||
| Status: | CLOSED FIXED | QA Contact: | Florian Barbin <florian.barbin> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | florian.barbin, laurent.redor, maxime.porhel | ||||||||
| Version: | 3.1.0 | Keywords: | triaged | ||||||||
| Target Milestone: | 4.0.0M4 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| See Also: |
https://git.eclipse.org/r/59635 https://git.eclipse.org/r/59650 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=03c6987a4c35ff2c1c034281283423e32920bdb0 |
||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 481730 | ||||||||||
| Attachments: |
|
||||||||||
Several strategies to fix this issue: On WorkspaceImage.workspacePath image type change : 1. Override GraphicalEditPart.handleNotification(Notification) from the parent EditPart of the EditPart owning the IWorkspaceImageFigure and call removeChild(childEditPart) 2. Have a single unchanged IWorkspaceImageFigure which delegate the paint of SVG or other types of image to a specific implementation 3. Have 2 kind of EditParts, a first one for SVG and a second one for other format, with different style WorkspaceImage, for example SVGWorkspaceImage and StandardWorkspaceImage to have viewpoint model changed on workspacePath attribute change to have EditPart changed automatically. These 3 strategies of fix are impacting. New Gerrit change created: https://git.eclipse.org/r/59635 Created attachment 257723 [details]
Sample project to reproduce
A more complete step to reproduce to test all cases is :
1. Open the diagram
2. Select the first node
3. Set style as workspace image by using the file image.jpg contained in the project
4. Select the second node
5. Set style as workspace image by using the file image.svg contained in the project
6. Select the first node
7. Set style as workspace image by using the file image.svg contained in the project
8. Select the second node
9. Set style as workspace image by using the file image.jpg contained in the project
All these changes should be OK (without message in error log).
Created attachment 257725 [details]
More complete sample project
Same scenario as above but with more cases:
1. Open the diagram
2. Select each node/container of the first column
3. Set style as workspace image, for each, by using the file image.jpg contained in the project
4. Select each node/container of the second column
5. Set style as workspace image, for each, by using the file image.svg contained in the project
6. Select each node/container of the first column
7. Set style as workspace image, for each, by using the file image.svg contained in the project
8. Select each node/container of the second column
9. Set style as workspace image, for each, by using the file image.jpg contained in the project
All these changes should be OK (without message in error log).
New Gerrit change created: https://git.eclipse.org/r/59650 Gerrit change https://git.eclipse.org/r/59650 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=03c6987a4c35ff2c1c034281283423e32920bdb0 Resolved on master Verified on Sirius 4.0.0.201605180923 Available in Sirius 4.0.0. |
Created attachment 257696 [details] Sample project to reproduce Using the attached project sample : 1. Open the diagram 2. Select the first node and set as workspace image the jpg image 3. Select the second node and set as workspace image the svg image : org.eclipse.swt.SWTException: Unsupported or unrecognized format at org.eclipse.swt.SWT.error(SWT.java:4361) at org.eclipse.swt.SWT.error(SWT.java:4276) at org.eclipse.swt.SWT.error(SWT.java:4247) at org.eclipse.swt.internal.image.FileFormat.load(FileFormat.java:84) at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:147) at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22) at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331) at org.eclipse.jface.resource.URLImageDescriptor.getImageData(URLImageDescriptor.java:71) at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:273) at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:166) at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:227) at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:205) at org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin$Implementation.getImage(DiagramUIPlugin.java:519) at org.eclipse.sirius.diagram.ui.tools.api.figure.WorkspaceImageFigure.flyWeightImage(WorkspaceImageFigure.java:130) at org.eclipse.sirius.diagram.ui.tools.api.figure.WorkspaceImageFigure.flyWeightImage(WorkspaceImageFigure.java:116) at org.eclipse.sirius.diagram.ui.tools.api.figure.WorkspaceImageFigure.refreshFigure(WorkspaceImageFigure.java:185) at org.eclipse.sirius.diagram.ui.internal.edit.parts.WorkspaceImageEditPart.refreshVisuals(WorkspaceImageEditPart.java:97) at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:725) at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:644) at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$3(GraphicalEditPart.java:1) at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:861) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328) at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851) at org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNodeEditPart.handleNotificationEvent(AbstractDiagramNodeEditPart.java:109) at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.notifyChanged(GraphicalEditPart.java:1438) at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.fireNotification(DiagramEventBroker.java:504) at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.resourceSetChanged(DiagramEventBroker.java:399) at org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73) at fr.obeo.dsl.viewpoint.collab.ui.diagram.internal.CollabDiagramEventBroker.resourceSetChanged(CollabDiagramEventBroker.java:65) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl$1.run(TransactionalEditingDomainImpl.java:781) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.postcommit(TransactionalEditingDomainImpl.java:771) at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543) at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712) at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474) at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:155) at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513) at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208) at fr.obeo.dsl.viewpoint.collab.api.editingdomain.NonDirtyingCapableWorkspaceCommandStack.doExecute(NonDirtyingCapableWorkspaceCommandStack.java:68) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165) at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219) at org.eclipse.sirius.diagram.ui.business.api.image.ImageSelectorService.updateWorkspacePath(ImageSelectorService.java:172) at org.eclipse.sirius.diagram.ui.business.api.image.ImageSelectorService.updateStyle(ImageSelectorService.java:137) at org.eclipse.sirius.diagram.ui.tools.internal.actions.style.SetStyleToWorkspaceImageAction.run(SetStyleToWorkspaceImageAction.java:78) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3562) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3186) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414) This scenario works fine when the style of the node is not already a WorkspaceImage.