diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 27013566c..9fa56030e 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -2169,60 +2169,6 @@ public class Base { // ................................................................. - static public void showReference(String filename) { - showReference("reference/www.arduino.cc/en", filename); - } - - static public void showReference(String prefix, String filename) { - File referenceFolder = getContentFile(prefix); - File referenceFile = new File(referenceFolder, filename); - if (!referenceFile.exists()) - referenceFile = new File(referenceFolder, filename + ".html"); - - if(referenceFile.exists()){ - openURL(referenceFile.getAbsolutePath()); - }else{ - showWarning(tr("Problem Opening URL"), format(tr("Could not open the URL\n{0}"), referenceFile), null); - } - } - - public static void showEdisonGettingStarted() { - showReference("reference/Edison_help_files", "ArduinoIDE_guide_edison"); - } - - static public void showArduinoGettingStarted() { - if (OSUtils.isMacOS()) { - showReference("Guide/MacOSX"); - } else if (OSUtils.isWindows()) { - showReference("Guide/Windows"); - } else { - openURL("http://www.arduino.cc/playground/Learning/Linux"); - } - } - - static public void showReference() { - showReference("Reference/HomePage"); - } - - - static public void showEnvironment() { - showReference("Guide/Environment"); - } - - - static public void showTroubleshooting() { - showReference("Guide/Troubleshooting"); - } - - - static public void showFAQ() { - showReference("Main/FAQ"); - } - - - // ................................................................. - - /** * "No cookie for you" type messages. Nothing fatal or all that * much of a bummer, but something to notify the user about. diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index c1be9b5ef..87d4ef61e 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -46,9 +46,11 @@ import java.io.File; import java.io.FileFilter; import java.io.FilenameFilter; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.ConnectException; import java.net.URL; import java.net.URLClassLoader; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -1134,29 +1136,29 @@ public class Editor extends JFrame implements RunnerListener { menu.setMnemonic(KeyEvent.VK_H); JMenuItem item = new JMenuItem(tr("Getting Started")); - item.addActionListener(event -> Base.showArduinoGettingStarted()); + item.addActionListener(event -> Base.openURL("https://www.arduino.cc/en/Guide")); menu.add(item); item = new JMenuItem(tr("Environment")); - item.addActionListener(event -> Base.showEnvironment()); + item.addActionListener(event -> Base.openURL("https://www.arduino.cc/en/Guide/Environment")); menu.add(item); item = new JMenuItem(tr("Troubleshooting")); - item.addActionListener(event -> Base.showTroubleshooting()); + item.addActionListener(event -> Base.openURL("https://support.arduino.cc/hc/en-us")); menu.add(item); item = new JMenuItem(tr("Reference")); - item.addActionListener(event -> Base.showReference()); + item.addActionListener(event -> Base.openURL("https://www.arduino.cc/reference/en/")); menu.add(item); menu.addSeparator(); item = newJMenuItemShift(tr("Find in Reference"), 'F'); - item.addActionListener(event -> handleFindReference(event)); + item.addActionListener(event -> handleFindReference(getCurrentTab().getCurrentKeyword())); menu.add(item); item = new JMenuItem(tr("Frequently Asked Questions")); - item.addActionListener(event -> Base.showFAQ()); + item.addActionListener(event -> Base.openURL("https://support.arduino.cc/hc/en-us")); menu.add(item); item = new JMenuItem(tr("Visit Arduino.cc")); @@ -1553,20 +1555,25 @@ public class Editor extends JFrame implements RunnerListener { tabs.remove(index); } + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - void handleFindReference(ActionEvent e) { - String text = getCurrentTab().getCurrentKeyword(); + void handleFindReference(String text) { String referenceFile = base.getPdeKeywords().getReference(text); + String q; if (referenceFile == null) { - statusNotice(I18n.format(tr("No reference available for \"{0}\""), text)); + q = text; + } else if (referenceFile.startsWith("Serial_")) { + q = referenceFile.substring(7); } else { - if (referenceFile.startsWith("Serial_")) { - Base.showReference("Serial/" + referenceFile.substring("Serial_".length())); - } else { - Base.showReference("Reference/" + referenceFile); - } + q = referenceFile; + } + try { + Base.openURL("https://www.arduino.cc/search?tab=&q=" + + URLEncoder.encode(q, "UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); } } diff --git a/app/src/processing/app/EditorTab.java b/app/src/processing/app/EditorTab.java index 5e8f3e4bf..59bfe3c77 100644 --- a/app/src/processing/app/EditorTab.java +++ b/app/src/processing/app/EditorTab.java @@ -247,7 +247,7 @@ public class EditorTab extends JPanel implements SketchFile.TextStorage { menu.add(item); final JMenuItem referenceItem = new JMenuItem(tr("Find in Reference")); - referenceItem.addActionListener(editor::handleFindReference); + referenceItem.addActionListener(ev -> editor.handleFindReference(getCurrentKeyword())); menu.add(referenceItem); final JMenuItem openURLItem = new JMenuItem(tr("Open URL")); diff --git a/app/src/processing/app/syntax/SketchTextArea.java b/app/src/processing/app/syntax/SketchTextArea.java index ce74a3f1f..ba10bfc7a 100644 --- a/app/src/processing/app/syntax/SketchTextArea.java +++ b/app/src/processing/app/syntax/SketchTextArea.java @@ -89,14 +89,11 @@ public class SketchTextArea extends RSyntaxTextArea { public void setKeywords(PdeKeywords keywords) { pdeKeywords = keywords; - setLinkGenerator(new DocLinkGenerator(pdeKeywords)); } private void installFeatures() throws IOException { setTheme(PreferencesData.get("editor.syntax_theme", "default")); - setLinkGenerator(new DocLinkGenerator(pdeKeywords)); - setSyntaxEditingStyle(SYNTAX_STYLE_CPLUSPLUS); } @@ -175,48 +172,6 @@ public class SketchTextArea extends RSyntaxTextArea { } } - private static class DocLinkGenerator implements LinkGenerator { - - private final PdeKeywords pdeKeywords; - - public DocLinkGenerator(PdeKeywords pdeKeywords) { - this.pdeKeywords = pdeKeywords; - } - - @Override - public LinkGeneratorResult isLinkAtOffset(RSyntaxTextArea textArea, final int offs) { - Token token = textArea.modelToToken(offs); - if (token == null) { - return null; - } - - String reference = pdeKeywords.getReference(token.getLexeme()); - - if (reference != null || (token.getType() == TokenTypes.DATA_TYPE || token.getType() == TokenTypes.VARIABLE || token.getType() == TokenTypes.FUNCTION)) { - - return new LinkGeneratorResult() { - - @Override - public int getSourceOffset() { - return offs; - } - - @Override - public HyperlinkEvent execute() { - - LOG.fine("Open Reference: " + reference); - - Base.showReference("Reference/" + reference); - - return null; - } - }; - } - - return null; - } - } - /** * Handles http hyperlinks. diff --git a/build/build.xml b/build/build.xml index 8f5757b41..37657234e 100644 --- a/build/build.xml +++ b/build/build.xml @@ -214,10 +214,6 @@ - - - - @@ -254,16 +250,6 @@ - - - - - - - - - - diff --git a/build/shared/reference-1.6.6-3.zip.sha b/build/shared/reference-1.6.6-3.zip.sha deleted file mode 100644 index eff35eeff..000000000 --- a/build/shared/reference-1.6.6-3.zip.sha +++ /dev/null @@ -1 +0,0 @@ -cc4f36c9783772f07c9a1bb4a60d7be3b504c69e diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 5432bf595..1a0845f6d 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -1,5 +1,8 @@ ARDUINO 1.8.15 Not yet release +[ide] +* Removed the very outdated off-line documentation. + [wifi-firmware] * Added latest firmwares (up to version 1.4.8) for NINA-based boards