mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Fixed erratic behaviour of "include library" menu
This commit is contained in:
parent
ab227d37e5
commit
60dac7e59d
@ -187,7 +187,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// re-add the sub-menus that are shared by all windows
|
||||
fileMenu.insert(sketchbookMenu, 2);
|
||||
fileMenu.insert(examplesMenu, 3);
|
||||
sketchMenu.insert(importMenu, 4);
|
||||
buildSketchMenu();
|
||||
int offset = 0;
|
||||
for (JMenu menu : base.getBoardsCustomMenus()) {
|
||||
toolsMenu.insert(menu, numTools + offset);
|
||||
@ -201,7 +201,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
fileMenu.remove(sketchbookMenu);
|
||||
fileMenu.remove(examplesMenu);
|
||||
sketchMenu.remove(importMenu);
|
||||
buildSketchMenu();
|
||||
List<Component> toolsMenuItemsToRemove = new LinkedList<Component>();
|
||||
for (Component menuItem : toolsMenu.getMenuComponents()) {
|
||||
if (menuItem instanceof JComponent) {
|
||||
@ -627,10 +627,13 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
protected JMenu buildSketchMenu() {
|
||||
JMenuItem item;
|
||||
sketchMenu = new JMenu(_("Sketch"));
|
||||
if (sketchMenu == null) {
|
||||
sketchMenu = new JMenu(_("Sketch"));
|
||||
} else {
|
||||
sketchMenu.removeAll();
|
||||
}
|
||||
|
||||
item = newJMenuItem(_("Verify / Compile"), 'R');
|
||||
JMenuItem item = newJMenuItem(_("Verify / Compile"), 'R');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleRun(false);
|
||||
@ -656,6 +659,15 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
sketchMenu.addSeparator();
|
||||
|
||||
item = newJMenuItem(_("Show Sketch Folder"), 'K');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openFolder(sketch.getFolder());
|
||||
}
|
||||
});
|
||||
sketchMenu.add(item);
|
||||
item.setEnabled(Base.openFolderAvailable());
|
||||
|
||||
if (importMenu == null) {
|
||||
importMenu = new JMenu(_("Include Library"));
|
||||
MenuScroller.setScrollerFor(importMenu);
|
||||
@ -663,15 +675,6 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
sketchMenu.add(importMenu);
|
||||
|
||||
item = newJMenuItem(_("Show Sketch Folder"), 'K');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Base.openFolder(sketch.getFolder());
|
||||
}
|
||||
});
|
||||
sketchMenu.add(item);
|
||||
item.setEnabled(Base.openFolderAvailable());
|
||||
|
||||
item = new JMenuItem(_("Add File..."));
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user