diff --git a/app/src/processing/app/contrib/LocalContribution.java b/app/src/processing/app/contrib/LocalContribution.java index d892a5869..7c17c4d04 100644 --- a/app/src/processing/app/contrib/LocalContribution.java +++ b/app/src/processing/app/contrib/LocalContribution.java @@ -369,7 +369,8 @@ public abstract class LocalContribution extends Contribution { } if (getType() == ContributionType.TOOL) { ToolContribution t = (ToolContribution) this; - editor.clearToolMenu(); + for (Editor ed : editor.getBase().getEditors()) + ed.clearToolMenu(); t.clearClassLoader(editor.getBase()); } if (doBackup) { diff --git a/app/src/processing/app/contrib/ToolContribution.java b/app/src/processing/app/contrib/ToolContribution.java index cb8c017b5..cf7ecab6e 100644 --- a/app/src/processing/app/contrib/ToolContribution.java +++ b/app/src/processing/app/contrib/ToolContribution.java @@ -71,21 +71,29 @@ public class ToolContribution extends LocalContribution implements Tool { // int botherToRemove = contribTools.indexOf(this); // if (botherToRemove != -1) { // The poor thing doesn't even exist, and we're trying to remove it... // contribTools.remove(botherToRemove); - ArrayList contribTools = base.getActiveEditor().contribTools; - for (ToolContribution toolContrib : contribTools) - if (toolContrib.getName().equals(this.name)) { - try { - System.out.println("Here " + name); - ((URLClassLoader) this.loader).close(); - ((URLClassLoader) toolContrib.loader).close(); - // The typecast should be safe, since the only case when loader is not of - // type URLClassLoader is when no archives were found in the first - // place... - } catch (IOException e) { - e.printStackTrace(); - } + try { + ((URLClassLoader) this.loader).close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + List editors = base.getEditors(); + for (Editor editor : editors) { + ArrayList contribTools = editor.contribTools; + for (ToolContribution toolContrib : contribTools) + if (toolContrib.getName().equals(this.name)) { + try { + System.out.println("Here " + name); + ((URLClassLoader) toolContrib.loader).close(); + System.out.println(contribTools.size()); + editor.contribTools.remove(toolContrib); + System.out.println(contribTools.size()); + break; + } catch (IOException e) { + e.printStackTrace(); + } // base.getActiveEditor().rebuildToolMenu(); - } + } + } // } }