diff --git a/app/src/processing/app/ContributionManager.java b/app/src/processing/app/ContributionManager.java
index a44a4963d..157a0c62c 100644
--- a/app/src/processing/app/ContributionManager.java
+++ b/app/src/processing/app/ContributionManager.java
@@ -46,7 +46,7 @@ public class ContributionManager {
static public final String DELETION_FLAG = "flagged_for_deletion";
static private final String DOUBLE_CLICK_SECONDARY =
- "Click “Yes” to install this library to your sketchbook...";
+ "Click “Yes†to install this library to your sketchbook...";
static private final String DISCOVERY_ERROR_TITLE = "Trouble discovering libraries";
@@ -609,8 +609,11 @@ public class ContributionManager {
// Move newTool to the sketchbook library folder
if (newTool.getFolder().renameTo(newToolDest)) {
ToolContribution movedTool = ToolContribution.getTool(newToolDest);
- if (movedTool.instantiateToolClass()) {
+ try {
+ movedTool.initializeToolClass();
return movedTool;
+ } catch (Exception e) {
+ e.printStackTrace();
}
} else {
Base.showWarning("Trouble moving new tool to the sketchbook",
@@ -689,7 +692,7 @@ public class ContributionManager {
result = Base.showYesNoQuestion(editor, "Replace",
"Replace existing \"" + oldLib.getName() + "\" library?",
"An existing copy of the \"" + oldLib.getName() + "\" library
"+
- "has been found in your sketchbook. Clicking “Yes”
"+
+ "has been found in your sketchbook. Clicking “Yesâ€
"+
"will move the existing library to a backup folder
" +
" in libraries/old before replacing it.");
}
@@ -1029,4 +1032,4 @@ abstract class JProgressMonitor extends AbstractProgressMonitor {
public abstract void finishedAction();
-}
+}
\ No newline at end of file
diff --git a/app/src/processing/app/ToolContribution.java b/app/src/processing/app/ToolContribution.java
index 29c62fbf3..91028d8b8 100644
--- a/app/src/processing/app/ToolContribution.java
+++ b/app/src/processing/app/ToolContribution.java
@@ -110,19 +110,12 @@ public class ToolContribution extends InstalledContribution implements Tool {
}
/**
- * Creates and instance of the Tool object. Warning: this makes it impossible
- * (on Windows) to move the files in the tool's classpath without restarting
- * the PDE.
+ * Loads the tool, making it impossible (on Windows) to move the files in the
+ * classpath without restarting the PDE.
*/
- public boolean instantiateToolClass() {
- try {
- Class> toolClass = Class.forName(className, true, loader);
- tool = (Tool) toolClass.newInstance();
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return false;
+ public void initializeToolClass() throws Exception {
+ Class> toolClass = Class.forName(className, true, loader);
+ tool = (Tool) toolClass.newInstance();
}
static protected String findClassInZipFile(String base, File file) {
@@ -171,7 +164,7 @@ public class ToolContribution extends InstalledContribution implements Tool {
}
static protected void list(File folder, ArrayList tools,
- boolean instantiateToolClass) {
+ boolean doInitializeToolClass) {
File[] folders = folder.listFiles(new FileFilter() {
public boolean accept(File folder) {
@@ -199,10 +192,16 @@ public class ToolContribution extends InstalledContribution implements Tool {
}
for (int i = 0; i < folders.length; i++) {
- ToolContribution contrib = getTool(folders[i]);
- if (!instantiateToolClass
- || (instantiateToolClass && contrib.instantiateToolClass())) {
- tools.add(contrib);
+ try {
+ final ToolContribution tool = getTool(folders[i]);
+ try {
+ if (doInitializeToolClass)
+ tool.initializeToolClass();
+ tools.add(tool);
+ } catch (Exception e) {
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
}
@@ -223,4 +222,4 @@ public class ToolContribution extends InstalledContribution implements Tool {
return Type.TOOL;
}
-}
+}
\ No newline at end of file