1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-29 18:52:13 +01:00

New editor on MacOSX: restored CMD+E for finding selected text

This commit is contained in:
Federico Fissore 2015-05-14 14:53:06 +02:00
parent 5c7a0aa572
commit 54da4d6d37

View File

@ -1411,17 +1411,15 @@ public class Editor extends JFrame implements RunnerListener {
if (find == null) {
find = new FindReplace(Editor.this);
}
if (getSelectedText()!= null) find.setFindText( getSelectedText() );
//new FindReplace(Editor.this).show();
if (!OSUtils.isMacOS() && getSelectedText() != null) {
find.setFindText(getSelectedText());
}
find.setLocationRelativeTo(Editor.this);
find.setVisible(true);
//find.setVisible(true);
}
});
menu.add(item);
// TODO find next should only be enabled after a
// search has actually taken place
item = newJMenuItem(_("Find Next"), 'G');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -1442,6 +1440,23 @@ public class Editor extends JFrame implements RunnerListener {
});
menu.add(item);
if (OSUtils.isMacOS()) {
item = newJMenuItem(_("Use Selection For Find"), 'E');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find == null) {
find = new FindReplace(Editor.this);
}
if (getSelectedText() != null) {
find.setFindText(getSelectedText());
}
find.setLocationRelativeTo(Editor.this);
find.setVisible(true);
}
});
menu.add(item);
}
return menu;
}