|
27 | 27 | import processing.app.tools.*;
|
28 | 28 | import processing.core.*;
|
29 | 29 | import static processing.app.I18n._;
|
| 30 | +import static processing.app.ObjectUtil.defaultIfEmpty; |
30 | 31 |
|
31 | 32 | import java.awt.*;
|
32 | 33 | import java.awt.datatransfer.*;
|
@@ -1073,9 +1074,10 @@ public void actionPerformed(ActionEvent e) {
|
1073 | 1074 | item = newJMenuItemShift(_("Find in Reference"), 'F');
|
1074 | 1075 | item.addActionListener(new ActionListener() {
|
1075 | 1076 | public void actionPerformed(ActionEvent e) {
|
1076 |
| - if (textarea.isSelectionActive()) { |
1077 |
| - handleFindReference(); |
1078 |
| - } |
| 1077 | +// if (textarea.isSelectionActive()) { |
| 1078 | +// handleFindReference(); |
| 1079 | +// } |
| 1080 | + handleFindReference(); |
1079 | 1081 | }
|
1080 | 1082 | });
|
1081 | 1083 | menu.add(item);
|
@@ -1809,24 +1811,20 @@ protected void handleIndentOutdent(boolean indent) {
|
1809 | 1811 | }
|
1810 | 1812 |
|
1811 | 1813 |
|
1812 |
| - protected void handleFindReference() { |
1813 |
| - String text = textarea.getSelectedText().trim(); |
1814 |
| - |
1815 |
| - if (text.length() == 0) { |
1816 |
| - statusNotice(_("First select a word to find in the reference.")); |
| 1814 | + protected void handleFindReference() { |
| 1815 | + String text = defaultIfEmpty(textarea.getSelectedText(), "").trim(); |
1817 | 1816 |
|
1818 |
| - } else { |
1819 |
| - String referenceFile = PdeKeywords.getReference(text); |
1820 |
| - //System.out.println("reference file is " + referenceFile); |
1821 |
| - if (referenceFile == null) { |
1822 |
| - statusNotice( |
1823 |
| - I18n.format(_("No reference available for \"{0}\""), text) |
1824 |
| - ); |
1825 |
| - } else { |
1826 |
| - Base.showReference(I18n.format(_("{0}.html"), referenceFile)); |
1827 |
| - } |
1828 |
| - } |
1829 |
| - } |
| 1817 | + if (text.length() == 0) { |
| 1818 | + Base.showReference(); |
| 1819 | + } else { |
| 1820 | + String referenceFile = PdeKeywords.getReference(text); |
| 1821 | + if (referenceFile == null) { |
| 1822 | + statusNotice(I18n.format(_("No reference available for \"{0}\""), text)); |
| 1823 | + } else { |
| 1824 | + Base.showReference(I18n.format(_("{0}.html"), referenceFile)); |
| 1825 | + } |
| 1826 | + } |
| 1827 | + } |
1830 | 1828 |
|
1831 | 1829 |
|
1832 | 1830 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
0 commit comments