Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2012-02-09 19:24:26 +0000
committerkmoore2012-02-09 19:24:26 +0000
commitb2f430c1dcb59e8f8d42facc70d3bbbf7ae5c4a6 (patch)
treebd1a3ffae6410d2669e89039572aa0292d31dd38 /common/plugins
parent9291706d4403d385381bef35b1631e5e75f8e6ab (diff)
downloadwebtools.dali-b2f430c1dcb59e8f8d42facc70d3bbbf7ae5c4a6.tar.gz
webtools.dali-b2f430c1dcb59e8f8d42facc70d3bbbf7ae5c4a6.tar.xz
webtools.dali-b2f430c1dcb59e8f8d42facc70d3bbbf7ae5c4a6.zip
370342 - cleaned up how we resolve to ITypes in both xml(to remove partial package support) and java
Diffstat (limited to 'common/plugins')
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java47
1 files changed, 31 insertions, 16 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
index c8e2122481..1b9c862173 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
@@ -82,7 +82,17 @@ public final class JDTTools {
}
}
- private static boolean typeIsSubType(IJavaProject javaProject, IType potentialSubType, String potentialSuperType) throws JavaModelException {
+ public static boolean typeIsSubType(IJavaProject javaProject, IType potentialSubType, String potentialSuperType) {
+ try {
+ return typeIsSubType_(javaProject, potentialSubType, potentialSuperType);
+ }
+ catch (JavaModelException ex) {
+ JptCommonCorePlugin.log(ex);
+ return false;
+ }
+ }
+
+ private static boolean typeIsSubType_(IJavaProject javaProject, IType potentialSubType, String potentialSuperType) throws JavaModelException {
return typeIsSubType(javaProject, potentialSubType, javaProject.findType(potentialSuperType));
}
@@ -241,7 +251,7 @@ public final class JDTTools {
if (typeIsOtherValidBasicType(fullyQualifiedName)) {
return true;
}
- if (typeIsSubType(javaProject, type, SERIALIZABLE_CLASS_NAME)) {
+ if (typeIsSubType_(javaProject, type, SERIALIZABLE_CLASS_NAME)) {
return true;
}
if (type.isEnum()) {
@@ -293,26 +303,31 @@ public final class JDTTools {
public static boolean classHasPublicZeroArgConstructor(IJavaProject javaProject, String className) {
if (javaProject != null && className != null) {
- boolean hasDefinedConstructor = false;
IType type = findType(javaProject, className);
if (type != null) {
- try {
- for (IMethod method : type.getMethods()) {
- if (method.isConstructor()) {
- if ((method.getNumberOfParameters() == 0) && (Flags.isPublic(method.getFlags()))) {
- return true;
- }
- hasDefinedConstructor = true;
- }
- }
- //When there's no defined constructor, the default constructor is in place.
- if (!hasDefinedConstructor) {
+ return typeHasPublicZeroArgConstructor(type);
+ }
+ }
+ return false;
+ }
+
+ public static boolean typeHasPublicZeroArgConstructor(IType type) {
+ boolean hasDefinedConstructor = false;
+ try {
+ for (IMethod method : type.getMethods()) {
+ if (method.isConstructor()) {
+ if ((method.getNumberOfParameters() == 0) && (Flags.isPublic(method.getFlags()))) {
return true;
}
- } catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ hasDefinedConstructor = true;
}
}
+ //When there's no defined constructor, the default constructor is in place.
+ if (!hasDefinedConstructor) {
+ return true;
+ }
+ } catch (JavaModelException ex) {
+ JptCommonCorePlugin.log(ex);
}
return false;
}

Back to the top