mirror of https://github.com/noisymime/Arduino.git
Index reference page is shown when no text selected if clicking 'Find in
reference' command.
This commit is contained in:
parent
8a1cf335ad
commit
ab2d83fc80
|
@ -27,6 +27,7 @@ import processing.app.syntax.*;
|
|||
import processing.app.tools.*;
|
||||
import processing.core.*;
|
||||
import static processing.app.I18n._;
|
||||
import static processing.app.ObjectUtil.defaultIfEmpty;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.*;
|
||||
|
@ -1073,10 +1074,11 @@ public class Editor extends JFrame implements RunnerListener {
|
|||
item = newJMenuItemShift(_("Find in Reference"), 'F');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (textarea.isSelectionActive()) {
|
||||
// if (textarea.isSelectionActive()) {
|
||||
// handleFindReference();
|
||||
// }
|
||||
handleFindReference();
|
||||
}
|
||||
}
|
||||
});
|
||||
menu.add(item);
|
||||
|
||||
|
@ -1810,18 +1812,14 @@ public class Editor extends JFrame implements RunnerListener {
|
|||
|
||||
|
||||
protected void handleFindReference() {
|
||||
String text = textarea.getSelectedText().trim();
|
||||
String text = defaultIfEmpty(textarea.getSelectedText(), "").trim();
|
||||
|
||||
if (text.length() == 0) {
|
||||
statusNotice(_("First select a word to find in the reference."));
|
||||
|
||||
Base.showReference();
|
||||
} else {
|
||||
String referenceFile = PdeKeywords.getReference(text);
|
||||
//System.out.println("reference file is " + referenceFile);
|
||||
if (referenceFile == null) {
|
||||
statusNotice(
|
||||
I18n.format(_("No reference available for \"{0}\""), text)
|
||||
);
|
||||
statusNotice(I18n.format(_("No reference available for \"{0}\""), text));
|
||||
} else {
|
||||
Base.showReference(I18n.format(_("{0}.html"), referenceFile));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue