1212import jd .ide .eclipse .JavaDecompilerPlugin ;
1313
1414import org .eclipse .core .resources .IFile ;
15- import org .eclipse .core .resources .ResourcesPlugin ;
15+ import org .eclipse .core .resources .IResource ;
1616import org .eclipse .core .runtime .CoreException ;
1717import org .eclipse .core .runtime .IPath ;
1818import 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