Skip to content

Commit a20f119

Browse files
committed
Fixed a bug on decompiling the CLASS files stored in linked libraries, and the projects located outside the workspace
1 parent ba68ebe commit a20f119

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

jd.ide.eclipse.plugin/src/jd/ide/eclipse/editors/JDClassFileEditor.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import jd.ide.eclipse.JavaDecompilerPlugin;
1313

1414
import org.eclipse.core.resources.IFile;
15-
import org.eclipse.core.resources.ResourcesPlugin;
15+
import org.eclipse.core.resources.IResource;
1616
import org.eclipse.core.runtime.CoreException;
1717
import org.eclipse.core.runtime.IPath;
1818
import org.eclipse.core.runtime.Status;
@@ -117,11 +117,10 @@ protected void setupSourceMapper(IClassFile classFile)
117117
IPath basePath = root.getPath();
118118
File baseFile = basePath.makeAbsolute().toFile();
119119

120-
if (!baseFile.exists())
121-
{
122-
baseFile = new File(
123-
ResourcesPlugin.getWorkspace().getRoot().getLocationURI().getPath(),
124-
baseFile.getPath());
120+
if (!baseFile.exists()) {
121+
IResource resource = root.getCorrespondingResource();
122+
basePath = resource.getLocation();
123+
baseFile = basePath.makeAbsolute().toFile();
125124
}
126125

127126
// Class path
@@ -136,18 +135,14 @@ protected void setupSourceMapper(IClassFile classFile)
136135

137136
// Location of the package fragment root within the zip
138137
// (empty specifies the default root).
139-
IPath sourceAttachmentRootPath =
140-
root.getSourceAttachmentRootPath();
138+
IPath sourceAttachmentRootPath = root.getSourceAttachmentRootPath();
141139
String sourceRootPath;
142-
if (sourceAttachmentRootPath == null)
143-
{
140+
141+
if (sourceAttachmentRootPath == null) {
144142
sourceRootPath = null;
145-
}
146-
else
147-
{
143+
} else {
148144
sourceRootPath = sourceAttachmentRootPath.toString();
149-
if ((sourceRootPath != null) &&
150-
(sourceRootPath.length() == 0))
145+
if ((sourceRootPath != null) && (sourceRootPath.length() == 0))
151146
sourceRootPath = null;
152147
}
153148

0 commit comments

Comments
 (0)