mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-10 21:24:12 +01:00
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.app.tools.*;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
import static processing.app.ObjectUtil.defaultIfEmpty;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.datatransfer.*;
|
import java.awt.datatransfer.*;
|
||||||
@ -1073,10 +1074,11 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
item = newJMenuItemShift(_("Find in Reference"), 'F');
|
item = newJMenuItemShift(_("Find in Reference"), 'F');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (textarea.isSelectionActive()) {
|
// if (textarea.isSelectionActive()) {
|
||||||
|
// handleFindReference();
|
||||||
|
// }
|
||||||
handleFindReference();
|
handleFindReference();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
|
|
||||||
@ -1810,18 +1812,14 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
|
|
||||||
protected void handleFindReference() {
|
protected void handleFindReference() {
|
||||||
String text = textarea.getSelectedText().trim();
|
String text = defaultIfEmpty(textarea.getSelectedText(), "").trim();
|
||||||
|
|
||||||
if (text.length() == 0) {
|
if (text.length() == 0) {
|
||||||
statusNotice(_("First select a word to find in the reference."));
|
Base.showReference();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String referenceFile = PdeKeywords.getReference(text);
|
String referenceFile = PdeKeywords.getReference(text);
|
||||||
//System.out.println("reference file is " + referenceFile);
|
|
||||||
if (referenceFile == null) {
|
if (referenceFile == null) {
|
||||||
statusNotice(
|
statusNotice(I18n.format(_("No reference available for \"{0}\""), text));
|
||||||
I18n.format(_("No reference available for \"{0}\""), text)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
Base.showReference(I18n.format(_("{0}.html"), referenceFile));
|
Base.showReference(I18n.format(_("{0}.html"), referenceFile));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user