Skip to content

Commit cc68c83

Browse files
committed
Remove extra ways for references to be included
1 parent bd2dd14 commit cc68c83

4 files changed

Lines changed: 7 additions & 55 deletions

File tree

app/src/processing/app/Editor.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,12 +1279,8 @@ public void showReferenceFile(File file) {
12791279
e.printStackTrace();
12801280
}
12811281

1282-
if (file.toString().endsWith(".txt"))
1283-
// To enable readme.txt files to open as well
1284-
Base.openFolder(file);
1285-
else
1286-
// Prepend with file:// and also encode spaces & other characters
1287-
Base.openURL(file.toURI().toString());
1282+
// Prepend with file:// and also encode spaces & other characters
1283+
Base.openURL(file.toURI().toString());
12881284
}
12891285

12901286

app/src/processing/app/Library.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Library extends LocalContribution {
1313
//protected File folder; // /path/to/shortname
1414
protected File libraryFolder; // shortname/library
1515
protected File examplesFolder; // shortname/examples
16-
protected File referenceFile; // shortname/reference/index.html is one possible path
16+
protected File referenceFile; // shortname/reference/index.html
1717

1818
/**
1919
* Subfolder for grouping libraries in a menu. Basic subfolder support
@@ -212,8 +212,6 @@ private Library(File folder, String groupName) {
212212

213213
// get the path for all .jar files in this code folder
214214
packageList = Base.packageListFromClassPath(getClassPath());
215-
216-
referenceFile = loadReferenceIndexFile(folder);
217215
}
218216

219217

@@ -518,27 +516,6 @@ public ContributionType getType() {
518516
}
519517

520518

521-
/**
522-
* @param folder
523-
* The file object representing the base folder of the contribution
524-
* @return Returns a file object representing the index file of the reference
525-
*/
526-
protected File loadReferenceIndexFile(File folder) {
527-
final String potentialFileList[] = {
528-
"reference/index.html", "reference/index.htm",
529-
"documentation/index.html", "documentation/index.htm", "docs/index.html",
530-
"docs/index.htm", "documentation.html", "documentation.htm",
531-
"reference.html", "reference.htm", "docs.html", "docs.htm", "readme.txt" };
532-
533-
int i = 0;
534-
File potentialRef = new File(folder, potentialFileList[i]);
535-
while (!potentialRef.exists() && ++i < potentialFileList.length) {
536-
potentialRef = new File(folder, potentialFileList[i]);
537-
}
538-
return potentialRef;
539-
}
540-
541-
542519
/**
543520
* Returns the object stored in the referenceFile field, which contains an
544521
* instance of the file object representing the index file of the reference

app/src/processing/app/contrib/ToolContribution.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
public class ToolContribution extends LocalContribution implements Tool {
3636
private Tool tool;
3737

38-
private File referenceFile; // shortname/reference/index.html is one possible path
38+
private File referenceFile; // shortname/reference/index.html
3939

4040
static public ToolContribution load(File folder) {
4141
try {
@@ -61,7 +61,7 @@ private ToolContribution(File folder) throws Exception {
6161
tool = (Tool) toolClass.newInstance();
6262
}
6363

64-
referenceFile = loadReferenceIndexFile(folder);
64+
referenceFile = new File(folder, "reference/index.html");
6565
}
6666

6767

@@ -158,27 +158,6 @@ public ContributionType getType() {
158158
}
159159

160160

161-
/**
162-
* @param folder
163-
* The file object representing the base folder of the contribution
164-
* @return Returns a file object representing the index file of the reference
165-
*/
166-
protected File loadReferenceIndexFile(File folder) {
167-
final String potentialFileList[] = {
168-
"reference/index.html", "reference/index.htm",
169-
"documentation/index.html", "documentation/index.htm", "docs/index.html",
170-
"docs/index.htm", "documentation.html", "documentation.htm",
171-
"reference.html", "reference.htm", "docs.html", "docs.htm", "readme.txt" };
172-
173-
int i = 0;
174-
File potentialRef = new File(folder, potentialFileList[i]);
175-
while (!potentialRef.exists() && ++i < potentialFileList.length) {
176-
potentialRef = new File(folder, potentialFileList[i]);
177-
}
178-
return potentialRef;
179-
}
180-
181-
182161
/**
183162
* Returns the object stored in the referenceFile field, which contains an
184163
* instance of the file object representing the index file of the reference

app/src/processing/mode/java/JavaEditor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ private boolean addToolReferencesToSubMenu(ArrayList<ToolContribution> toolsList
340340
Iterator<ToolContribution> iter = toolsList.iterator();
341341
while (iter.hasNext()) {
342342
final ToolContribution toolContrib = iter.next();
343-
if (toolContrib.hasReference()) {
344-
final File toolRef = toolContrib.getReferenceIndexFile();
343+
final File toolRef = new File(toolContrib.getFolder(), "reference/index.html");
344+
if (toolRef.exists()) {
345345
JMenuItem libRefItem = new JMenuItem(toolContrib.getName());
346346
libRefItem.addActionListener(new ActionListener() {
347347

0 commit comments

Comments
 (0)