mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 13:49:18 +01:00
more work on android editor
This commit is contained in:
@@ -1561,51 +1561,6 @@ public class Base {
|
||||
// .................................................................
|
||||
|
||||
|
||||
static public void showReference(String filename) {
|
||||
File referenceFolder = Base.getContentFile("reference");
|
||||
File referenceFile = new File(referenceFolder, filename);
|
||||
openURL(referenceFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
static public void showReference() {
|
||||
showReference("index.html");
|
||||
}
|
||||
|
||||
|
||||
static public void showEnvironment() {
|
||||
showReference("environment" + File.separator + "index.html");
|
||||
}
|
||||
|
||||
|
||||
static public void showChanges() {
|
||||
openURL("http://wiki.processing.org/w/Changes");
|
||||
}
|
||||
|
||||
|
||||
static public void showFAQ() {
|
||||
openURL("http://wiki.processing.org/w/FAQ");
|
||||
}
|
||||
|
||||
|
||||
static public void showGettingStarted() {
|
||||
openURL("http://processing.org/learning/gettingstarted/");
|
||||
}
|
||||
|
||||
|
||||
static public void showPlatforms() {
|
||||
openURL("http://wiki.processing.org/w/Supported_Platforms");
|
||||
}
|
||||
|
||||
|
||||
static public void showTroubleshooting() {
|
||||
openURL("http://wiki.processing.org/w/Troubleshooting");
|
||||
}
|
||||
|
||||
|
||||
// .................................................................
|
||||
|
||||
|
||||
/**
|
||||
* "No cookie for you" type messages. Nothing fatal or all that
|
||||
* much of a bummer, but something to notify the user about.
|
||||
|
||||
@@ -910,122 +910,63 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
|
||||
|
||||
protected JMenu buildHelpMenu() {
|
||||
// To deal with a Mac OS X 10.5 bug, add an extra space after the name
|
||||
// so that the OS doesn't try to insert its slow help menu.
|
||||
JMenu menu = new JMenu("Help ");
|
||||
JMenuItem item;
|
||||
/*
|
||||
// testing internal web server to serve up docs from a zip file
|
||||
item = new JMenuItem("Web Server Test");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//WebServer ws = new WebServer();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
int port = WebServer.launch("/Users/fry/coconut/processing/build/shared/reference.zip");
|
||||
Base.openURL("http://127.0.0.1:" + port + "/reference/setup_.html");
|
||||
|
||||
/*
|
||||
// testing internal web server to serve up docs from a zip file
|
||||
item = new JMenuItem("Web Server Test");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//WebServer ws = new WebServer();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
int port = WebServer.launch("/Users/fry/coconut/processing/build/shared/reference.zip");
|
||||
Base.openURL("http://127.0.0.1:" + port + "/reference/setup_.html");
|
||||
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
*/
|
||||
|
||||
/*
|
||||
item = new JMenuItem("Browser Test");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//Base.openURL("http://processing.org/learning/gettingstarted/");
|
||||
//JFrame browserFrame = new JFrame("Browser");
|
||||
BrowserStartup bs = new BrowserStartup("jar:file:/Users/fry/coconut/processing/build/shared/reference.zip!/reference/setup_.html");
|
||||
bs.initUI();
|
||||
bs.launch();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
*/
|
||||
|
||||
item = new JMenuItem("Getting Started");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.showGettingStarted();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Environment");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.showEnvironment();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Troubleshooting");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.showTroubleshooting();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Reference");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.showReference();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = Base.newJMenuItemShift("Find in Reference", 'F');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (textarea.isSelectionActive()) {
|
||||
handleFindReference();
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Frequently Asked Questions");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.showFAQ();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = Base.newJMenuItem("Visit Processing.org", '5');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
// macosx already has its own about menu
|
||||
if (!Base.isMacOS()) {
|
||||
menu.addSeparator();
|
||||
item = new JMenuItem("About Processing");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.handleAbout();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
*/
|
||||
|
||||
return menu;
|
||||
/*
|
||||
item = new JMenuItem("Browser Test");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//Base.openURL("http://processing.org/learning/gettingstarted/");
|
||||
//JFrame browserFrame = new JFrame("Browser");
|
||||
BrowserStartup bs = new BrowserStartup("jar:file:/Users/fry/coconut/processing/build/shared/reference.zip!/reference/setup_.html");
|
||||
bs.initUI();
|
||||
bs.launch();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
*/
|
||||
|
||||
|
||||
abstract public JMenu buildHelpMenu();
|
||||
|
||||
|
||||
public void showReference(String filename) {
|
||||
File referenceFolder = Base.getContentFile("reference");
|
||||
File referenceFile = new File(referenceFolder, filename);
|
||||
Base.openURL(referenceFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
public void showChanges() {
|
||||
Base.openURL("http://wiki.processing.org/w/Changes");
|
||||
}
|
||||
|
||||
|
||||
// static public void showPlatforms() {
|
||||
// openURL("http://wiki.processing.org/w/Supported_Platforms");
|
||||
// }
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
|
||||
@@ -128,16 +128,6 @@ public class AndroidEditor extends JavaEditor implements DeviceListener {
|
||||
JMenu menu = new JMenu("Android");
|
||||
JMenuItem item;
|
||||
|
||||
item = new JMenuItem("Guide");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://wiki.processing.org/w/Android");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
item = new JMenuItem("Sketch Permissions");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -178,27 +168,58 @@ public class AndroidEditor extends JavaEditor implements DeviceListener {
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
protected void updateMode() {
|
||||
// When the selection is made, the menu will update itself
|
||||
boolean active = toggleItem.isSelected();
|
||||
if (active) {
|
||||
boolean rolling = true;
|
||||
if (sdk == null) {
|
||||
rolling = loadAndroid();
|
||||
|
||||
/**
|
||||
* Uses the main help menu, and adds a few extra options. If/when there's
|
||||
* Android-specific documentation, we'll switch to that.
|
||||
*/
|
||||
public JMenu buildHelpMenu() {
|
||||
JMenu menu = super.buildHelpMenu();
|
||||
JMenuItem item;
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
item = new JMenuItem("Processing for Android Wiki");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://wiki.processing.org/w/Android");
|
||||
}
|
||||
if (rolling) {
|
||||
editor.setHandlers(new RunHandler(), new PresentHandler(),
|
||||
new StopHandler(),
|
||||
new ExportHandler(), new ExportAppHandler());
|
||||
build = new AndroidBuild(editor, sdk);
|
||||
editor.statusNotice("Android mode enabled for this editor window.");
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
|
||||
item = new JMenuItem("Android Developers Site");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://developer.android.com/index.html");
|
||||
}
|
||||
} else {
|
||||
editor.resetHandlers();
|
||||
editor.statusNotice("Android mode disabled.");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
// protected void updateMode() {
|
||||
// // When the selection is made, the menu will update itself
|
||||
// boolean active = toggleItem.isSelected();
|
||||
// if (active) {
|
||||
// boolean rolling = true;
|
||||
// if (sdk == null) {
|
||||
// rolling = loadAndroid();
|
||||
// }
|
||||
// if (rolling) {
|
||||
// editor.setHandlers(new RunHandler(), new PresentHandler(),
|
||||
// new StopHandler(),
|
||||
// new ExportHandler(), new ExportAppHandler());
|
||||
// build = new AndroidBuild(editor, sdk);
|
||||
// editor.statusNotice("Android mode enabled for this editor window.");
|
||||
// }
|
||||
// } else {
|
||||
// editor.resetHandlers();
|
||||
// editor.statusNotice("Android mode disabled.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
protected boolean loadAndroid() {
|
||||
|
||||
@@ -101,6 +101,86 @@ public class JavaEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
public JMenu buildHelpMenu() {
|
||||
// To deal with a Mac OS X 10.5 bug, add an extra space after the name
|
||||
// so that the OS doesn't try to insert its slow help menu.
|
||||
JMenu menu = new JMenu("Help ");
|
||||
JMenuItem item;
|
||||
|
||||
item = new JMenuItem("Getting Started");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/learning/gettingstarted/");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Environment");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showReference("environment" + File.separator + "index.html");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Troubleshooting");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://wiki.processing.org/w/Troubleshooting");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Reference");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showReference("index.html");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = Base.newJMenuItemShift("Find in Reference", 'F');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (textarea.isSelectionActive()) {
|
||||
handleFindReference();
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Frequently Asked Questions");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://wiki.processing.org/w/FAQ");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
item = new JMenuItem("Visit Processing.org");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openURL("http://processing.org/");
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
// macosx already has its own about menu
|
||||
if (!Base.isMacOS()) {
|
||||
menu.addSeparator();
|
||||
item = new JMenuItem("About Processing");
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.handleAbout();
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user