more work on android editor

This commit is contained in:
benfry
2011-01-22 18:54:52 +00:00
parent bb59356978
commit 62c810a093
4 changed files with 178 additions and 181 deletions

View File

@@ -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() {

View File

@@ -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;
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .