diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 647b3016393..61c440a7cd8 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1070,6 +1070,10 @@ public void rebuildImportMenu(JMenu importMenu) { importMenu.removeAll(); JMenuItem menu = new JMenuItem(tr("Manage Libraries...")); + // Ctrl+Shift+I on Windows and Linux, Command+Shift+I on macOS + menu.setAccelerator(KeyStroke.getKeyStroke('I', + Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | + ActionEvent.SHIFT_MASK)); menu.addActionListener(e -> openLibraryManager("", "")); importMenu.add(menu); importMenu.addSeparator(); diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 71ecc5343ac..06a84a0cd7f 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -158,7 +158,7 @@ public boolean test(SketchController sketch) { static volatile AbstractMonitor serialMonitor; static AbstractMonitor serialPlotter; - + final EditorHeader header; EditorStatus status; EditorConsole console; @@ -248,7 +248,7 @@ public void windowDeactivated(WindowEvent e) { //PdeKeywords keywords = new PdeKeywords(); //sketchbook = new Sketchbook(this); - + buildMenuBar(); // For rev 0120, placing things inside a JPanel @@ -399,8 +399,7 @@ public boolean importData(JComponent src, Transferable transferable) { statusNotice(tr("One file added to the sketch.")); } else { - statusNotice( - I18n.format(tr("{0} files added to the sketch."), successful)); + statusNotice(I18n.format(tr("{0} files added to the sketch."), successful)); } return true; } @@ -732,16 +731,16 @@ private JMenu buildToolsMenu() { addInternalTools(toolsMenu); - JMenuItem item = newJMenuItemShift(tr("Serial Monitor"), 'M'); + JMenuItem item = newJMenuItemShift(tr("Manage Libraries..."), 'I'); + item.addActionListener(e -> base.openLibraryManager("", "")); + toolsMenu.add(item); + + item = newJMenuItemShift(tr("Serial Monitor"), 'M'); item.addActionListener(e -> handleSerial()); toolsMenu.add(item); item = newJMenuItemShift(tr("Serial Plotter"), 'L'); - item.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - handlePlotter(); - } - }); + item.addActionListener(e -> handlePlotter()); toolsMenu.add(item); addTools(toolsMenu, BaseNoGui.getToolsFolder()); @@ -947,14 +946,14 @@ private String findClassInZipFile(String base, File file) { } finally { if (zipFile != null) { try { - zipFile.close(); - } catch (IOException e) { - // noop - } - } - } - return null; - } + zipFile.close(); + } catch (IOException e) { + // noop + } + } + } + return null; + } public void updateKeywords(PdeKeywords keywords) { for (EditorTab tab : tabs) @@ -1476,6 +1475,7 @@ static public JMenuItem newJMenuItem(String title, int what) { /** * Like newJMenuItem() but adds shift as a modifier for the key command. */ + // Control + Shift + K seems to not be working on linux (Xubuntu 17.04, 2017-08-19) static public JMenuItem newJMenuItemShift(String title, int what) { JMenuItem menuItem = new JMenuItem(title); menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK)); @@ -2096,18 +2096,19 @@ private boolean serialPrompt() { names[i] = portMenu.getItem(i).getText(); } + // FIXME: This is horribly unreadable String result = (String) - JOptionPane.showInputDialog(this, - I18n.format( - tr("Serial port {0} not found.\n" + - "Retry the upload with another serial port?"), - PreferencesData.get("serial.port") - ), - "Serial port not found", - JOptionPane.PLAIN_MESSAGE, - null, - names, - 0); + JOptionPane.showInputDialog(this, + I18n.format( + tr("Serial port {0} not found.\n" + + "Retry the upload with another serial port?"), + PreferencesData.get("serial.port") + ), + "Serial port not found", + JOptionPane.PLAIN_MESSAGE, + null, + names, + 0); if (result == null) return false; selectSerialPort(result); base.onBoardOrPortChange(); @@ -2321,7 +2322,7 @@ public void handleSerial() { return; } } - + if (serialMonitor != null) { // The serial monitor already exists @@ -2351,14 +2352,14 @@ public void handleSerial() { } serialMonitor = new MonitorFactory().newMonitor(port); - + if (serialMonitor == null) { String board = port.getPrefs().get("board"); String boardName = BaseNoGui.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board); statusError(I18n.format(tr("Serial monitor is not supported on network ports such as {0} for the {1} in this release"), PreferencesData.get("serial.port"), boardName)); return; } - + Base.setIcon(serialMonitor); // If currently uploading, disable the monitor (it will be later @@ -2418,7 +2419,7 @@ public void handleSerial() { } while (serialMonitor.requiresAuthorization() && !success); } - + public void handlePlotter() { if(serialMonitor != null) { if(serialMonitor.isClosed()) { @@ -2428,7 +2429,7 @@ public void handlePlotter() { return; } } - + if (serialPlotter != null) { // The serial plotter already exists diff --git a/app/src/processing/app/helpers/Keys.java b/app/src/processing/app/helpers/Keys.java index 6c0053e50ef..74dc905639b 100644 --- a/app/src/processing/app/helpers/Keys.java +++ b/app/src/processing/app/helpers/Keys.java @@ -220,7 +220,7 @@ public static KeyStroke ctrlShift(int keyCode) { } /** - * Creates a KeyCode for the "menu shortcut" + shift + the key passed in. By + * Creates a KeyCode for the "menu shortcut" + alt + the key passed in. By * default, the menu shortcut is the ctrl key (hence the method name), but * platforms might use a different key (like the Apple key on OSX). *