mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Remove extra ways for references to be included
This commit is contained in:
@@ -1279,12 +1279,8 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (file.toString().endsWith(".txt"))
|
||||
// To enable readme.txt files to open as well
|
||||
Base.openFolder(file);
|
||||
else
|
||||
// Prepend with file:// and also encode spaces & other characters
|
||||
Base.openURL(file.toURI().toString());
|
||||
// Prepend with file:// and also encode spaces & other characters
|
||||
Base.openURL(file.toURI().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Library extends LocalContribution {
|
||||
//protected File folder; // /path/to/shortname
|
||||
protected File libraryFolder; // shortname/library
|
||||
protected File examplesFolder; // shortname/examples
|
||||
protected File referenceFile; // shortname/reference/index.html is one possible path
|
||||
protected File referenceFile; // shortname/reference/index.html
|
||||
|
||||
/**
|
||||
* Subfolder for grouping libraries in a menu. Basic subfolder support
|
||||
@@ -212,8 +212,6 @@ public class Library extends LocalContribution {
|
||||
|
||||
// get the path for all .jar files in this code folder
|
||||
packageList = Base.packageListFromClassPath(getClassPath());
|
||||
|
||||
referenceFile = loadReferenceIndexFile(folder);
|
||||
}
|
||||
|
||||
|
||||
@@ -518,27 +516,6 @@ public class Library extends LocalContribution {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param folder
|
||||
* The file object representing the base folder of the contribution
|
||||
* @return Returns a file object representing the index file of the reference
|
||||
*/
|
||||
protected File loadReferenceIndexFile(File folder) {
|
||||
final String potentialFileList[] = {
|
||||
"reference/index.html", "reference/index.htm",
|
||||
"documentation/index.html", "documentation/index.htm", "docs/index.html",
|
||||
"docs/index.htm", "documentation.html", "documentation.htm",
|
||||
"reference.html", "reference.htm", "docs.html", "docs.htm", "readme.txt" };
|
||||
|
||||
int i = 0;
|
||||
File potentialRef = new File(folder, potentialFileList[i]);
|
||||
while (!potentialRef.exists() && ++i < potentialFileList.length) {
|
||||
potentialRef = new File(folder, potentialFileList[i]);
|
||||
}
|
||||
return potentialRef;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the object stored in the referenceFile field, which contains an
|
||||
* instance of the file object representing the index file of the reference
|
||||
|
||||
@@ -35,7 +35,7 @@ import processing.app.tools.Tool;
|
||||
public class ToolContribution extends LocalContribution implements Tool {
|
||||
private Tool tool;
|
||||
|
||||
private File referenceFile; // shortname/reference/index.html is one possible path
|
||||
private File referenceFile; // shortname/reference/index.html
|
||||
|
||||
static public ToolContribution load(File folder) {
|
||||
try {
|
||||
@@ -61,7 +61,7 @@ public class ToolContribution extends LocalContribution implements Tool {
|
||||
tool = (Tool) toolClass.newInstance();
|
||||
}
|
||||
|
||||
referenceFile = loadReferenceIndexFile(folder);
|
||||
referenceFile = new File(folder, "reference/index.html");
|
||||
}
|
||||
|
||||
|
||||
@@ -158,27 +158,6 @@ public class ToolContribution extends LocalContribution implements Tool {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param folder
|
||||
* The file object representing the base folder of the contribution
|
||||
* @return Returns a file object representing the index file of the reference
|
||||
*/
|
||||
protected File loadReferenceIndexFile(File folder) {
|
||||
final String potentialFileList[] = {
|
||||
"reference/index.html", "reference/index.htm",
|
||||
"documentation/index.html", "documentation/index.htm", "docs/index.html",
|
||||
"docs/index.htm", "documentation.html", "documentation.htm",
|
||||
"reference.html", "reference.htm", "docs.html", "docs.htm", "readme.txt" };
|
||||
|
||||
int i = 0;
|
||||
File potentialRef = new File(folder, potentialFileList[i]);
|
||||
while (!potentialRef.exists() && ++i < potentialFileList.length) {
|
||||
potentialRef = new File(folder, potentialFileList[i]);
|
||||
}
|
||||
return potentialRef;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the object stored in the referenceFile field, which contains an
|
||||
* instance of the file object representing the index file of the reference
|
||||
|
||||
@@ -340,8 +340,8 @@ public class JavaEditor extends Editor {
|
||||
Iterator<ToolContribution> iter = toolsList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
final ToolContribution toolContrib = iter.next();
|
||||
if (toolContrib.hasReference()) {
|
||||
final File toolRef = toolContrib.getReferenceIndexFile();
|
||||
final File toolRef = new File(toolContrib.getFolder(), "reference/index.html");
|
||||
if (toolRef.exists()) {
|
||||
JMenuItem libRefItem = new JMenuItem(toolContrib.getName());
|
||||
libRefItem.addActionListener(new ActionListener() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user