Skip to content

Commit 917d1b3

Browse files
committed
FileFunctions: deprecated getSourcePath
The common case these days is to open the source code in the browser -- typically on GitHub, but whatever SCM URL the POM lists.
1 parent 4dfc23a commit 917d1b3

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/main/java/org/scijava/ui/swing/script/FileFunctions.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ public boolean isBinaryFile(final String path) {
152152
}
153153

154154
/**
155-
* Make a sensible effort to get the path of the source for a class.
155+
* @deprecated Use {@link #getSourceURL(String)} instead.
156+
* @throws ClassNotFoundException
156157
*/
157-
public String getSourcePath(final String className)
158+
@Deprecated
159+
public String getSourcePath(
160+
@SuppressWarnings("unused") final String className)
158161
throws ClassNotFoundException
159162
{
160163
// move updater's stuff into ij-core and re-use here

src/main/java/org/scijava/ui/swing/script/TextEditor.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,22 +1402,14 @@ else if (source == openMacroFunctions) try {
14021402
else if (source == extractSourceJar) extractSourceJar();
14031403
else if (source == openSourceForClass) {
14041404
final String className = getSelectedClassNameOrAsk();
1405-
if (className != null) try {
1406-
final String path = new FileFunctions(this).getSourcePath(className);
1407-
if (path != null) open(new File(path));
1408-
else {
1409-
final String url = new FileFunctions(this).getSourceURL(className);
1410-
try {
1411-
platformService.open(new URL(url));
1412-
}
1413-
catch (final Throwable e) {
1414-
handleException(e);
1415-
}
1405+
if (className != null) {
1406+
final String url = new FileFunctions(this).getSourceURL(className);
1407+
try {
1408+
platformService.open(new URL(url));
1409+
}
1410+
catch (final Throwable e) {
1411+
handleException(e);
14161412
}
1417-
}
1418-
catch (final ClassNotFoundException e) {
1419-
log.debug(e);
1420-
error("Could not open source for class " + className);
14211413
}
14221414
}
14231415
/* TODO

0 commit comments

Comments
 (0)