List of usage examples for org.eclipse.jdt.core IType isStructureKnown
boolean isStructureKnown() throws JavaModelException;
From source file:edu.illinois.compositerefactorings.refactorings.copymembertosubtype.CopyMemberToSubtypeRefactoringProcessor.java
License:Open Source License
/** * {@link org.eclipse.jdt.internal.corext.refactoring.structure.PushDownRefactoringProcessor#getAbstractDestinations(IProgressMonitor)} *//*from w w w. j a va2 s. c o m*/ private IType[] getAbstractDestinations(IProgressMonitor monitor) throws JavaModelException { IType[] allDirectSubclasses = getHierarchyOfDeclaringClass(monitor).getSubclasses(getDeclaringType()); List<IType> result = new ArrayList<IType>(allDirectSubclasses.length); for (int index = 0; index < allDirectSubclasses.length; index++) { IType subclass = allDirectSubclasses[index]; if (subclass.exists() && !subclass.isBinary() && !subclass.isReadOnly() && subclass.getCompilationUnit() != null && subclass.isStructureKnown()) result.add(subclass); } return result.toArray(new IType[result.size()]); }
From source file:org.eclipse.recommenders.rcp.JavaElementResolver.java
License:Open Source License
private boolean isSuccessfullyResolvedType(final IType jdtType) throws JavaModelException { return jdtType != null && jdtType.isStructureKnown(); }
From source file:org.jboss.mapper.eclipse.internal.util.Util.java
License:Open Source License
private static void populateClasses(final Shell shell, final IParent parent, final List<IType> types, final Filter filter) { try {//from w w w .j a va 2 s .c o m for (final IJavaElement element : parent.getChildren()) { if (element instanceof IType) { final IType type = (IType) element; if (type.isClass() && type.isStructureKnown() && !type.isAnonymous() && !type.isLocal() && !Flags.isAbstract(type.getFlags()) && Flags.isPublic(type.getFlags()) && (filter == null || filter.accept(type))) { types.add(type); } } else if (element instanceof IParent && !element.getPath().toString().contains("/test/") && (!(element instanceof IPackageFragmentRoot) || !((IPackageFragmentRoot) element).isExternal())) { populateClasses(shell, (IParent) element, types, filter); } } } catch (final JavaModelException e) { Activator.error(e); } }
From source file:org.jboss.tools.fuse.transformation.editor.internal.util.Util.java
License:Open Source License
private static void populateClasses(final Shell shell, final IParent parent, final List<IType> types, final Filter filter) { try {//from w w w .ja v a 2s. c om for (final IJavaElement element : parent.getChildren()) { if (element instanceof IType) { final IType type = (IType) element; if (type.isClass() && type.isStructureKnown() && !type.isAnonymous() && !type.isLocal() && !Flags.isAbstract(type.getFlags()) && Flags.isPublic(type.getFlags()) && (filter == null || filter.accept(type))) { types.add(type); } } else if (element instanceof IParent) { String path = element.getPath().toString(); if (!path.contains("/test/") //$NON-NLS-1$ && !path.endsWith("/.functions") && !path.endsWith("/" + TRANSFORMATIONS_FOLDER) //$NON-NLS-1$ //$NON-NLS-2$ && (!(element instanceof IPackageFragmentRoot) || !((IPackageFragmentRoot) element).isExternal())) populateClasses(shell, (IParent) element, types, filter); } } } catch (final JavaModelException e) { Activator.error(e); } }
From source file:org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils.java
License:Open Source License
/** * Searches and returns all the subtypes of the given superType that do not * have themselves other subtypes/*from w w w .j a va 2s . co m*/ * * @param scope * @param progressMonitor * @param searchScope * @return a list of subtypes or an empty list if none was found. * @throws CoreException * @throws JavaModelException */ public static List<IType> findSubtypes(final IJavaElement scope, final IType superType, final IProgressMonitor progressMonitor) throws CoreException, JavaModelException { final List<IType> types = new ArrayList<IType>(); if (superType != null) { final ITypeHierarchy hierarchy = JdtUtils.resolveTypeHierarchy(superType, scope, false, progressMonitor); final IType[] allSubtypes = hierarchy.getAllSubtypes(superType); for (IType subtype : allSubtypes) { if (subtype.isStructureKnown() && subtype.getJavaProject().equals(scope.getJavaProject()) && hierarchy.getAllSubtypes(subtype).length == 0) { types.add(subtype); } } } return types; }
From source file:org.springframework.ide.eclipse.core.java.Introspector.java
License:Open Source License
public static IMethod[] getMethods(IType type) throws JavaModelException { if (type == null) { return new IMethod[0]; }/*w w w . j a v a 2 s. c o m*/ if (type.isStructureKnown()) { IMethod[] methods = type.getMethods(); if (JdtUtils.isAjdtProject(type.getResource())) { Set<IMethod> itdMethods = AjdtUtils.getDeclaredMethods(type); if (itdMethods.size() > 0) { int i = methods.length; IMethod[] allMethods = new IMethod[methods.length + itdMethods.size()]; System.arraycopy(methods, 0, allMethods, 0, methods.length); for (IMethod method : itdMethods) { allMethods[i++] = method; } methods = allMethods; } } return methods; } return new IMethod[0]; }