Codota Logo
ITypeHierarchy.getAllSuperInterfaces
Code IndexAdd Codota to your IDE (free)

How to use
getAllSuperInterfaces
method
in
org.eclipse.jdt.core.ITypeHierarchy

Best Java code snippets using org.eclipse.jdt.core.ITypeHierarchy.getAllSuperInterfaces (Showing top 18 results out of 315)

  • Common ways to obtain ITypeHierarchy
private void myMethod () {
ITypeHierarchy i =
  • Codota IconIType type;type.newSupertypeHierarchy(null)
  • Codota IconCreateTypeHierarchyOperation op;op.getResult()
  • Codota IconIType type;SuperTypeHierarchyCache.getTypeHierarchy(type)
  • Smart code suggestions by Codota
}
origin: org.eclipse/org.eclipse.jdt.ui

  public Collection findInterfaces(IType type, IProgressMonitor progressMonitor) {
    ITypeHierarchy typeHierarchy;

    try {
      typeHierarchy = type.newSupertypeHierarchy(progressMonitor);

      IType[] interfaces = typeHierarchy.getAllSuperInterfaces(type);
      HashSet result = new HashSet(Arrays.asList(interfaces));

      return result;
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
    }

    return null;
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  @Override
  public Collection<IType> findInterfaces(IType type, IProgressMonitor progressMonitor) {
    ITypeHierarchy typeHierarchy;

    try {
      typeHierarchy = type.newSupertypeHierarchy(progressMonitor);

      IType[] interfaces = typeHierarchy.getAllSuperInterfaces(type);
      HashSet<IType> result = new HashSet<>(Arrays.asList(interfaces));

      return result;
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
    }

    return null;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  @Override
  public Collection<IType> findInterfaces(IType type, IProgressMonitor progressMonitor) {
    ITypeHierarchy typeHierarchy;

    try {
      typeHierarchy = type.newSupertypeHierarchy(progressMonitor);

      IType[] interfaces = typeHierarchy.getAllSuperInterfaces(type);
      HashSet<IType> result = new HashSet<>(Arrays.asList(interfaces));

      return result;
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
    }

    return null;
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public static IMethod isDeclaredInInterface(IMethod method, ITypeHierarchy hierarchy, IProgressMonitor monitor) throws JavaModelException {
  Assert.isTrue(isVirtual(method));
  IProgressMonitor subMonitor= new SubProgressMonitor(monitor, 1);
  try {
    IType[] classes= hierarchy.getAllClasses();
    subMonitor.beginTask("", classes.length); //$NON-NLS-1$
    for (int i= 0; i < classes.length; i++) {
      final IType clazz= classes[i];
      IType[] superinterfaces= null;
      if (clazz.equals(hierarchy.getType()))
        superinterfaces= hierarchy.getAllSuperInterfaces(clazz);
      else
        superinterfaces= clazz.newSupertypeHierarchy(new SubProgressMonitor(subMonitor, 1)).getAllSuperInterfaces(clazz);
      for (int j= 0; j < superinterfaces.length; j++) {
        IMethod found= Checks.findSimilarMethod(method, superinterfaces[j]);
        if (found != null && !found.equals(method))
          return found;
      }
      subMonitor.worked(1);
    }
    return null;
  } finally {
    subMonitor.done();
  }
}
origin: eclipse/eclipse.jdt.ls

public static IMethod isDeclaredInInterface(IMethod method, ITypeHierarchy hierarchy, IProgressMonitor monitor) throws JavaModelException {
  Assert.isTrue(isVirtual(method));
  IProgressMonitor subMonitor= new SubProgressMonitor(monitor, 1);
  try {
    IType[] classes= hierarchy.getAllClasses();
    subMonitor.beginTask("", classes.length); //$NON-NLS-1$
    for (int i= 0; i < classes.length; i++) {
      final IType clazz= classes[i];
      IType[] superinterfaces= null;
      if (clazz.equals(hierarchy.getType())) {
        superinterfaces= hierarchy.getAllSuperInterfaces(clazz);
      } else {
        superinterfaces= clazz.newSupertypeHierarchy(new SubProgressMonitor(subMonitor, 1)).getAllSuperInterfaces(clazz);
      }
      for (int j= 0; j < superinterfaces.length; j++) {
        IMethod found= Checks.findSimilarMethod(method, superinterfaces[j]);
        if (found != null && !found.equals(method)) {
          return found;
        }
      }
      subMonitor.worked(1);
    }
    return null;
  } finally {
    subMonitor.done();
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

public static IMethod isDeclaredInInterface(IMethod method, ITypeHierarchy hierarchy, IProgressMonitor monitor) throws JavaModelException {
  Assert.isTrue(isVirtual(method));
  IProgressMonitor subMonitor= new SubProgressMonitor(monitor, 1);
  try {
    IType[] classes= hierarchy.getAllClasses();
    subMonitor.beginTask("", classes.length); //$NON-NLS-1$
    for (int i= 0; i < classes.length; i++) {
      final IType clazz= classes[i];
      IType[] superinterfaces= null;
      if (clazz.equals(hierarchy.getType()))
        superinterfaces= hierarchy.getAllSuperInterfaces(clazz);
      else
        superinterfaces= clazz.newSupertypeHierarchy(new SubProgressMonitor(subMonitor, 1)).getAllSuperInterfaces(clazz);
      for (int j= 0; j < superinterfaces.length; j++) {
        IMethod found= Checks.findSimilarMethod(method, superinterfaces[j]);
        if (found != null && !found.equals(method))
          return found;
      }
      subMonitor.worked(1);
    }
    return null;
  } finally {
    subMonitor.done();
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Checks if the given method is declared in an interface. If the method's declaring type
 * is an interface the method returns <code>false</code> if it is only declared in that
 * interface.
 */
public static IMethod isDeclaredInInterface(IMethod method, ITypeHierarchy hierarchy, IProgressMonitor monitor) throws JavaModelException {
  Assert.isTrue(isVirtual(method));
  IProgressMonitor subMonitor= new SubProgressMonitor(monitor, 1);
  try {
    IType[] classes= hierarchy.getAllClasses();
    subMonitor.beginTask("", classes.length); //$NON-NLS-1$
    for (int i= 0; i < classes.length; i++) {
      final IType clazz= classes[i];
      IType[] superinterfaces= null;
      if (clazz.equals(hierarchy.getType()))
        superinterfaces= hierarchy.getAllSuperInterfaces(clazz);
      else
        superinterfaces= clazz.newSupertypeHierarchy(new SubProgressMonitor(subMonitor, 1)).getAllSuperInterfaces(clazz);
      for (int j= 0; j < superinterfaces.length; j++) {
        IMethod found= Checks.findSimilarMethod(method, superinterfaces[j]);
        if (found != null && !found.equals(method))
          return found;
      }
      subMonitor.worked(1);
    }
    return null;
  } finally {
    subMonitor.done();
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

  private void collectChildrenWithMissingSerialVersionId(IJavaElement[] children, IType serializable, List result) throws JavaModelException {
    for (int i= 0; i < children.length; i++) {
      IJavaElement child= children[i];
      if (child instanceof IType) {
        IType type= (IType)child;
        
        if (type.isClass()) {
          IField field= type.getField(NAME_FIELD);
          if (!field.exists()) {
            ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new NullProgressMonitor());
            IType[] interfaces= hierarchy.getAllSuperInterfaces(type);
            for (int j= 0; j < interfaces.length; j++) {
              if (interfaces[j].equals(serializable)) {
                result.add(type);
                break;
              }
            }
          }
        }
        collectChildrenWithMissingSerialVersionId(type.getChildren(), serializable, result);
      } else if (child instanceof IMethod) {
        collectChildrenWithMissingSerialVersionId(((IMethod)child).getChildren(), serializable, result);
      } else if (child instanceof IField) {
        collectChildrenWithMissingSerialVersionId(((IField)child).getChildren(), serializable, result);
      }
    }
  }
}
origin: eclipse/eclipse.jdt.ls

  private void collectChildrenWithMissingSerialVersionId(IJavaElement[] children, IType serializable, List<IType> result) throws JavaModelException {
    for (int i = 0; i < children.length; i++) {
      IJavaElement child = children[i];
      if (child instanceof IType) {
        IType type = (IType) child;
        if (type.isClass()) {
          IField field = type.getField(NAME_FIELD);
          if (!field.exists()) {
            ITypeHierarchy hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
            IType[] interfaces = hierarchy.getAllSuperInterfaces(type);
            for (int j = 0; j < interfaces.length; j++) {
              if (interfaces[j].equals(serializable)) {
                result.add(type);
                break;
              }
            }
          }
        }
        collectChildrenWithMissingSerialVersionId(type.getChildren(), serializable, result);
      } else if (child instanceof IMethod) {
        collectChildrenWithMissingSerialVersionId(((IMethod) child).getChildren(), serializable, result);
      } else if (child instanceof IField) {
        collectChildrenWithMissingSerialVersionId(((IField) child).getChildren(), serializable, result);
      }
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  private void collectChildrenWithMissingSerialVersionId(IJavaElement[] children, IType serializable, List<IType> result) throws JavaModelException {
    for (int i= 0; i < children.length; i++) {
      IJavaElement child= children[i];
      if (child instanceof IType) {
        IType type= (IType)child;
        if (type.isClass()) {
          IField field= type.getField(NAME_FIELD);
          if (!field.exists()) {
            ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new NullProgressMonitor());
            IType[] interfaces= hierarchy.getAllSuperInterfaces(type);
            for (int j= 0; j < interfaces.length; j++) {
              if (interfaces[j].equals(serializable)) {
                result.add(type);
                break;
              }
            }
          }
        }
        collectChildrenWithMissingSerialVersionId(type.getChildren(), serializable, result);
      } else if (child instanceof IMethod) {
        collectChildrenWithMissingSerialVersionId(((IMethod)child).getChildren(), serializable, result);
      } else if (child instanceof IField) {
        collectChildrenWithMissingSerialVersionId(((IField)child).getChildren(), serializable, result);
      }
    }
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  private void collectChildrenWithMissingSerialVersionId(IJavaElement[] children, IType serializable, List<IType> result) throws JavaModelException {
    for (int i= 0; i < children.length; i++) {
      IJavaElement child= children[i];
      if (child instanceof IType) {
        IType type= (IType)child;
        if (type.isClass()) {
          IField field= type.getField(NAME_FIELD);
          if (!field.exists()) {
            ITypeHierarchy hierarchy= type.newSupertypeHierarchy(new NullProgressMonitor());
            IType[] interfaces= hierarchy.getAllSuperInterfaces(type);
            for (int j= 0; j < interfaces.length; j++) {
              if (interfaces[j].equals(serializable)) {
                result.add(type);
                break;
              }
            }
          }
        }
        collectChildrenWithMissingSerialVersionId(type.getChildren(), serializable, result);
      } else if (child instanceof IMethod) {
        collectChildrenWithMissingSerialVersionId(((IMethod)child).getChildren(), serializable, result);
      } else if (child instanceof IField) {
        collectChildrenWithMissingSerialVersionId(((IField)child).getChildren(), serializable, result);
      }
    }
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden);
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden); 
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden);
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden);
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden); 
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void checkOverridden(RefactoringStatus status, IProgressMonitor pm) throws JavaModelException {
  pm.beginTask("", 9); //$NON-NLS-1$
  pm.setTaskName(RefactoringCoreMessages.InlineMethodRefactoring_checking_overridden);
  MethodDeclaration decl= fSourceProvider.getDeclaration();
  IMethod method= (IMethod) decl.resolveBinding().getJavaElement();
  if (method == null || Flags.isPrivate(method.getFlags())) {
    pm.worked(8);
    return;
  }
  IType type= method.getDeclaringType();
  ITypeHierarchy hierarchy= type.newTypeHierarchy(new SubProgressMonitor(pm, 6));
  checkSubTypes(status, method, hierarchy.getAllSubtypes(type), new SubProgressMonitor(pm, 1));
  checkSuperClasses(status, method, hierarchy.getAllSuperclasses(type), new SubProgressMonitor(pm, 1));
  checkSuperInterfaces(status, method, hierarchy.getAllSuperInterfaces(type), new SubProgressMonitor(pm, 1));
  pm.setTaskName(""); //$NON-NLS-1$
}
origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e

for (IType t : h.getAllSuperInterfaces(type)) {
 ann = getFirstDeclaredAnnotation(t, fullyQualifiedAnnotations);
 if (exists(ann)) {
org.eclipse.jdt.coreITypeHierarchygetAllSuperInterfaces

Javadoc

Returns all resolved superinterfaces (direct and indirect) of the given type. If the given type is a class, this includes all superinterfaces of all superclasses. An empty array is returned if there are no resolved superinterfaces for the given type.

NOTE: once a type hierarchy has been created, it is more efficient to query the hierarchy for superinterfaces than to query a type recursively. Querying an element performs a dynamic resolution, whereas the hierarchy returns a pre-computed result.

Popular methods of ITypeHierarchy

  • getAllSubtypes
    Returns all resolved subtypes (direct and indirect) of the given type, in no particular order, limit
  • contains
    Returns whether the given type is part of this hierarchy.
  • getAllSupertypes
    Returns all resolved supertypes of the given type, in bottom-up order. An empty array is returned if
  • getAllClasses
    Returns all classes in this type hierarchy's graph, in no particular order. Any classes in the creat
  • getAllTypes
    Returns all types in this type hierarchy's graph, in no particular order. Any types in the creation
  • getSuperclass
    Returns the resolved superclass of the given class, or null if the given class has no superclass, th
  • getAllSuperclasses
    Returns all resolved superclasses of the given class, in bottom-up order. An empty array is returned
  • refresh
    Re-computes the type hierarchy reporting progress.
  • getCachedFlags
    Return the flags associated with the given type (would be equivalent to IMember.getFlags()), or -1
  • getSubclasses
    Returns the direct resolved subclasses of the given class, in no particular order, limited to the cl
  • getSubtypes
    Returns the direct resolved subtypes of the given type, in no particular order, limited to the types
  • getSuperInterfaces
    Returns the direct resolved interfaces that the given type implements or extends, in no particular o
  • getSubtypes,
  • getSuperInterfaces,
  • getType,
  • getAllInterfaces,
  • addTypeHierarchyChangedListener,
  • exists,
  • getImplementingClasses,
  • getSupertypes,
  • removeTypeHierarchyChangedListener

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • setContentView (Activity)
  • getContentResolver (Context)
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JOptionPane (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now