From 3f7d02affb506cd50e0a91423cfef8fe6037d47a Mon Sep 17 00:00:00 2001 From: alexey-andreev Date: Sun, 18 Jan 2015 19:20:42 +0400 Subject: [PATCH] Fix problem with removed problem markers --- teavm-eclipse/teavm-eclipse-plugin/plugin.xml | 1 + .../java/org/teavm/eclipse/TeaVMEclipsePlugin.java | 1 + .../org/teavm/eclipse/TeaVMProjectBuilder.java | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/teavm-eclipse/teavm-eclipse-plugin/plugin.xml b/teavm-eclipse/teavm-eclipse-plugin/plugin.xml index 0f8f33439..9e27d5941 100644 --- a/teavm-eclipse/teavm-eclipse-plugin/plugin.xml +++ b/teavm-eclipse/teavm-eclipse-plugin/plugin.xml @@ -90,6 +90,7 @@ + diff --git a/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java b/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java index 8cab5c03f..19183d9f1 100644 --- a/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java +++ b/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java @@ -43,6 +43,7 @@ public class TeaVMEclipsePlugin extends AbstractUIPlugin { public static final String CLASS_DIALOG_ID = ID + ".dialogs.classSelection"; public static final String PROBLEM_MARKER_ID = ID + ".problemMarker"; public static final String PROBLEM_MARKER_PROJECT_ATTRIBUTE = ID + ".problemMarker.project"; + public static final String PROBLEM_MARKER_PROFILE_ATTRIBUTE = ID + ".problemMarker.profile"; public static final String CONFIG_MARKER_ID = ID + ".configMarker"; private static TeaVMEclipsePlugin defaultInstance; private ConcurrentMap settingsMap = new ConcurrentHashMap<>(); diff --git a/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMProjectBuilder.java b/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMProjectBuilder.java index f065e905c..9b5fd7bc8 100644 --- a/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMProjectBuilder.java +++ b/teavm-eclipse/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMProjectBuilder.java @@ -60,13 +60,15 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder { monitor.beginTask("Running TeaVM", profiles.length * TICKS_PER_PROFILE); try { prepareClassPath(); - removeMarkers(); ClassLoader classLoader = new URLClassLoader(classPath, TeaVMProjectBuilder.class.getClassLoader()); for (TeaVMProfile profile : profiles) { SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, TICKS_PER_PROFILE); buildProfile(kind, subMonitor, profile, classLoader); } - + IMarker[] markers = getProject().findMarkers(TeaVMEclipsePlugin.PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); + for (IMarker marker : markers) { + System.out.println("MARKER INSTALLED: " + marker.getId()); + } } finally { monitor.done(); sourceContainers = null; @@ -94,6 +96,7 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder { if ((kind == AUTO_BUILD || kind == INCREMENTAL_BUILD) && !shouldBuild(profile)) { return; } + removeMarkers(profile); IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager(); TeaVMTool tool = new TeaVMTool(); tool.setClassLoader(classLoader); @@ -225,14 +228,17 @@ public class TeaVMProjectBuilder extends IncrementalProjectBuilder { profileClasses.put(profile, new HashSet<>(classes)); } - private void removeMarkers() throws CoreException { + private void removeMarkers(TeaVMProfile profile) throws CoreException { for (IProject project : getProject().getWorkspace().getRoot().getProjects()) { IMarker[] markers = project.findMarkers(TeaVMEclipsePlugin.PROBLEM_MARKER_ID, true, IResource.DEPTH_INFINITE); for (IMarker marker : markers) { String projectName = (String)marker.getAttribute(TeaVMEclipsePlugin.PROBLEM_MARKER_PROJECT_ATTRIBUTE); - if (projectName.equals(getProject().getName())) { + String profileName = (String)marker.getAttribute(TeaVMEclipsePlugin.PROBLEM_MARKER_PROFILE_ATTRIBUTE); + if (projectName.equals(getProject().getName()) && profileName.equals(profile.getName())) { marker.delete(); + System.out.println("MARKER REMOVED: " + marker.getId() + " while building project " + + getProject().getName()); } } }