Skip to content

Commit 4f3e2d9

Browse files
committed
Move "Manage libraries..." to the "Tools" menu
It's easier to access it there Also, a shortcut was added to it: Ctrl + Shift + O My original plan was for it to be "Control + Shift + K", but for some reason it doesn't work in my Xubuntu 17.04. Fixes #6335
1 parent 39bb83d commit 4f3e2d9

File tree

3 files changed

+38
-38
lines changed

3 files changed

+38
-38
lines changed

Diff for: app/src/processing/app/Base.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1069,9 +1069,8 @@ public void rebuildImportMenu(JMenu importMenu) {
10691069
return;
10701070
importMenu.removeAll();
10711071

1072-
JMenuItem menu = new JMenuItem(tr("Manage Libraries..."));
1073-
menu.addActionListener(e -> openLibraryManager("", ""));
1074-
importMenu.add(menu);
1072+
// Historical note: "Manage Libraries..." used to go here before v1.9.0
1073+
10751074
importMenu.addSeparator();
10761075

10771076
JMenuItem addLibraryMenuItem = new JMenuItem(tr("Add .ZIP Library..."));

Diff for: app/src/processing/app/Editor.java

+35-34
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public boolean test(SketchController sketch) {
158158

159159
static volatile AbstractMonitor serialMonitor;
160160
static AbstractMonitor serialPlotter;
161-
161+
162162
final EditorHeader header;
163163
EditorStatus status;
164164
EditorConsole console;
@@ -248,7 +248,7 @@ public void windowDeactivated(WindowEvent e) {
248248

249249
//PdeKeywords keywords = new PdeKeywords();
250250
//sketchbook = new Sketchbook(this);
251-
251+
252252
buildMenuBar();
253253

254254
// For rev 0120, placing things inside a JPanel
@@ -399,8 +399,7 @@ public boolean importData(JComponent src, Transferable transferable) {
399399
statusNotice(tr("One file added to the sketch."));
400400

401401
} else {
402-
statusNotice(
403-
I18n.format(tr("{0} files added to the sketch."), successful));
402+
statusNotice(I18n.format(tr("{0} files added to the sketch."), successful));
404403
}
405404
return true;
406405
}
@@ -732,16 +731,16 @@ private JMenu buildToolsMenu() {
732731

733732
addInternalTools(toolsMenu);
734733

735-
JMenuItem item = newJMenuItemShift(tr("Serial Monitor"), 'M');
734+
JMenuItem item = newJMenuItemShift(tr("Manage Libraries..."), 'O');
735+
item.addActionListener(e -> base.openLibraryManager("", ""));
736+
toolsMenu.add(item);
737+
738+
item = newJMenuItemShift(tr("Serial Monitor"), 'M');
736739
item.addActionListener(e -> handleSerial());
737740
toolsMenu.add(item);
738741

739742
item = newJMenuItemShift(tr("Serial Plotter"), 'L');
740-
item.addActionListener(new ActionListener() {
741-
public void actionPerformed(ActionEvent e) {
742-
handlePlotter();
743-
}
744-
});
743+
item.addActionListener(e -> handlePlotter());
745744
toolsMenu.add(item);
746745

747746
addTools(toolsMenu, BaseNoGui.getToolsFolder());
@@ -947,14 +946,14 @@ private String findClassInZipFile(String base, File file) {
947946
} finally {
948947
if (zipFile != null) {
949948
try {
950-
zipFile.close();
951-
} catch (IOException e) {
952-
// noop
953-
}
954-
}
955-
}
956-
return null;
957-
}
949+
zipFile.close();
950+
} catch (IOException e) {
951+
// noop
952+
}
953+
}
954+
}
955+
return null;
956+
}
958957

959958
public void updateKeywords(PdeKeywords keywords) {
960959
for (EditorTab tab : tabs)
@@ -1476,6 +1475,7 @@ static public JMenuItem newJMenuItem(String title, int what) {
14761475
/**
14771476
* Like newJMenuItem() but adds shift as a modifier for the key command.
14781477
*/
1478+
// Control + Shift + K seems to not be working on linux (Xubuntu 17.04, 2017-08-19)
14791479
static public JMenuItem newJMenuItemShift(String title, int what) {
14801480
JMenuItem menuItem = new JMenuItem(title);
14811481
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK));
@@ -2096,18 +2096,19 @@ private boolean serialPrompt() {
20962096
names[i] = portMenu.getItem(i).getText();
20972097
}
20982098

2099+
// FIXME: This is horribly unreadable
20992100
String result = (String)
2100-
JOptionPane.showInputDialog(this,
2101-
I18n.format(
2102-
tr("Serial port {0} not found.\n" +
2103-
"Retry the upload with another serial port?"),
2104-
PreferencesData.get("serial.port")
2105-
),
2106-
"Serial port not found",
2107-
JOptionPane.PLAIN_MESSAGE,
2108-
null,
2109-
names,
2110-
0);
2101+
JOptionPane.showInputDialog(this,
2102+
I18n.format(
2103+
tr("Serial port {0} not found.\n" +
2104+
"Retry the upload with another serial port?"),
2105+
PreferencesData.get("serial.port")
2106+
),
2107+
"Serial port not found",
2108+
JOptionPane.PLAIN_MESSAGE,
2109+
null,
2110+
names,
2111+
0);
21112112
if (result == null) return false;
21122113
selectSerialPort(result);
21132114
base.onBoardOrPortChange();
@@ -2321,7 +2322,7 @@ public void handleSerial() {
23212322
return;
23222323
}
23232324
}
2324-
2325+
23252326
if (serialMonitor != null) {
23262327
// The serial monitor already exists
23272328

@@ -2351,14 +2352,14 @@ public void handleSerial() {
23512352
}
23522353

23532354
serialMonitor = new MonitorFactory().newMonitor(port);
2354-
2355+
23552356
if (serialMonitor == null) {
23562357
String board = port.getPrefs().get("board");
23572358
String boardName = BaseNoGui.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board);
23582359
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));
23592360
return;
23602361
}
2361-
2362+
23622363
Base.setIcon(serialMonitor);
23632364

23642365
// If currently uploading, disable the monitor (it will be later
@@ -2418,7 +2419,7 @@ public void handleSerial() {
24182419
} while (serialMonitor.requiresAuthorization() && !success);
24192420

24202421
}
2421-
2422+
24222423
public void handlePlotter() {
24232424
if(serialMonitor != null) {
24242425
if(serialMonitor.isClosed()) {
@@ -2428,7 +2429,7 @@ public void handlePlotter() {
24282429
return;
24292430
}
24302431
}
2431-
2432+
24322433
if (serialPlotter != null) {
24332434
// The serial plotter already exists
24342435

Diff for: app/src/processing/app/helpers/Keys.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public static KeyStroke ctrlShift(int keyCode) {
220220
}
221221

222222
/**
223-
* Creates a KeyCode for the "menu shortcut" + shift + the key passed in. By
223+
* Creates a KeyCode for the "menu shortcut" + alt + the key passed in. By
224224
* default, the menu shortcut is the ctrl key (hence the method name), but
225225
* platforms might use a different key (like the Apple key on OSX).
226226
*

0 commit comments

Comments
 (0)