1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Merge pull request #11495 from cmaglie/no-docs

Removed offline-reference docs.
This commit is contained in:
Cristian Maglie 2021-08-18 14:55:34 +02:00 committed by GitHub
commit 7ab56aa235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 129 deletions

View File

@ -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.

View File

@ -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();
}
}

View File

@ -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"));

View File

@ -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.

View File

@ -214,10 +214,6 @@
<antcall target="assemble-examples" />
<mkdir dir="${target.path}/reference"/>
<antcall target="assemble-docs" />
<!-- Write the revision file! -->
<echo file="${target.path}/lib/version.txt" message="${version}" />
@ -254,16 +250,6 @@
</copy>
</target>
<target name="assemble-docs" unless="no_docs">
<!-- Unzip documentation -->
<antcall target="unzip">
<param name="archive_file" value="shared/reference-1.6.6-3.zip" />
<param name="archive_url" value="https://downloads.arduino.cc/reference-1.6.6-3.zip" />
<param name="final_folder" value="${target.path}/reference/www.arduino.cc" />
<param name="dest_folder" value="${target.path}/reference/" />
</antcall>
</target>
<!-- copy library folder -->
<target name="assemble-libraries" unless="light_bundle">
<download-library name="Ethernet" version="2.0.0"/>

View File

@ -1 +0,0 @@
cc4f36c9783772f07c9a1bb4a60d7be3b504c69e

View File

@ -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