Skip to content

Commit 1700eaa

Browse files
committed
deeper into the contrib manager rabbit hole
1 parent 9b77d69 commit 1700eaa

9 files changed

Lines changed: 183 additions & 142 deletions

File tree

app/src/processing/app/Base.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ static public boolean isCommandLine() {
268268

269269

270270
public Base(String[] args) throws Exception {
271-
ContributionManager.cleanup(this);
271+
ContributionManager.init(this);
272+
272273
buildCoreModes();
273274
rebuildContribModes();
274275
rebuildContribExamples();
@@ -686,7 +687,7 @@ public void populateToolsMenu(JMenu toolsMenu) {
686687
JMenuItem item = new JMenuItem(Language.text("menu.tools.add_tool"));
687688
item.addActionListener(new ActionListener() {
688689
public void actionPerformed(ActionEvent e) {
689-
ContributionManager.openToolManager(getActiveEditor());
690+
ContributionManager.openTools();
690691
}
691692
});
692693
toolsMenu.add(item);

app/src/processing/app/Mode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public void actionPerformed(ActionEvent e) {
416416
item = new JMenuItem(Language.text("examples.add_examples"));
417417
item.addActionListener(new ActionListener() {
418418
public void actionPerformed(ActionEvent e) {
419-
ContributionManager.openExampleManager(base.getActiveEditor());
419+
ContributionManager.openExamples();
420420
}
421421
});
422422
toolbarMenu.add(item);
@@ -492,7 +492,7 @@ public void rebuildImportMenu() { //JMenu importMenu) {
492492
JMenuItem addLib = new JMenuItem(Language.text("menu.library.add_library"));
493493
addLib.addActionListener(new ActionListener() {
494494
public void actionPerformed(ActionEvent e) {
495-
ContributionManager.openLibraryManager(base.getActiveEditor());
495+
ContributionManager.openLibraries();
496496
}
497497
});
498498
importMenu.add(addLib);

app/src/processing/app/UpdateCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ protected boolean promptToOpenContributionManager() {
180180
options,
181181
options[0]);
182182
if (result == JOptionPane.YES_OPTION) {
183-
ContributionManager.openUpdates(base.getActiveEditor());
183+
ContributionManager.openUpdates();
184184
return true;
185185
}
186186

app/src/processing/app/contrib/ContributionManager.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import processing.app.Base;
3131
import processing.app.Language;
3232
import processing.app.Messages;
33-
import processing.app.Settings;
3433
import processing.app.Util;
3534
import processing.app.ui.Editor;
3635
import processing.core.PApplet;
@@ -481,7 +480,7 @@ static public String getFileName(File libFile) {
481480
* and remove any "requires restart" flags.
482481
* Also updates all entries previously marked for update.
483482
*/
484-
static public void cleanup(final Base base) throws Exception {
483+
static private void cleanup(final Base base) throws Exception {
485484
deleteTemp(Base.getSketchbookModesFolder());
486485
deleteTemp(Base.getSketchbookToolsFolder());
487486

@@ -649,47 +648,52 @@ public boolean accept(File folder) {
649648
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
650649

651650

652-
static ManagerFrame managerDialog =
653-
new ManagerFrame();
651+
static ManagerFrame managerDialog;
652+
653+
654+
static public void init(Base base) throws Exception {
655+
managerDialog = new ManagerFrame(base);
656+
cleanup(base);
657+
}
654658

655659

656660
/**
657661
* Show the Library installer window.
658662
*/
659-
static public void openLibraryManager(Editor editor) {
660-
managerDialog.showFrame(editor, ContributionType.LIBRARY);
663+
static public void openLibraries() {
664+
managerDialog.showFrame(ContributionType.LIBRARY);
661665
}
662666

663667

664668
/**
665-
* Show the Tool installer window.
669+
* Show the Mode installer window.
666670
*/
667-
static public void openToolManager(Editor editor) {
668-
managerDialog.showFrame(editor, ContributionType.TOOL);
671+
static public void openModes() {
672+
managerDialog.showFrame(ContributionType.MODE);
669673
}
670674

671675

672676
/**
673-
* Show the Mode installer window.
677+
* Show the Tool installer window.
674678
*/
675-
static public void openModeManager(Editor editor) {
676-
managerDialog.showFrame(editor, ContributionType.MODE);
679+
static public void openTools() {
680+
managerDialog.showFrame(ContributionType.TOOL);
677681
}
678682

679683

680684
/**
681685
* Show the Examples installer window.
682686
*/
683-
static public void openExampleManager(Editor editor) {
684-
managerDialog.showFrame(editor, ContributionType.EXAMPLES);
687+
static public void openExamples() {
688+
managerDialog.showFrame(ContributionType.EXAMPLES);
685689
}
686690

687691

688692
/**
689693
* Open the updates panel.
690694
*/
691-
static public void openUpdates(Editor editor) {
692-
managerDialog.showFrame(editor, null);
695+
static public void openUpdates() {
696+
managerDialog.showFrame(null);
693697
}
694698

695699

0 commit comments

Comments
 (0)