Skip to content

Commit

Permalink
Two bugs on AlloyParseHandler have been fixed:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Emre Kirmizi committed Dec 7, 2015
1 parent a8ec32f commit d69b439
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"});
Expand All @@ -62,6 +62,8 @@ public Object execute(final ExecutionEvent event) throws ExecutionException {
return null;
}

this.removeTypesFromMarkers();

final AlloyParser parser = new AlloyParser(result);
final ArrayList<MarkerTypeElement> roots = parser.getTypes();
final ArrayList<String> rels = parser.getRels();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d69b439

Please sign in to comment.