mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
moving packages around, changing some visibility to make it work
This commit is contained in:
@@ -35,7 +35,12 @@ import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
|
||||
import processing.app.contrib.Contribution;
|
||||
import processing.app.contrib.ContributionListing;
|
||||
import processing.app.contrib.ContributionManager;
|
||||
import processing.app.contrib.ContributionManagerDialog;
|
||||
import processing.app.contrib.InstalledContribution;
|
||||
import processing.app.contrib.ModeContribution;
|
||||
import processing.app.contrib.ToolContribution;
|
||||
import processing.core.*;
|
||||
|
||||
/**
|
||||
@@ -94,11 +99,8 @@ public class Base {
|
||||
|
||||
// A single instance of the library manager window
|
||||
ContributionManagerDialog libraryManagerFrame;
|
||||
|
||||
ContributionManagerDialog toolManagerFrame;
|
||||
|
||||
ContributionManagerDialog modeManagerFrame;
|
||||
|
||||
ContributionManagerDialog updateManagerFrame;
|
||||
|
||||
// set to true after the first time the menu is built.
|
||||
@@ -116,7 +118,7 @@ public class Base {
|
||||
|
||||
private Mode defaultMode;
|
||||
private Mode[] coreModes;
|
||||
List<ModeContribution> contribModes;
|
||||
public List<ModeContribution> contribModes;
|
||||
|
||||
private JMenu sketchbookMenu;
|
||||
|
||||
@@ -320,15 +322,15 @@ public class Base {
|
||||
|
||||
|
||||
private void buildCoreModes() {
|
||||
defaultMode = ModeContribution
|
||||
.getCoreMode(this, "processing.mode.java.JavaMode",
|
||||
getContentFile("modes/java"));
|
||||
Mode androidMode = ModeContribution
|
||||
.getCoreMode(this, "processing.mode.android.AndroidMode",
|
||||
getContentFile("modes/android"));
|
||||
Mode javaScriptMode = ModeContribution
|
||||
.getCoreMode(this, "processing.mode.javascript.JavaScriptMode",
|
||||
getContentFile("modes/javascript"));
|
||||
defaultMode =
|
||||
ModeContribution.getCoreMode(this, "processing.mode.java.JavaMode",
|
||||
getContentFile("modes/java"));
|
||||
Mode androidMode =
|
||||
ModeContribution.getCoreMode(this, "processing.mode.android.AndroidMode",
|
||||
getContentFile("modes/android"));
|
||||
Mode javaScriptMode =
|
||||
ModeContribution.getCoreMode(this, "processing.mode.javascript.JavaScriptMode",
|
||||
getContentFile("modes/javascript"));
|
||||
|
||||
coreModes = new Mode[] { defaultMode, androidMode, javaScriptMode };
|
||||
}
|
||||
@@ -340,8 +342,8 @@ public class Base {
|
||||
if (contribModes == null)
|
||||
contribModes = new ArrayList<ModeContribution>();
|
||||
|
||||
ArrayList<ModeContribution> newContribs = ModeContribution
|
||||
.list(this, getSketchbookModesFolder());
|
||||
ArrayList<ModeContribution> newContribs =
|
||||
ModeContribution.list(this, getSketchbookModesFolder());
|
||||
for (ModeContribution contrib : newContribs) {
|
||||
if (!contribModes.contains(contrib)) {
|
||||
if (contrib.instantiateModeClass()) {
|
||||
@@ -626,7 +628,7 @@ public class Base {
|
||||
static final int SHORTCUT_KEY_MASK =
|
||||
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
/** Command-W on Mac OS X, Ctrl-W on Windows and Linux */
|
||||
static final KeyStroke WINDOW_CLOSE_KEYSTROKE =
|
||||
public static final KeyStroke WINDOW_CLOSE_KEYSTROKE =
|
||||
KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK);
|
||||
/** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */
|
||||
static final int SHORTCUT_ALT_KEY_MASK = ActionEvent.ALT_MASK |
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
package processing.app;
|
||||
|
||||
import processing.app.contrib.ToolContribution;
|
||||
import processing.app.syntax.*;
|
||||
import processing.app.tools.*;
|
||||
import processing.core.*;
|
||||
@@ -106,7 +107,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
JMenu modeMenu;
|
||||
|
||||
ArrayList<ToolContribution> coreTools;
|
||||
ArrayList<ToolContribution> contribTools;
|
||||
public ArrayList<ToolContribution> contribTools;
|
||||
|
||||
protected Editor(final Base base, String path, int[] location, final Mode mode) {
|
||||
super("Processing");
|
||||
@@ -872,7 +873,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
|
||||
|
||||
protected void rebuildToolMenu() {
|
||||
public void rebuildToolMenu() {
|
||||
if (toolsMenu == null) {
|
||||
toolsMenu = new JMenu("Tools");
|
||||
} else {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Library extends InstalledContribution {
|
||||
*/
|
||||
String nativeLibraryPath;
|
||||
|
||||
static String propertiesFileName = "library.properties";
|
||||
static public final String propertiesFileName = "library.properties";
|
||||
|
||||
/** Filter to pull out just files and no directories, and to skip export.txt */
|
||||
static FilenameFilter standardFilter = new FilenameFilter() {
|
||||
@@ -371,13 +371,13 @@ public class Library extends InstalledContribution {
|
||||
}
|
||||
};
|
||||
|
||||
static protected ArrayList<File> discover(File folder) {
|
||||
public static ArrayList<File> discover(File folder) {
|
||||
ArrayList<File> libraries = new ArrayList<File>();
|
||||
discover(folder, libraries);
|
||||
return libraries;
|
||||
}
|
||||
|
||||
static protected void discover(File folder, ArrayList<File> libraries) {
|
||||
static public void discover(File folder, ArrayList<File> libraries) {
|
||||
String[] list = folder.list(junkFolderFilter);
|
||||
|
||||
// if a bad folder or something like that, this might come back null
|
||||
@@ -445,5 +445,4 @@ public class Library extends InstalledContribution {
|
||||
public Type getType() {
|
||||
return Type.LIBRARY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public abstract class Mode {
|
||||
protected File librariesFolder;
|
||||
protected File referenceFolder;
|
||||
|
||||
protected ArrayList<Library> coreLibraries;
|
||||
protected ArrayList<Library> contribLibraries;
|
||||
public ArrayList<Library> coreLibraries;
|
||||
public ArrayList<Library> contribLibraries;
|
||||
|
||||
|
||||
public Mode(Base base, File folder) {
|
||||
|
||||
@@ -123,12 +123,9 @@ public class UpdateCheck {
|
||||
// Wait for xml file to be downloaded and updates to come in. (this
|
||||
// should really be handled better).
|
||||
Thread.sleep(5 * 1000);
|
||||
if (!base.libraryManagerFrame.hasAlreadyBeenOpened()
|
||||
&& base.libraryManagerFrame.contribListing.hasUpdates()
|
||||
|| !base.toolManagerFrame.hasAlreadyBeenOpened()
|
||||
&& base.toolManagerFrame.contribListing.hasUpdates()
|
||||
|| !base.modeManagerFrame.hasAlreadyBeenOpened()
|
||||
&& base.modeManagerFrame.contribListing.hasUpdates()) {
|
||||
if (!base.libraryManagerFrame.hasAlreadyBeenOpened() && base.libraryManagerFrame.hasUpdates() ||
|
||||
!base.toolManagerFrame.hasAlreadyBeenOpened() && base.toolManagerFrame.hasUpdates() ||
|
||||
!base.modeManagerFrame.hasAlreadyBeenOpened() && base.modeManagerFrame.hasUpdates()) {
|
||||
promptToOpenContributionManager();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
@@ -39,9 +39,9 @@ import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.net.*;
|
||||
|
||||
import processing.app.ContributionListing.AdvertisedContribution;
|
||||
import processing.app.ContributionListing.ContributionChangeListener;
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.Base;
|
||||
import processing.app.contrib.ContributionListing.AdvertisedContribution;
|
||||
import processing.app.contrib.ContributionListing.ContributionChangeListener;
|
||||
|
||||
public class ContributionListPanel extends JPanel implements Scrollable, ContributionChangeListener {
|
||||
|
||||
+4
-5
@@ -21,15 +21,14 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.contrib.Contribution.Type;
|
||||
import processing.app.Base;
|
||||
import processing.core.PApplet;
|
||||
|
||||
public class ContributionListing {
|
||||
@@ -468,7 +467,7 @@ public class ContributionListing {
|
||||
HashMap<String,String> exports = new HashMap<String,String>();
|
||||
Base.readSettings(null, strings, exports);
|
||||
|
||||
Type kind = Contribution.Type.toType(type);
|
||||
Contribution.Type kind = Contribution.Type.toType(type);
|
||||
outgoing.add(new AdvertisedContribution(kind, exports));
|
||||
|
||||
start = end + 1;
|
||||
@@ -563,7 +562,7 @@ public class ContributionListing {
|
||||
return downloadingListingLock.isLocked();
|
||||
}
|
||||
|
||||
static interface Filter {
|
||||
public static interface Filter {
|
||||
|
||||
boolean matches(Contribution contrib);
|
||||
}
|
||||
+7
-4
@@ -1,4 +1,4 @@
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
@@ -8,9 +8,12 @@ import java.util.zip.*;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import processing.app.ContributionListing.AdvertisedContribution;
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.Base;
|
||||
import processing.app.Editor;
|
||||
import processing.app.Library;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.contrib.Contribution.Type;
|
||||
import processing.app.contrib.ContributionListing.AdvertisedContribution;
|
||||
|
||||
interface ErrorWidget {
|
||||
void setErrorMessage(String msg);
|
||||
@@ -137,7 +140,7 @@ public class ContributionManager {
|
||||
editor.rebuildToolMenu();
|
||||
}
|
||||
|
||||
static ArrayList<File> discover(Type type, File tempDir) {
|
||||
static ArrayList<File> discover(Contribution.Type type, File tempDir) {
|
||||
switch (type) {
|
||||
case LIBRARY:
|
||||
return Library.discover(tempDir);
|
||||
+13
-13
@@ -21,7 +21,7 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
@@ -31,36 +31,30 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import processing.app.ContributionListing.Filter;
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.Base;
|
||||
import processing.app.Editor;
|
||||
import processing.app.Library;
|
||||
import processing.app.contrib.ContributionListing.Filter;
|
||||
|
||||
public class ContributionManagerDialog {
|
||||
|
||||
static final String ANY_CATEGORY = "All";
|
||||
|
||||
JFrame dialog;
|
||||
|
||||
String title;
|
||||
|
||||
Filter permaFilter;
|
||||
|
||||
JComboBox categoryChooser;
|
||||
|
||||
JScrollPane scrollPane;
|
||||
|
||||
ContributionListPanel contributionListPanel;
|
||||
|
||||
StatusPanel statusBar;
|
||||
|
||||
FilterField filterField;
|
||||
|
||||
// the calling editor, so updates can be applied
|
||||
Editor editor;
|
||||
|
||||
String category;
|
||||
|
||||
ContributionListing contribListing;
|
||||
|
||||
|
||||
public ContributionManagerDialog(String title,
|
||||
ContributionListing.Filter filter) {
|
||||
|
||||
@@ -73,7 +67,13 @@ public class ContributionManagerDialog {
|
||||
contribListing.addContributionListener(contributionListPanel);
|
||||
}
|
||||
|
||||
protected void showFrame(Editor editor) {
|
||||
|
||||
public boolean hasUpdates() {
|
||||
return contribListing.hasUpdates();
|
||||
}
|
||||
|
||||
|
||||
public void showFrame(Editor editor) {
|
||||
this.editor = editor;
|
||||
|
||||
if (dialog == null) {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
+6
-6
@@ -1,18 +1,17 @@
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.Library;
|
||||
|
||||
|
||||
public class LibraryCompilation extends InstalledContribution {
|
||||
|
||||
ArrayList<Library> libraries;
|
||||
|
||||
static String propertiesFileName = "compilation.properties";
|
||||
|
||||
private LibraryCompilation(File folder) throws IOException {
|
||||
|
||||
|
||||
private LibraryCompilation(File folder) throws IOException {
|
||||
super(folder, LibraryCompilation.propertiesFileName);
|
||||
|
||||
libraries = new ArrayList<Library>();
|
||||
@@ -24,6 +23,7 @@ public class LibraryCompilation extends InstalledContribution {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<LibraryCompilation> list(ArrayList<Library> libraries) {
|
||||
HashMap<String, File> folderByGroup = new HashMap<String, File>();
|
||||
|
||||
+4
-3
@@ -20,7 +20,7 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
@@ -31,7 +31,8 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import processing.app.contrib.InstalledContribution;
|
||||
import processing.app.Base;
|
||||
import processing.app.Mode;
|
||||
|
||||
public class ModeContribution extends InstalledContribution {
|
||||
|
||||
@@ -137,7 +138,7 @@ public class ModeContribution extends InstalledContribution {
|
||||
return loader.equals(other.loader) && className.equals(other.className);
|
||||
}
|
||||
|
||||
static protected ArrayList<ModeContribution> list(Base base, File folder) {
|
||||
static public ArrayList<ModeContribution> list(Base base, File folder) {
|
||||
ArrayList<ModeContribution> modes = new ArrayList<ModeContribution>();
|
||||
ArrayList<File> modeFolders = discover(folder);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
/**
|
||||
* The ProgressMonitor interface should be implemented by objects that observe
|
||||
+4
-3
@@ -20,16 +20,17 @@
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app;
|
||||
package processing.app.contrib;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
|
||||
import processing.app.contrib.*;
|
||||
import processing.app.Editor;
|
||||
import processing.app.tools.Tool;
|
||||
|
||||
|
||||
public class ToolContribution extends InstalledContribution implements Tool {
|
||||
|
||||
String className;
|
||||
@@ -159,7 +160,7 @@ public class ToolContribution extends InstalledContribution implements Tool {
|
||||
* Tools that failed to initialize for whatever reason are not
|
||||
* returned
|
||||
*/
|
||||
static protected ArrayList<ToolContribution> list(File folder, boolean doInitializeToolClass) {
|
||||
public static ArrayList<ToolContribution> list(File folder, boolean doInitializeToolClass) {
|
||||
ArrayList<File> toolsFolders = ToolContribution.discover(folder);
|
||||
|
||||
ArrayList<ToolContribution> tools = new ArrayList<ToolContribution>();
|
||||
Reference in New Issue
Block a user