diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 06b01c083..33bf77c3b 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -31,6 +31,7 @@ import java.io.*; import java.lang.reflect.InvocationTargetException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.Map.Entry; import javax.swing.JFileChooser; import javax.swing.JMenu; @@ -489,7 +490,10 @@ public class Base { System.out.println("Attempting to load " + modeClass + " with resources at " + modeResourcePath); ModeContribution mc = ModeContribution.load(this, new File(modeResourcePath), modeClass); contribModes.add(mc); - known.remove(mc); + File key = getFileForContrib(mc, known); + if (key != null) { + known.remove(key); + } } if (known.size() != 0) { for (ModeContribution mc : known.values()) { @@ -499,6 +503,17 @@ public class Base { } + static private File getFileForContrib(ModeContribution contrib, + Map known) { + for (Entry entry : known.entrySet()) { + if (entry.getValue() == contrib) { + return entry.getKey(); + } + } + return null; + } + + /** * Instantiates and adds new contributed modes to the contribModes list. * Checks for duplicates so the same mode isn't instantiates twice. Does not