mirror of
https://github.com/processing/processing4.git
synced 2026-02-14 19:05:34 +01:00
was calling remove() on the value, not the key for the contribs, meaning that nothing was ever removed
This commit is contained in:
@@ -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<File, ModeContribution> known) {
|
||||
for (Entry<File, ModeContribution> 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
|
||||
|
||||
Reference in New Issue
Block a user