diff options
author | kmoore | 2012-04-25 20:57:08 +0000 |
---|---|---|
committer | kmoore | 2012-04-25 20:57:08 +0000 |
commit | 5527924a79f4ac45d733b05f16cae56392467905 (patch) | |
tree | d9d4cd9c27d0ed913806df32493116b1cdb8622d /common | |
parent | d0977b83c90eb0f0087a243e60b1004f5fdae909 (diff) | |
download | webtools.dali-5527924a79f4ac45d733b05f16cae56392467905.tar.gz webtools.dali-5527924a79f4ac45d733b05f16cae56392467905.tar.xz webtools.dali-5527924a79f4ac45d733b05f16cae56392467905.zip |
Bug 336403 - Performance: Project open hangs UI for ~30s on initial open - large jars in the project
Diffstat (limited to 'common')
6 files changed, 139 insertions, 114 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java index fa594465fd..82dad91135 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -11,6 +11,7 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.IType; @@ -47,24 +48,24 @@ abstract class BinaryAbstractType protected BinaryAbstractType(JavaResourceNode parent, IType type) { super(parent, new TypeAdapter(type)); - this.name = this.buildName(); - this.qualifiedName = this.buildQualifiedName(); - this.packageName = this.buildPackageName(); - this.declaringTypeName = this.buildDeclaringTypeName(); - this.memberType = this.buildMemberType(); + this.name = this.buildName(type); + this.qualifiedName = this.buildQualifiedName(type); + this.packageName = this.buildPackageName(type); + this.declaringTypeName = this.buildDeclaringTypeName(type); + this.memberType = this.buildMemberType(type); } // ********** overrides ********** @Override - public void update() { - super.update(); - this.setName(this.buildName()); - this.setQualifiedName(this.buildQualifiedName()); - this.setPackageName(this.buildPackageName()); - this.setDeclaringTypeName(this.buildDeclaringTypeName()); - this.setMemberType(this.buildMemberType()); + protected void update(IMember member) { + super.update(member); + this.setName(this.buildName((IType) member)); + this.setQualifiedName(this.buildQualifiedName((IType) member)); + this.setPackageName(this.buildPackageName((IType) member)); + this.setDeclaringTypeName(this.buildDeclaringTypeName((IType) member)); + this.setMemberType(this.buildMemberType((IType) member)); } @Override @@ -86,8 +87,8 @@ abstract class BinaryAbstractType this.firePropertyChanged(NAME_PROPERTY, old, name); } - private String buildName() { - return this.getMember().getElementName(); + private String buildName(IType type) { + return type.getElementName(); } // ***** qualified name @@ -101,8 +102,8 @@ abstract class BinaryAbstractType this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName); } - private String buildQualifiedName() { - return this.getMember().getFullyQualifiedName('.'); // no parameters are included here + private String buildQualifiedName(IType type) { + return type.getFullyQualifiedName('.'); // no parameters are included here } // ***** package @@ -116,8 +117,8 @@ abstract class BinaryAbstractType this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, packageName); } - private String buildPackageName() { - return this.getMember().getPackageFragment().getElementName(); + private String buildPackageName(IType type) { + return type.getPackageFragment().getElementName(); } public boolean isIn(IPackageFragment packageFragment) { @@ -144,8 +145,8 @@ abstract class BinaryAbstractType this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName); } - private String buildDeclaringTypeName() { - IType declaringType = this.getMember().getDeclaringType(); + private String buildDeclaringTypeName(IType type) { + IType declaringType = type.getDeclaringType(); return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here } @@ -161,9 +162,9 @@ abstract class BinaryAbstractType this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType); } - private boolean buildMemberType() { + private boolean buildMemberType(IType type) { try { - return this.getMember().isMember(); + return type.isMember(); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java index 4db7f3edb6..d3deae8981 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -16,6 +16,7 @@ import java.util.HashSet; import java.util.List; import java.util.Vector; import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; @@ -58,7 +59,8 @@ abstract class BinaryAttribute protected BinaryAttribute(JavaResourceType parent, Adapter adapter) { super(parent, adapter); - this.modifiers = this.buildModifiers(); + IMember member = adapter.getElement(); + this.modifiers = this.buildModifiers(member); String typeSignature = getTypeSignature(); Iterable<ITypeParameter> typeParameters = getAdapter().getTypeParameters(); @@ -68,7 +70,7 @@ abstract class BinaryAttribute this.typeArrayComponentTypeName = buildTypeArrayComponentTypeName(typeSignature, typeParameters); this.typeTypeArgumentNames.addAll(buildTypeTypeArgumentNames(typeSignature, typeParameters)); - IType type = getType(); + IType type = this.getType(member.getJavaProject()); // if the type is an array, then the following will be false or empty this.typeIsInterface = this.buildTypeIsInterface(type); this.typeIsEnum = this.buildTypeIsEnum(type); @@ -76,13 +78,11 @@ abstract class BinaryAttribute this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(type)); } - // ******** overrides ******** @Override public void update() { super.update(); - this.setModifiers(this.buildModifiers()); String typeSignature = getTypeSignature(); Iterable<ITypeParameter> typeParameters = getAdapter().getTypeParameters(); @@ -91,8 +91,15 @@ abstract class BinaryAttribute setTypeArrayDimensionality(buildTypeArrayDimensionality(typeSignature)); setTypeArrayComponentTypeName(buildTypeArrayComponentTypeName(typeSignature, typeParameters)); setTypeTypeArgumentNames(buildTypeTypeArgumentNames(typeSignature, typeParameters)); + } + + + @Override + protected void update(IMember member) { + super.update(member); + this.setModifiers(this.buildModifiers(member)); - IType type = this.getType(); // if the type is an array, then the following will be false or empty + IType type = this.getType(member.getJavaProject()); // if the type is an array, then the following will be false or empty this.setTypeIsInterface(this.buildTypeIsInterface(type)); this.setTypeIsEnum(this.buildTypeIsEnum(type)); this.setTypeSuperclassNames(this.buildTypeSuperclassNames(type)); @@ -151,9 +158,9 @@ abstract class BinaryAttribute /** * zero seems like a reasonable default... */ - private int buildModifiers() { + private int buildModifiers(IMember member) { try { - return this.getMember().getFlags(); + return member.getFlags(); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return 0; @@ -318,7 +325,7 @@ abstract class BinaryAttribute for (String interfaceSignature : this.getSuperInterfaceTypeSignatures(type)) { String interfaceName = convertTypeSignatureToTypeName(interfaceSignature); names.add(interfaceName); - IType interfaceType = this.findType(interfaceName); + IType interfaceType = this.findType(interfaceName, type.getJavaProject()); if (interfaceType != null) { this.addInterfaceNamesTo(interfaceType, names); // recurse } @@ -360,7 +367,7 @@ abstract class BinaryAttribute } private IType findSuperclass(IType type) { - return this.findTypeBySignature(this.getSuperclassSignature(type)); + return this.findTypeBySignature(this.getSuperclassSignature(type), type.getJavaProject()); } private String getSuperclassSignature(IType type) { @@ -381,27 +388,23 @@ abstract class BinaryAttribute } } - private IType findTypeBySignature(String typeSignature) { - return (typeSignature == null) ? null : this.findType(convertTypeSignatureToTypeName_(typeSignature)); + private IType findTypeBySignature(String typeSignature, IJavaProject javaProject) { + return (typeSignature == null) ? null : findType(convertTypeSignatureToTypeName_(typeSignature), javaProject); } - private IType getType() { - return (this.typeName == null) ? null : this.findType(this.typeName); + private IType getType(IJavaProject javaProject) { + return (this.typeName == null) ? null : findType(this.typeName, javaProject); } - private IType findType(String fullyQualifiedName) { + private static IType findType(String fullyQualifiedName, IJavaProject javaProject) { try { - return this.getJavaProject().findType(fullyQualifiedName); + return javaProject.findType(fullyQualifiedName); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return null; } } - private IJavaProject getJavaProject() { - return this.getMember().getJavaProject(); - } - // ********** adapters ********** diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java index 0e10c700cb..c7b38f8529 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java @@ -43,26 +43,29 @@ abstract class BinaryMember public BinaryMember(JavaResourceNode parent, Adapter adapter) { super(parent, adapter); - this.final_ = this.buildFinal(); - this.transient_ = this.buildTransient(); - this.public_ = this.buildPublic(); - this.static_ = this.buildStatic(); - this.protected_ = this.buildProtected(); + IMember member = adapter.getElement(); + this.final_ = this.buildFinal(member); + this.transient_ = this.buildTransient(member); + this.public_ = this.buildPublic(member); + this.static_ = this.buildStatic(member); + this.protected_ = this.buildProtected(member); } - // ********** updating ********** @Override public void update() { super.update(); - this.setFinal(this.buildFinal()); - this.setTransient(this.buildTransient()); - this.setPublic(this.buildPublic()); - this.setStatic(this.buildStatic()); - this.setProtected(this.buildProtected()); + this.update(this.getMember()); } + protected void update(IMember member) { + this.setFinal(this.buildFinal(member)); + this.setTransient(this.buildTransient(member)); + this.setPublic(this.buildPublic(member)); + this.setStatic(this.buildStatic(member)); + this.setProtected(this.buildProtected(member)); + } // ********** simple state ********** @@ -77,9 +80,9 @@ abstract class BinaryMember this.firePropertyChanged(FINAL_PROPERTY, old, final_); } - private boolean buildFinal() { + private boolean buildFinal(IMember member) { try { - return Flags.isFinal(this.getMember().getFlags()); + return Flags.isFinal(member.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; @@ -97,9 +100,9 @@ abstract class BinaryMember this.firePropertyChanged(TRANSIENT_PROPERTY, old, transient_); } - private boolean buildTransient() { + private boolean buildTransient(IMember member) { try { - return Flags.isTransient(this.getMember().getFlags()); + return Flags.isTransient(member.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; @@ -117,9 +120,9 @@ abstract class BinaryMember this.firePropertyChanged(PUBLIC_PROPERTY, old, public_); } - private boolean buildPublic() { + private boolean buildPublic(IMember member) { try { - return Flags.isPublic(this.getMember().getFlags()); + return Flags.isPublic(member.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; @@ -137,9 +140,9 @@ abstract class BinaryMember this.firePropertyChanged(STATIC_PROPERTY, old, static_); } - private boolean buildStatic() { + private boolean buildStatic(IMember member) { try { - return Flags.isStatic(this.getMember().getFlags()); + return Flags.isStatic(member.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; @@ -157,9 +160,9 @@ abstract class BinaryMember this.firePropertyChanged(PROTECTED_PROPERTY, old, protected_); } - private boolean buildProtected() { + private boolean buildProtected(IMember member) { try { - return Flags.isProtected(this.getMember().getFlags()); + return Flags.isProtected(member.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java index 6570371ae7..fbdd9bea91 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java @@ -14,6 +14,7 @@ import java.util.List; import java.util.Vector; import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.ILocalVariable; +import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.ITypeParameter; import org.eclipse.jdt.core.JavaModelException; @@ -51,13 +52,12 @@ final class BinaryMethod } // ***** overrides ***** - - @Override - public void update() { - super.update(); - this.setConstructor(this.buildConstructor()); - this.setParameterTypeNames(this.buildParameterTypeNames()); + @Override + protected void update(IMember member) { + super.update(member); + this.setConstructor(this.buildConstructor((IMethod) member)); + this.setParameterTypeNames(this.buildParameterTypeNames((IMethod) member)); } public void initialize(MethodDeclaration methodDeclaration) { @@ -95,9 +95,9 @@ final class BinaryMethod return this.parameterTypeNames.size(); } - private List<String> buildParameterTypeNames() { + private List<String> buildParameterTypeNames(IMethod method) { ArrayList<String> names = new ArrayList<String>(); - for (ILocalVariable parameter : this.getParameters(this.getMember())) { + for (ILocalVariable parameter : this.getParameters(method)) { names.add(parameter.getElementName());//TODO is this right? } return names; @@ -129,9 +129,9 @@ final class BinaryMethod this.firePropertyChanged(CONSTRUCTOR_PROPERTY, old, isConstructor); } - private boolean buildConstructor() { + private boolean buildConstructor(IMethod method) { try { - return this.getMember().isConstructor(); + return method.isConstructor(); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java index 5550d24d9d..bbfdf84c37 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -12,6 +12,7 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary; import java.util.ArrayList; import java.util.Collection; import java.util.Vector; +import org.eclipse.jdt.core.IAnnotation; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IPackageFragment; @@ -22,6 +23,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType; import org.eclipse.jpt.common.core.resource.java.JavaResourceClassFile; import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragment; import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; @@ -56,31 +58,46 @@ final class BinaryPackageFragment private Collection<JavaResourceClassFile> buildClassFiles() { IJavaElement[] children = this.getJDTChildren(); ArrayList<JavaResourceClassFile> result = new ArrayList<JavaResourceClassFile>(children.length); + Collection<String> annotationNames = CollectionTools.collection(this.getAnnotationProvider().getAnnotationNames()); for (IJavaElement child : children) { IClassFile jdtClassFile = (IClassFile) child; IType jdtType = jdtClassFile.getType(); - if (typeIsRelevant(jdtType)) { - JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType); - if (classFile.getType().isAnnotated()) { // we only hold annotated types - result.add(classFile); - } + if (typeIsRelevant(jdtType, annotationNames)) { + result.add(new BinaryClassFile(this, jdtClassFile, jdtType)); } } return result; } //we will limit to classes, interfaces, and enums. Annotation types will be ignored. - static boolean typeIsRelevant(IType type) { + static boolean typeIsRelevant(IType type, Collection<String> annotationNames) { try { return (type != null) && type.exists() - && (type.isClass() || type.isInterface()|| type.isEnum()); + && (type.isClass() || type.isInterface() || type.isEnum()) + && typeHasAnnotations(type, annotationNames); // we only hold annotated types } catch (JavaModelException e) { return false; } } + static boolean typeHasAnnotations(IType type, Collection<String> annotationNames) { + IAnnotation[] annotations; + try { + annotations = type.getAnnotations(); + } + catch (JavaModelException e) { + return false; + } + for (IAnnotation annotation : annotations) { + if (annotationNames.contains(annotation.getElementName())) { + return true; + } + } + return false; + } + // ********** JarResourceNode implementation ********** @Override diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java index 33c4f9de52..2ae0b6d0c0 100644 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java +++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java @@ -13,6 +13,7 @@ import java.util.Collection; import java.util.Vector; import org.eclipse.jdt.core.Flags; import org.eclipse.jdt.core.IField; +import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; @@ -53,12 +54,12 @@ final class BinaryType BinaryType(JavaResourceNode parent, IType type) { super(parent, type); - this.superclassQualifiedName = this.buildSuperclassQualifiedName(); - this.abstract_ = this.buildAbstract(); - this.hasNoArgConstructor = this.buildHasNoArgConstructor(); - this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(); - this.fields = this.buildFields(); - this.methods = this.buildMethods(); + this.superclassQualifiedName = this.buildSuperclassQualifiedName(type); + this.abstract_ = this.buildAbstract(type); + this.hasNoArgConstructor = this.buildHasNoArgConstructor(type); + this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(type); + this.fields = this.buildFields(type); + this.methods = this.buildMethods(type); } public Kind getKind() { @@ -69,23 +70,23 @@ final class BinaryType // ********** overrides ********** @Override - public void update() { - super.update(); - this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName()); - this.setAbstract(this.buildAbstract()); - this.setHasNoArgConstructor(this.buildHasNoArgConstructor()); - this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor()); - this.updateFields(); - this.updateMethods(); + protected void update(IMember member) { + super.update(member); + this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName((IType) member)); + this.setAbstract(this.buildAbstract((IType) member)); + this.setHasNoArgConstructor(this.buildHasNoArgConstructor((IType) member)); + this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor((IType) member)); + this.updateFields((IType) member); + this.updateMethods((IType) member); } // TODO - private void updateFields() { + private void updateFields(IType type) { throw new UnsupportedOperationException(); } // TODO - private void updateMethods() { + private void updateMethods(IType type) { throw new UnsupportedOperationException(); } @@ -104,13 +105,13 @@ final class BinaryType this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName); } - private String buildSuperclassQualifiedName() { - return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature()); + private String buildSuperclassQualifiedName(IType type) { + return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature(type)); } - private String getSuperclassTypeSignature() { + private String getSuperclassTypeSignature(IType type) { try { - return this.getMember().getSuperclassTypeSignature(); + return type.getSuperclassTypeSignature(); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return null; @@ -129,9 +130,9 @@ final class BinaryType this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_); } - private boolean buildAbstract() { + private boolean buildAbstract(IType type) { try { - return Flags.isAbstract(this.getMember().getFlags()); + return Flags.isAbstract(type.getFlags()); } catch (JavaModelException ex) { JptCommonCorePlugin.log(ex); return false; @@ -149,13 +150,13 @@ final class BinaryType this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor); } - private boolean buildHasNoArgConstructor() { - return this.findNoArgConstructor() != null; + private boolean buildHasNoArgConstructor(IType type) { + return this.findNoArgConstructor(type) != null; } - private IMethod findNoArgConstructor() { + private IMethod findNoArgConstructor(IType type) { try { - for (IMethod method : this.getMember().getMethods()) { + for (IMethod method : type.getMethods()) { if (method.isConstructor()) { return method; } @@ -178,8 +179,8 @@ final class BinaryType this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, hasPrivateNoArgConstructor); } - private boolean buildHasPrivateNoArgConstructor() { - IMethod method = this.findNoArgConstructor(); + private boolean buildHasPrivateNoArgConstructor(IType type) { + IMethod method = this.findNoArgConstructor(type); try { return method != null && Flags.isPrivate(method.getFlags()); } @@ -315,8 +316,8 @@ final class BinaryType this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION); } - private Vector<JavaResourceField> buildFields() { - IField[] jdtFields = this.getFields(this.getMember()); + private Vector<JavaResourceField> buildFields(IType type) { + IField[] jdtFields = this.getFields(type); Vector<JavaResourceField> result = new Vector<JavaResourceField>(jdtFields.length); for (IField jdtField : jdtFields) { result.add(this.buildField(jdtField)); @@ -362,8 +363,8 @@ final class BinaryType this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION); } - private Vector<JavaResourceMethod> buildMethods() { - IMethod[] jdtMethods = this.getMethods(this.getMember()); + private Vector<JavaResourceMethod> buildMethods(IType type) { + IMethod[] jdtMethods = this.getMethods(type); Vector<JavaResourceMethod> result = new Vector<JavaResourceMethod>(jdtMethods.length); for (IMethod jdtMethod : jdtMethods) { result.add(this.buildMethod(jdtMethod)); |