diff --git a/mode/languages/mode.properties b/mode/languages/mode.properties index 4c52f753..867b8b78 100644 --- a/mode/languages/mode.properties +++ b/mode/languages/mode.properties @@ -11,10 +11,22 @@ # | File | Edit | Sketch | Android | Tools | Help | # | File | +menu.sketch.stop = Stop +menu.file.new = New +menu.file.open = Open +menu.file.save = Save + menu.file.export_signed_package = Export Signed Package menu.file.export_signed_bundle = Export Signed Bundle menu.file.export_android_project = Export Android Project + +# | File | Edit | Sketch | Android | Tools | Help | +# | Sketch | + +menu.sketch.run_on_device = Run on Device +menu.sketch.run_in_emulator = Run in Emulator + # | File | Edit | Sketch | Android | Tools | Help | # | Android | diff --git a/mode/src/processing/mode/android/AndroidEditor.java b/mode/src/processing/mode/android/AndroidEditor.java index 99c92a78..ba55227f 100644 --- a/mode/src/processing/mode/android/AndroidEditor.java +++ b/mode/src/processing/mode/android/AndroidEditor.java @@ -123,8 +123,8 @@ public boolean handleSaveAs() { public JMenu buildFileMenu() { - String exportPackageTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PACKAGE, true); - JMenuItem exportPackage = Toolkit.newJMenuItem(exportPackageTitle, 'K'); + String exportPackageTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PACKAGE); + JMenuItem exportPackage = Toolkit.newJMenuItemExt(exportPackageTitle); exportPackage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleExportPackage(); @@ -132,7 +132,7 @@ public void actionPerformed(ActionEvent e) { }); - String exportBundleTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_BUNDLE, false); + String exportBundleTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_BUNDLE); JMenuItem exportBundle = Toolkit.newJMenuItem(exportBundleTitle, 'B'); exportBundle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -141,7 +141,7 @@ public void actionPerformed(ActionEvent e) { }); - String exportProjectTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PROJECT, true); + String exportProjectTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PROJECT); JMenuItem exportProject = Toolkit.newJMenuItemShift(exportProjectTitle, 'X'); exportProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -154,21 +154,21 @@ public void actionPerformed(ActionEvent e) { public JMenu buildSketchMenu() { - JMenuItem runItem = Toolkit.newJMenuItem(AndroidToolbar.getTitle(AndroidToolbar.RUN, false), 'D'); + JMenuItem runItem = Toolkit.newJMenuItem(AndroidToolbar.getTitle(AndroidToolbar.RUN_ON_DEVICE), 'D'); runItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleRunDevice(); } }); - JMenuItem presentItem = Toolkit.newJMenuItemShift(AndroidToolbar.getTitle(AndroidToolbar.RUN, true), 'E'); + JMenuItem presentItem = Toolkit.newJMenuItemShift(AndroidToolbar.getTitle(AndroidToolbar.RUN_IN_EMULATOR), 'E'); presentItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleRunEmulator(); } }); - JMenuItem stopItem = new JMenuItem(AndroidToolbar.getTitle(AndroidToolbar.STOP, false)); + JMenuItem stopItem = new JMenuItem(AndroidToolbar.getTitle(AndroidToolbar.STOP)); stopItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { handleStop(); diff --git a/mode/src/processing/mode/android/AndroidToolbar.java b/mode/src/processing/mode/android/AndroidToolbar.java index 254bcadc..3c06614f 100644 --- a/mode/src/processing/mode/android/AndroidToolbar.java +++ b/mode/src/processing/mode/android/AndroidToolbar.java @@ -39,15 +39,17 @@ @SuppressWarnings("serial") public class AndroidToolbar extends EditorToolbar { - static protected final int RUN = 0; - static protected final int STOP = 1; + static protected final int RUN_ON_DEVICE = 0; + static protected final int RUN_IN_EMULATOR = 1; + static protected final int STOP = 2; - static protected final int NEW = 2; - static protected final int OPEN = 3; - static protected final int SAVE = 4; - static protected final int EXPORT_PACKAGE = 5; - static protected final int EXPORT_BUNDLE = 6; - static protected final int EXPORT_PROJECT = 7; + static protected final int NEW = 3; + static protected final int OPEN = 4; + static protected final int SAVE = 5; + + static protected final int EXPORT_PACKAGE = 6; + static protected final int EXPORT_BUNDLE = 7; + static protected final int EXPORT_PROJECT = 8; private AndroidEditor aEditor; @@ -61,25 +63,14 @@ public AndroidToolbar(Editor editor, Base base) { } - // TODO: - // Buttons are initialized in createButtons, see code of EditorToolbar.rebuild() -// public void init() { -// Image[][] images = loadImages(); -// for (int i = 0; i < 6; i++) { -// addButton(getTitle(i, false), getTitle(i, true), images[i], i == NEW); -// } -// } - - - static public String getTitle(int index, boolean shift) { + static public String getTitle(int index) { switch (index) { - case RUN: return !shift ? "Run on Device" : "Run in Emulator"; - case STOP: return "Stop"; - case NEW: return "New"; - case OPEN: return "Open"; - case SAVE: return "Save"; - - + case RUN_ON_DEVICE: return AndroidMode.getTextString("menu.sketch.run_on_device"); + case RUN_IN_EMULATOR: return AndroidMode.getTextString("menu.sketch.run_in_emulator"); + case STOP: return AndroidMode.getTextString("menu.sketch.stop"); + case NEW: return AndroidMode.getTextString("menu.file.new"); + case OPEN: return AndroidMode.getTextString("menu.file.open"); + case SAVE: return AndroidMode.getTextString("menu.file.save"); case EXPORT_PACKAGE: return AndroidMode.getTextString("menu.file.export_signed_package"); case EXPORT_BUNDLE: return AndroidMode.getTextString("menu.file.export_signed_bundle"); case EXPORT_PROJECT: return AndroidMode.getTextString("menu.file.export_android_project");