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) {