Skip to content

Commit 0db8bdb

Browse files
committed
Find / Replace dialog cleanup and improvements (Peter Lewis)
Adds Find Previous and Use Selection for Find; various other cleanups. Changes Mac keyboard shortcut for Redo from Command-Y to Command-Shift-Z. http://code.google.com/p/arduino/issues/detail?id=825
1 parent 599a905 commit 0db8bdb

File tree

2 files changed

+185
-114
lines changed

2 files changed

+185
-114
lines changed

app/src/processing/app/Editor.java

+27-4
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,11 @@ protected JMenu buildEditMenu() {
11201120
undoItem.addActionListener(undoAction = new UndoAction());
11211121
menu.add(undoItem);
11221122

1123-
redoItem = newJMenuItem(_("Redo"), 'Y');
1123+
if (!Base.isMacOS()) {
1124+
redoItem = newJMenuItem(_("Redo"), 'Y');
1125+
} else {
1126+
redoItem = newJMenuItemShift(_("Redo"), 'Z');
1127+
}
11241128
redoItem.addActionListener(redoAction = new RedoAction());
11251129
menu.add(redoItem);
11261130

@@ -1232,10 +1236,29 @@ public void actionPerformed(ActionEvent e) {
12321236
item.addActionListener(new ActionListener() {
12331237
public void actionPerformed(ActionEvent e) {
12341238
if (find != null) {
1235-
//find.find(true);
1236-
//FindReplace find = new FindReplace(Editor.this); //.show();
1237-
find.find(true);
1239+
find.findNext();
1240+
}
1241+
}
1242+
});
1243+
menu.add(item);
1244+
1245+
item = newJMenuItemShift(_("Find Previous"), 'G');
1246+
item.addActionListener(new ActionListener() {
1247+
public void actionPerformed(ActionEvent e) {
1248+
if (find != null) {
1249+
find.findPrevious();
1250+
}
1251+
}
1252+
});
1253+
menu.add(item);
1254+
1255+
item = newJMenuItem(_("Use Selection For Find"), 'E');
1256+
item.addActionListener(new ActionListener() {
1257+
public void actionPerformed(ActionEvent e) {
1258+
if (find == null) {
1259+
find = new FindReplace(Editor.this);
12381260
}
1261+
find.setFindText( getSelectedText() );
12391262
}
12401263
});
12411264
menu.add(item);

0 commit comments

Comments
 (0)