From d69b439957e4abec167412830cf772f6e74a77a8 Mon Sep 17 00:00:00 2001 From: Emre Kirmizi Date: Mon, 7 Dec 2015 18:45:39 +0200 Subject: [PATCH] Two bugs on AlloyParseHandler have been fixed: 1. If you click LoadSpesification and then click Cancel button without select any .als file, Marker types was being removed. But now it doesn't. 2. If there is an mapped marker which is a source marker (which has MappingAnnotation type), when you load any other spesification file (als file), the marker's annotation was not being changed as MarkingAnnotation type. But now it is changing. --- .../marker/command/AlloyParseHandler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/eu.modelwriter.marker.command/src/eu/modelwriter/marker/command/AlloyParseHandler.java b/Source/eu.modelwriter.marker.command/src/eu/modelwriter/marker/command/AlloyParseHandler.java index 28171ee6..5bbf1bb9 100644 --- a/Source/eu.modelwriter.marker.command/src/eu/modelwriter/marker/command/AlloyParseHandler.java +++ b/Source/eu.modelwriter.marker.command/src/eu/modelwriter/marker/command/AlloyParseHandler.java @@ -28,12 +28,14 @@ import org.eclipse.ui.PlatformUI; import eu.modelwriter.configuration.alloy.AlloyParser; +import eu.modelwriter.configuration.internal.AlloyUtilities; import eu.modelwriter.marker.MarkerActivator; import eu.modelwriter.marker.Serialization; import eu.modelwriter.marker.internal.MarkUtilities; import eu.modelwriter.marker.internal.MarkerFactory; import eu.modelwriter.marker.internal.MarkerTypeElement; import eu.modelwriter.marker.ui.internal.views.visualizationview.Visualization; +import eu.modelwriter.marker.ui.internal.wizards.mappingwizard.MappingWizard; import eu.modelwriter.marker.ui.internal.wizards.markerwizard.MarkerPage; public class AlloyParseHandler extends AbstractHandler { @@ -52,8 +54,6 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { return null; } - this.removeTypesFromMarkers(); - final FileDialog dialog = new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.als", "*.mw"}); @@ -62,6 +62,8 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { return null; } + this.removeTypesFromMarkers(); + final AlloyParser parser = new AlloyParser(result); final ArrayList roots = parser.getTypes(); final ArrayList rels = parser.getRels(); @@ -93,9 +95,13 @@ private void removeTypesFromMarkers() { isClosed = true; ((IProject) iResource).open(new NullProgressMonitor()); } - for (final IMarker iMarker : MarkerFactory.findMarkersAsArrayList(iResource)) { + for (IMarker iMarker : MarkerFactory.findMarkersAsArrayList(iResource)) { if (MarkUtilities.getType(iMarker) != null) { + if (MappingWizard.findTargetCount(iMarker) != 0) { + iMarker = MappingWizard.convertAnnotationType(iMarker, false, true); + } MarkUtilities.setType(iMarker, null); + AlloyUtilities.removeTypeFromMarker(iMarker); } } if (isClosed == true) {