Skip to content

Commit a8e58bb

Browse files
committed
cleaning up Base, move Platform things into Platform (#2765)
1 parent efa529e commit a8e58bb

35 files changed

+590
-675
lines changed

app/src/processing/app/Base.java

Lines changed: 47 additions & 470 deletions
Large diffs are not rendered by default.

app/src/processing/app/Language.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static public void saveLanguage(String language) {
148148
} catch (Exception e) {
149149
e.printStackTrace();
150150
}
151-
Base.getPlatform().saveLanguage(language);
151+
Platform.saveLanguage(language);
152152
}
153153

154154

app/src/processing/app/Library.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private Library(File folder, String groupName) {
142142

143143
// for the host platform, need to figure out what's available
144144
File nativeLibraryFolder = libraryFolder;
145-
String hostPlatform = Base.getPlatformName();
145+
String hostPlatform = Platform.getName();
146146
// System.out.println("1 native lib folder now " + nativeLibraryFolder);
147147
// see if there's a 'windows', 'macosx', or 'linux' folder
148148
File hostLibrary = new File(libraryFolder, hostPlatform);
@@ -152,7 +152,8 @@ private Library(File folder, String groupName) {
152152
// System.out.println("2 native lib folder now " + nativeLibraryFolder);
153153
// check for bit-specific version, e.g. on windows, check if there
154154
// is a window32 or windows64 folder (on windows)
155-
hostLibrary = new File(libraryFolder, hostPlatform + Base.getNativeBits());
155+
hostLibrary =
156+
new File(libraryFolder, hostPlatform + Platform.getNativeBits());
156157
if (hostLibrary.exists()) {
157158
nativeLibraryFolder = hostLibrary;
158159
}

app/src/processing/app/Mode.java

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import javax.swing.*;
3535
import javax.swing.tree.*;
3636

37+
import processing.app.contrib.ContributionManager;
3738
import processing.app.syntax.*;
3839
import processing.app.ui.Editor;
3940
import processing.app.ui.EditorException;
@@ -192,7 +193,7 @@ public ClassLoader getClassLoader() {
192193
public void setupGUI() {
193194
try {
194195
// First load the default theme data for the whole PDE.
195-
theme = new Settings(Base.getContentFile("lib/theme.txt"));
196+
theme = new Settings(Platform.getContentFile("lib/theme.txt"));
196197

197198
// The mode-specific theme.txt file should only contain additions,
198199
// and in extremely rare cases, it might override entries from the
@@ -414,7 +415,7 @@ public void actionPerformed(ActionEvent e) {
414415
item = new JMenuItem(Language.text("examples.add_examples"));
415416
item.addActionListener(new ActionListener() {
416417
public void actionPerformed(ActionEvent e) {
417-
base.handleOpenExampleManager();
418+
ContributionManager.openExampleManager(base.getActiveEditor());
418419
}
419420
});
420421
toolbarMenu.add(item);
@@ -490,7 +491,7 @@ public void rebuildImportMenu() { //JMenu importMenu) {
490491
JMenuItem addLib = new JMenuItem(Language.text("menu.library.add_library"));
491492
addLib.addActionListener(new ActionListener() {
492493
public void actionPerformed(ActionEvent e) {
493-
base.handleOpenLibraryManager();
494+
ContributionManager.openLibraryManager(base.getActiveEditor());
494495
}
495496
});
496497
importMenu.add(addLib);
@@ -558,76 +559,6 @@ public void actionPerformed(ActionEvent e) {
558559
}
559560

560561

561-
/*
562-
public JMenu getExamplesMenu() {
563-
if (examplesMenu == null) {
564-
rebuildExamplesMenu();
565-
}
566-
return examplesMenu;
567-
}
568-
569-
570-
public void rebuildExamplesMenu() {
571-
if (examplesMenu == null) {
572-
examplesMenu = new JMenu("Examples");
573-
}
574-
rebuildExamplesMenu(examplesMenu, false);
575-
}
576-
577-
578-
public void rebuildExamplesMenu(JMenu menu, boolean replace) {
579-
try {
580-
// break down the examples folder for examples
581-
File[] subfolders = getExampleCategoryFolders();
582-
583-
for (File sub : subfolders) {
584-
Base.addDisabledItem(menu, sub.getName());
585-
// JMenuItem categoryItem = new JMenuItem(sub.getName());
586-
// categoryItem.setEnabled(false);
587-
// menu.add(categoryItem);
588-
base.addSketches(menu, sub, replace);
589-
menu.addSeparator();
590-
}
591-
592-
// if (coreLibraries == null) {
593-
// rebuildLibraryList();
594-
// }
595-
596-
// get library examples
597-
Base.addDisabledItem(menu, "Libraries");
598-
for (Library lib : coreLibraries) {
599-
if (lib.hasExamples()) {
600-
JMenu libMenu = new JMenu(lib.getName());
601-
base.addSketches(libMenu, lib.getExamplesFolder(), replace);
602-
menu.add(libMenu);
603-
}
604-
}
605-
606-
// get contrib library examples
607-
boolean any = false;
608-
for (Library lib : contribLibraries) {
609-
if (lib.hasExamples()) {
610-
any = true;
611-
}
612-
}
613-
if (any) {
614-
menu.addSeparator();
615-
Base.addDisabledItem(menu, "Contributed");
616-
for (Library lib : contribLibraries) {
617-
if (lib.hasExamples()) {
618-
JMenu libMenu = new JMenu(lib.getName());
619-
base.addSketches(libMenu, lib.getExamplesFolder(), replace);
620-
menu.add(libMenu);
621-
}
622-
}
623-
}
624-
} catch (IOException e) {
625-
e.printStackTrace();
626-
}
627-
}
628-
*/
629-
630-
631562
/**
632563
* Override this to control the order of the first set of example folders
633564
* and how they appear in the examples window.

0 commit comments

Comments
 (0)