| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,12 @@ | |||
| 35 | 35 | import javax.swing.tree.*; | |
| 36 | 36 | ||
| 37 | 37 | import processing.app.contrib.Contribution; | |
| 38 | + import processing.app.contrib.ContributionListing; | ||
| 39 | + import processing.app.contrib.ContributionManager; | ||
| 40 | + import processing.app.contrib.ContributionManagerDialog; | ||
| 38 | 41 | import processing.app.contrib.InstalledContribution; | |
| 42 | + import processing.app.contrib.ModeContribution; | ||
| 43 | + import processing.app.contrib.ToolContribution; | ||
| 39 | 44 | import processing.core.*; | |
| 40 | 45 | ||
| 41 | 46 | /** | |
@@ -94,11 +99,8 @@ public class Base { | |||
| 94 | 99 | ||
| 95 | 100 | // A single instance of the library manager window | |
| 96 | 101 | ContributionManagerDialog libraryManagerFrame; | |
| 97 | - | ||
| 98 | 102 | ContributionManagerDialog toolManagerFrame; | |
| 99 | - | ||
| 100 | 103 | ContributionManagerDialog modeManagerFrame; | |
| 101 | - | ||
| 102 | 104 | ContributionManagerDialog updateManagerFrame; | |
| 103 | 105 | ||
| 104 | 106 | // set to true after the first time the menu is built. | |
@@ -116,7 +118,7 @@ public class Base { | |||
| 116 | 118 | ||
| 117 | 119 | private Mode defaultMode; | |
| 118 | 120 | private Mode[] coreModes; | |
| 119 | - List<ModeContribution> contribModes; | ||
| 121 | + public List<ModeContribution> contribModes; | ||
| 120 | 122 | ||
| 121 | 123 | private JMenu sketchbookMenu; | |
| 122 | 124 | ||
@@ -320,15 +322,15 @@ public static void initRequirements() { | |||
| 320 | 322 | ||
| 321 | 323 | ||
| 322 | 324 | private void buildCoreModes() { | |
| 323 | - defaultMode = ModeContribution | ||
| 324 | - .getCoreMode(this, "processing.mode.java.JavaMode", | ||
| 325 | - getContentFile("modes/java")); | ||
| 326 | - Mode androidMode = ModeContribution | ||
| 327 | - .getCoreMode(this, "processing.mode.android.AndroidMode", | ||
| 328 | - getContentFile("modes/android")); | ||
| 329 | - Mode javaScriptMode = ModeContribution | ||
| 330 | - .getCoreMode(this, "processing.mode.javascript.JavaScriptMode", | ||
| 331 | - getContentFile("modes/javascript")); | ||
| 325 | + defaultMode = | ||
| 326 | + ModeContribution.getCoreMode(this, "processing.mode.java.JavaMode", | ||
| 327 | + getContentFile("modes/java")); | ||
| 328 | + Mode androidMode = | ||
| 329 | + ModeContribution.getCoreMode(this, "processing.mode.android.AndroidMode", | ||
| 330 | + getContentFile("modes/android")); | ||
| 331 | + Mode javaScriptMode = | ||
| 332 | + ModeContribution.getCoreMode(this, "processing.mode.javascript.JavaScriptMode", | ||
| 333 | + getContentFile("modes/javascript")); | ||
| 332 | 334 | ||
| 333 | 335 | coreModes = new Mode[] { defaultMode, androidMode, javaScriptMode }; | |
| 334 | 336 | } | |
@@ -340,8 +342,8 @@ void rebuildContribModes() { | |||
| 340 | 342 | if (contribModes == null) | |
| 341 | 343 | contribModes = new ArrayList<ModeContribution>(); | |
| 342 | 344 | ||
| 343 | - ArrayList<ModeContribution> newContribs = ModeContribution | ||
| 344 | - .list(this, getSketchbookModesFolder()); | ||
| 345 | + ArrayList<ModeContribution> newContribs = | ||
| 346 | + ModeContribution.list(this, getSketchbookModesFolder()); | ||
| 345 | 347 | for (ModeContribution contrib : newContribs) { | |
| 346 | 348 | if (!contribModes.contains(contrib)) { | |
| 347 | 349 | if (contrib.instantiateModeClass()) { | |
@@ -626,7 +628,7 @@ public void storeSketch(Editor editor) { | |||
| 626 | 628 | static final int SHORTCUT_KEY_MASK = | |
| 627 | 629 | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); | |
| 628 | 630 | /** Command-W on Mac OS X, Ctrl-W on Windows and Linux */ | |
| 629 | - static final KeyStroke WINDOW_CLOSE_KEYSTROKE = | ||
| 631 | + public static final KeyStroke WINDOW_CLOSE_KEYSTROKE = | ||
| 630 | 632 | KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK); | |
| 631 | 633 | /** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */ | |
| 632 | 634 | static final int SHORTCUT_ALT_KEY_MASK = ActionEvent.ALT_MASK | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | 23 | package processing.app; | |
| 24 | 24 | ||
| 25 | + import processing.app.contrib.ToolContribution; | ||
| 25 | 26 | import processing.app.syntax.*; | |
| 26 | 27 | import processing.app.tools.*; | |
| 27 | 28 | import processing.core.*; | |
@@ -106,7 +107,7 @@ public abstract class Editor extends JFrame implements RunnerListener { | |||
| 106 | 107 | JMenu modeMenu; | |
| 107 | 108 | ||
| 108 | 109 | ArrayList<ToolContribution> coreTools; | |
| 109 | - ArrayList<ToolContribution> contribTools; | ||
| 110 | + public ArrayList<ToolContribution> contribTools; | ||
| 110 | 111 | ||
| 111 | 112 | protected Editor(final Base base, String path, int[] location, final Mode mode) { | |
| 112 | 113 | super("Processing"); | |
@@ -872,7 +873,7 @@ protected void rebuildToolList() { | |||
| 872 | 873 | } | |
| 873 | 874 | ||
| 874 | 875 | ||
| 875 | - protected void rebuildToolMenu() { | ||
| 876 | + public void rebuildToolMenu() { | ||
| 876 | 877 | if (toolsMenu == null) { | |
| 877 | 878 | toolsMenu = new JMenu("Tools"); | |
| 878 | 879 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ public class Library extends InstalledContribution { | |||
| 35 | 35 | */ | |
| 36 | 36 | String nativeLibraryPath; | |
| 37 | 37 | ||
| 38 | - static String propertiesFileName = "library.properties"; | ||
| 38 | + static public final String propertiesFileName = "library.properties"; | ||
| 39 | 39 | ||
| 40 | 40 | /** Filter to pull out just files and no directories, and to skip export.txt */ | |
| 41 | 41 | static FilenameFilter standardFilter = new FilenameFilter() { | |
@@ -371,13 +371,13 @@ public boolean accept(File dir, String name) { | |||
| 371 | 371 | } | |
| 372 | 372 | }; | |
| 373 | 373 | ||
| 374 | - static protected ArrayList<File> discover(File folder) { | ||
| 374 | + public static ArrayList<File> discover(File folder) { | ||
| 375 | 375 | ArrayList<File> libraries = new ArrayList<File>(); | |
| 376 | 376 | discover(folder, libraries); | |
| 377 | 377 | return libraries; | |
| 378 | 378 | } | |
| 379 | 379 | ||
| 380 | - static protected void discover(File folder, ArrayList<File> libraries) { | ||
| 380 | + static public void discover(File folder, ArrayList<File> libraries) { | ||
| 381 | 381 | String[] list = folder.list(junkFolderFilter); | |
| 382 | 382 | ||
| 383 | 383 | // if a bad folder or something like that, this might come back null | |
@@ -445,5 +445,4 @@ static protected void list(File folder, ArrayList<Library> libraries) { | |||
| 445 | 445 | public Type getType() { | |
| 446 | 446 | return Type.LIBRARY; | |
| 447 | 447 | } | |
| 448 | - | ||
| 449 | 448 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,8 +42,8 @@ public abstract class Mode { | |||
| 42 | 42 | protected File librariesFolder; | |
| 43 | 43 | protected File referenceFolder; | |
| 44 | 44 | ||
| 45 | - protected ArrayList<Library> coreLibraries; | ||
| 46 | - protected ArrayList<Library> contribLibraries; | ||
| 45 | + public ArrayList<Library> coreLibraries; | ||
| 46 | + public ArrayList<Library> contribLibraries; | ||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | 49 | public Mode(Base base, File folder) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,12 +123,9 @@ public void updateCheck() throws Exception { | |||
| 123 | 123 | // Wait for xml file to be downloaded and updates to come in. (this | |
| 124 | 124 | // should really be handled better). | |
| 125 | 125 | Thread.sleep(5 * 1000); | |
| 126 | - if (!base.libraryManagerFrame.hasAlreadyBeenOpened() | ||
| 127 | - && base.libraryManagerFrame.contribListing.hasUpdates() | ||
| 128 | - || !base.toolManagerFrame.hasAlreadyBeenOpened() | ||
| 129 | - && base.toolManagerFrame.contribListing.hasUpdates() | ||
| 130 | - || !base.modeManagerFrame.hasAlreadyBeenOpened() | ||
| 131 | - && base.modeManagerFrame.contribListing.hasUpdates()) { | ||
| 126 | + if (!base.libraryManagerFrame.hasAlreadyBeenOpened() && base.libraryManagerFrame.hasUpdates() || | ||
| 127 | + !base.toolManagerFrame.hasAlreadyBeenOpened() && base.toolManagerFrame.hasUpdates() || | ||
| 128 | + !base.modeManagerFrame.hasAlreadyBeenOpened() && base.modeManagerFrame.hasUpdates()) { | ||
| 132 | 129 | promptToOpenContributionManager(); | |
| 133 | 130 | } | |
| 134 | 131 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,7 +20,7 @@ | |||
| 20 | 20 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | 21 | */ | |
| 22 | 22 | ||
| 23 | - package processing.app; | ||
| 23 | + package processing.app.contrib; | ||
| 24 | 24 | ||
| 25 | 25 | import java.util.*; | |
| 26 | 26 | import java.util.List; | |
@@ -39,9 +39,9 @@ | |||
| 39 | 39 | import java.io.File; | |
| 40 | 40 | import java.net.*; | |
| 41 | 41 | ||
| 42 | - import processing.app.ContributionListing.AdvertisedContribution; | ||
| 43 | - import processing.app.ContributionListing.ContributionChangeListener; | ||
| 44 | - import processing.app.contrib.*; | ||
| 42 | + import processing.app.Base; | ||
| 43 | + import processing.app.contrib.ContributionListing.AdvertisedContribution; | ||
| 44 | + import processing.app.contrib.ContributionListing.ContributionChangeListener; | ||
| 45 | 45 | ||
| 46 | 46 | public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener { | |
| 47 | 47 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,15 +21,14 @@ | |||
| 21 | 21 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | 22 | */ | |
| 23 | 23 | ||
| 24 | - package processing.app; | ||
| 24 | + package processing.app.contrib; | ||
| 25 | 25 | ||
| 26 | 26 | import java.io.*; | |
| 27 | 27 | import java.net.*; | |
| 28 | 28 | import java.util.*; | |
| 29 | 29 | import java.util.concurrent.locks.ReentrantLock; | |
| 30 | 30 | ||
| 31 | - import processing.app.contrib.*; | ||
| 32 | - import processing.app.contrib.Contribution.Type; | ||
| 31 | + import processing.app.Base; | ||
| 33 | 32 | import processing.core.PApplet; | |
| 34 | 33 | ||
| 35 | 34 | public class ContributionListing { | |
@@ -468,7 +467,7 @@ public ArrayList<AdvertisedContribution> getLibraries(File f) { | |||
| 468 | 467 | HashMap<String,String> exports = new HashMap<String,String>(); | |
| 469 | 468 | Base.readSettings(null, strings, exports); | |
| 470 | 469 | ||
| 471 | - Type kind = Contribution.Type.toType(type); | ||
| 470 | + Contribution.Type kind = Contribution.Type.toType(type); | ||
| 472 | 471 | outgoing.add(new AdvertisedContribution(kind, exports)); | |
| 473 | 472 | ||
| 474 | 473 | start = end + 1; | |
@@ -563,7 +562,7 @@ public boolean isDownloadingListing() { | |||
| 563 | 562 | return downloadingListingLock.isLocked(); | |
| 564 | 563 | } | |
| 565 | 564 | ||
| 566 | - static interface Filter { | ||
| 565 | + public static interface Filter { | ||
| 567 | 566 | ||
| 568 | 567 | boolean matches(Contribution contrib); | |
| 569 | 568 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - package processing.app; | ||
| 1 | + package processing.app.contrib; | ||
| 2 | 2 | ||
| 3 | 3 | import java.io.*; | |
| 4 | 4 | import java.net.URL; | |
@@ -8,9 +8,12 @@ | |||
| 8 | 8 | ||
| 9 | 9 | import javax.swing.JOptionPane; | |
| 10 | 10 | ||
| 11 | - import processing.app.ContributionListing.AdvertisedContribution; | ||
| 12 | - import processing.app.contrib.*; | ||
| 11 | + import processing.app.Base; | ||
| 12 | + import processing.app.Editor; | ||
| 13 | + import processing.app.Library; | ||
| 14 | + import processing.app.Preferences; | ||
| 13 | 15 | import processing.app.contrib.Contribution.Type; | |
| 16 | + import processing.app.contrib.ContributionListing.AdvertisedContribution; | ||
| 14 | 17 | ||
| 15 | 18 | interface ErrorWidget { | |
| 16 | 19 | void setErrorMessage(String msg); | |
@@ -137,7 +140,7 @@ static public void refreshInstalled(Editor editor) { | |||
| 137 | 140 | editor.rebuildToolMenu(); | |
| 138 | 141 | } | |
| 139 | 142 | ||
| 140 | - static ArrayList<File> discover(Type type, File tempDir) { | ||
| 143 | + static ArrayList<File> discover(Contribution.Type type, File tempDir) { | ||
| 141 | 144 | switch (type) { | |
| 142 | 145 | case LIBRARY: | |
| 143 | 146 | return Library.discover(tempDir); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | 22 | */ | |
| 23 | 23 | ||
| 24 | - package processing.app; | ||
| 24 | + package processing.app.contrib; | ||
| 25 | 25 | ||
| 26 | 26 | import java.awt.*; | |
| 27 | 27 | import java.awt.event.*; | |
@@ -31,36 +31,30 @@ | |||
| 31 | 31 | import javax.swing.*; | |
| 32 | 32 | import javax.swing.event.*; | |
| 33 | 33 | ||
| 34 | - import processing.app.ContributionListing.Filter; | ||
| 35 | - import processing.app.contrib.*; | ||
| 34 | + import processing.app.Base; | ||
| 35 | + import processing.app.Editor; | ||
| 36 | + import processing.app.Library; | ||
| 37 | + import processing.app.contrib.ContributionListing.Filter; | ||
| 36 | 38 | ||
| 37 | 39 | public class ContributionManagerDialog { | |
| 38 | 40 | ||
| 39 | 41 | static final String ANY_CATEGORY = "All"; | |
| 40 | 42 | ||
| 41 | 43 | JFrame dialog; | |
| 42 | - | ||
| 43 | 44 | String title; | |
| 44 | - | ||
| 45 | 45 | Filter permaFilter; | |
| 46 | - | ||
| 47 | 46 | JComboBox categoryChooser; | |
| 48 | - | ||
| 49 | 47 | JScrollPane scrollPane; | |
| 50 | - | ||
| 51 | 48 | ContributionListPanel contributionListPanel; | |
| 52 | - | ||
| 53 | 49 | StatusPanel statusBar; | |
| 54 | - | ||
| 55 | 50 | FilterField filterField; | |
| 56 | 51 | ||
| 57 | 52 | // the calling editor, so updates can be applied | |
| 58 | 53 | Editor editor; | |
| 59 | - | ||
| 60 | 54 | String category; | |
| 61 | - | ||
| 62 | 55 | ContributionListing contribListing; | |
| 63 | 56 | ||
| 57 | + | ||
| 64 | 58 | public ContributionManagerDialog(String title, | |
| 65 | 59 | ContributionListing.Filter filter) { | |
| 66 | 60 | ||
@@ -73,7 +67,13 @@ public ContributionManagerDialog(String title, | |||
| 73 | 67 | contribListing.addContributionListener(contributionListPanel); | |
| 74 | 68 | } | |
| 75 | 69 | ||
| 76 | - protected void showFrame(Editor editor) { | ||
| 70 | + | ||
| 71 | + public boolean hasUpdates() { | ||
| 72 | + return contribListing.hasUpdates(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + public void showFrame(Editor editor) { | ||
| 77 | 77 | this.editor = editor; | |
| 78 | 78 | ||
| 79 | 79 | if (dialog == null) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | 22 | */ | |
| 23 | 23 | ||
| 24 | - package processing.app; | ||
| 24 | + package processing.app.contrib; | ||
| 25 | 25 | ||
| 26 | 26 | import java.io.File; | |
| 27 | 27 | import java.io.FileNotFoundException; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments