Community
Participate
Working Groups
Created attachment 265722 [details] Plugins with demo viewpoint, rule and quickfix Hi all, here is a bug I found: When having multiple error markers for a given resource, applying a quick fix for it from Sirius doesn't let the possibility to further apply other fixes for other items. In attachment, plugins to reproduce the bug (with a validation rule which states that the attribute of contained objects shall not be 0), and a demo project. Steps to reproduce the bug from the demo project: - Open the existing representation, - Launch the validation, - Select one of the two objects with "aproperty" equal to O, - Apply the quick fix on it, - Attempt to apply the quick fix on the second object. The bug occurs there, as the fix seems to be launched without effect. Note : by launching the validation again one can apply a fix. From outside, it looks like error markers are regenerated when applying the first fixes and somehow they got disconnected from those handled by Sirius...
Created attachment 265723 [details] A demo project which allows to reproduce the bug
Debugging the second fix attempt, I found that in org.eclipse.sirius.diagram.ui.internal.quickfix.ValidationFixResolution.tryToOpenEditorAndApplyFix() at line 127, "markedView" is null, so no fix is executed and no re-validation is done : View markedView = getMarkedView(currentSession, marker); // is null on the second attempt if (markedView != null) { EObject fixTarget = getFixTarget(markedView); if (fixTarget != null) { Diagram diagram = markedView.getDiagram(); executeFix(editor, (DDiagram) diagram.getElement(), fixTarget, currentSession.getTransactionalEditingDomain(), offscreenValidation); revalidate(editor, diagram, offscreenValidation); } }
getMarkedView() mentionned above returns null, as "diagramURI" is null in : String diagramURI = marker.getAttribute(NavigationMarkerConstants.DIAGRAM_URI, null);
DiagramUri is not set as in ValidateAction.createValidationRuleMarker(...) { [...] // Search diagram URI Object object = viewer.getFocusEditPart().getModel(); String diagramUri = null; if (object instanceof Diagram) { final URI uri = EcoreUtil.getURI((Diagram) object); diagramUri = uri.toString(); } The object which has the focus denotes the object which is fixed, and this is not necessarily the diagram. As the uri is mandatory for further process, the code above should be improved to handle the case where a DNode or such has the focus (i.e. is fixed).
Hi Thomas, Thank you for your detailed bug report and analysis. It seems that in some cases, we do not have a Diagram but an other kind of GMF View, we might just need to get the corresponding parentDiagram to be able to put the diagramUri in the marker. We already have the diagramEditPart in the calling method so we could also directly get the diagram with diagramEditPart.getDiagramView(); Note that it's not yet in the scope of a future release. Regards Maxime