Lines 20-33
Link Here
|
20 |
import org.eclipse.jdt.core.JavaCore; |
20 |
import org.eclipse.jdt.core.JavaCore; |
21 |
import org.eclipse.jdt.core.JavaModelException; |
21 |
import org.eclipse.jdt.core.JavaModelException; |
22 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
22 |
import org.eclipse.jdt.core.WorkingCopyOwner; |
|
|
23 |
import org.eclipse.jdt.core.compiler.CharOperation; |
23 |
import org.eclipse.jdt.core.compiler.IProblem; |
24 |
import org.eclipse.jdt.core.compiler.IProblem; |
24 |
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; |
25 |
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; |
25 |
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; |
26 |
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; |
26 |
import org.eclipse.jdt.internal.compiler.ast.Statement; |
27 |
import org.eclipse.jdt.internal.compiler.ast.Statement; |
27 |
import org.eclipse.jdt.internal.compiler.env.IBinaryType; |
28 |
import org.eclipse.jdt.internal.compiler.env.IBinaryType; |
|
|
29 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
28 |
import org.eclipse.jdt.internal.core.*; |
30 |
import org.eclipse.jdt.internal.core.*; |
29 |
import org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner; |
|
|
30 |
import org.eclipse.jdt.internal.core.PackageFragment; |
31 |
import org.eclipse.jdt.internal.core.util.CodeSnippetParsingUtil; |
31 |
import org.eclipse.jdt.internal.core.util.CodeSnippetParsingUtil; |
32 |
import org.eclipse.jdt.internal.core.util.RecordedParsingInformation; |
32 |
import org.eclipse.jdt.internal.core.util.RecordedParsingInformation; |
33 |
import org.eclipse.jdt.internal.core.util.Util; |
33 |
import org.eclipse.jdt.internal.core.util.Util; |
Lines 756-763
Link Here
|
756 |
PackageFragment packageFragment = (PackageFragment) this.classFileSource.getParent(); |
756 |
PackageFragment packageFragment = (PackageFragment) this.classFileSource.getParent(); |
757 |
BinaryType type = (BinaryType) this.classFileSource.getType(); |
757 |
BinaryType type = (BinaryType) this.classFileSource.getType(); |
758 |
IBinaryType binaryType = (IBinaryType) type.getElementInfo(); |
758 |
IBinaryType binaryType = (IBinaryType) type.getElementInfo(); |
759 |
String fileName = new String(binaryType.getFileName()); // file name is used to recreate the Java element, so it has to be the .class file name |
759 |
// file name is used to recreate the Java element, so it has to be the toplevel .class file name |
760 |
sourceUnit = new BasicCompilationUnit(sourceString.toCharArray(), Util.toCharArrays(packageFragment.names), fileName, this.project); |
760 |
char[] fileName = binaryType.getFileName(); |
|
|
761 |
int firstDollar = CharOperation.indexOf('$', fileName); |
762 |
if (firstDollar != -1) { |
763 |
char[] suffix = SuffixConstants.SUFFIX_class; |
764 |
int suffixLength = suffix.length; |
765 |
char[] newFileName = new char[firstDollar + suffixLength]; |
766 |
System.arraycopy(fileName, 0, newFileName, 0, firstDollar); |
767 |
System.arraycopy(suffix, 0, newFileName, firstDollar, suffixLength); |
768 |
fileName = newFileName; |
769 |
} |
770 |
sourceUnit = new BasicCompilationUnit(sourceString.toCharArray(), Util.toCharArrays(packageFragment.names), new String(fileName), this.project); |
761 |
element = this.classFileSource; |
771 |
element = this.classFileSource; |
762 |
} catch(JavaModelException e) { |
772 |
} catch(JavaModelException e) { |
763 |
// an error occured accessing the java element |
773 |
// an error occured accessing the java element |