mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 10:00:42 +01:00
more work on android editor
This commit is contained in:
@@ -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