Codota Logo
IType.getDeclaringType
Code IndexAdd Codota to your IDE (free)

How to use
getDeclaringType
method
in
org.eclipse.jdt.core.IType

Best Java code snippets using org.eclipse.jdt.core.IType.getDeclaringType (Showing top 20 results out of 315)

  • Common ways to obtain IType
private void myMethod () {
IType i =
  • Codota IconIMethod method;method.getDeclaringType()
  • Codota IconIJavaProject javaProject;String fullyQualifiedName;javaProject.findType(fullyQualifiedName)
  • Codota IconIMember member;member.getDeclaringType()
  • Smart code suggestions by Codota
}
origin: org.projectlombok/lombok

while (declaringType != null) {
  typeStack.push(declaringType);
  declaringType = declaringType.getDeclaringType();
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Returns <code>true</code> if <code>type</code> is not a top-level type, <code>false</code> if it is.
 *
 * @param type the type to test
 * @return <code>true</code> if <code>type</code> is an inner type
 */
private boolean isInnerType(IType type) {
  return type.getDeclaringType() != null;
}
origin: org.eclipse/org.eclipse.jdt.ui

private static boolean isEqualOrEnclosedType(IType inner, IType outer) {
  while (inner != null) {
    if (inner.equals(outer))
      return true;
    else
      inner= inner.getDeclaringType();
  }
  return false;
}
origin: eclipse/eclipse.jdt.ls

private static IType findEnclosingType(IType type, String newName) {
  IType enclosing = type.getDeclaringType();
  while (enclosing != null) {
    if (newName.equals(enclosing.getElementName())) {
      return enclosing;
    } else {
      enclosing = enclosing.getDeclaringType();
    }
  }
  return null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static IType findEnclosingType(IType type, String newName) {
  IType enclosing= type.getDeclaringType();
  while (enclosing != null){
    if (newName.equals(enclosing.getElementName()))
      return enclosing;
    else
      enclosing= enclosing.getDeclaringType();
  }
  return null;
}
origin: org.eclipse/org.eclipse.jdt.ui

private static IType findEnclosingType(IType type, String newName) {
  IType enclosing= type.getDeclaringType();
  while (enclosing != null){
    if (newName.equals(enclosing.getElementName()))
      return enclosing;
    else 
      enclosing= enclosing.getDeclaringType();	
  }
  return null;
}

origin: org.eclipse/org.eclipse.jdt.ui

public static boolean isInsideLocalType(IType type) throws JavaModelException {
  while (type != null) {
    if (type.isLocal())
      return true;
    type= type.getDeclaringType();
  }
  return false;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static boolean containsTopLevelTypes(IStructuredSelection selection) {
  for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
    Object each= iter.next();
    if (each instanceof IType && ((IType)each).getDeclaringType() == null)
      return true;
  }
  return false;
}
origin: org.eclipse/org.eclipse.jdt.ui

private static List getDeclaringTypes(IType type) {
  IType declaringType= type.getDeclaringType();
  if (declaringType == null)
    return new ArrayList(0);
  List result= getDeclaringTypes(declaringType);
  result.add(declaringType);
  return result;
}
origin: org.eclipse/org.eclipse.jdt.ui

private static boolean containsTopLevelTypes(IStructuredSelection selection) {
  for (Iterator iter = selection.iterator(); iter.hasNext();) {
    Object each= iter.next();
    if ((each instanceof IType) && ((IType)each).getDeclaringType() == null)
      return true;
  }
  return false;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public static boolean isInsideLocalType(IType type) throws JavaModelException {
  while (type != null) {
    if (type.isLocal())
      return true;
    type= type.getDeclaringType();
  }
  return false;
}
origin: eclipse/eclipse.jdt.ls

private static boolean isPrimaryType(IType type) {
  String cuName = type.getCompilationUnit().getElementName();
  String typeName = type.getElementName();
  return type.getDeclaringType() == null && JavaCore.removeJavaLikeExtension(cuName).equals(typeName);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private Type createEnclosingType(final AST ast) throws JavaModelException {
  Assert.isNotNull(ast);
  final ITypeParameter[] parameters= fType.getDeclaringType().getTypeParameters();
  final Type type= ASTNodeFactory.newType(ast, fType.getDeclaringType().getTypeQualifiedName('.'));
  if (parameters.length > 0) {
    final ParameterizedType parameterized= ast.newParameterizedType(type);
    for (int index= 0; index < parameters.length; index++)
      parameterized.typeArguments().add(ast.newSimpleType(ast.newSimpleName(parameters[index].getElementName())));
    return parameterized;
  }
  return type;
}
origin: org.eclipse/org.eclipse.jst.j2ee

/**
 * Returns the fully qualified name of a type's container. (package name or enclosing type name)
 */
public static String getTypeContainerName(IType type) {
  IType outerType= type.getDeclaringType();
  if (outerType != null) {
    return getFullyQualifiedName(outerType);
  } else {
    return type.getPackageFragment().getElementName();
  }
}

origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean isInsideTypeNestedInDeclaringType(ASTNode node) {
  Assert.isTrue((node instanceof ClassInstanceCreation) || (node instanceof SuperConstructorInvocation));
  final AbstractTypeDeclaration declaration= ASTNodes.getParent(node, AbstractTypeDeclaration.class);
  Assert.isNotNull(declaration);
  ITypeBinding enclosing= declaration.resolveBinding();
  while (enclosing != null) {
    if (isCorrespondingTypeBinding(enclosing, fType.getDeclaringType()))
      return true;
    enclosing= enclosing.getDeclaringClass();
  }
  return false;
}
origin: org.eclipse/org.eclipse.jdt.ui

private boolean isInsideTypeNestedInDeclaringType(ASTNode node) {
  Assert.isTrue((node instanceof ClassInstanceCreation) || (node instanceof SuperConstructorInvocation));
  final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(node, AbstractTypeDeclaration.class);
  Assert.isNotNull(declaration);
  ITypeBinding enclosing= declaration.resolveBinding();
  while (enclosing != null) {
    if (isCorrespondingTypeBinding(enclosing, fType.getDeclaringType()))
      return true;
    enclosing= enclosing.getDeclaringClass();
  }
  return false;
}
origin: eclipse/eclipse.jdt.ls

private RefactoringStatus checkTypesInCompilationUnit() {
  RefactoringStatus result = new RefactoringStatus();
  if (!Checks.isTopLevel(fType)) { //the other case checked in checkTypesInPackage
    IType siblingType = fType.getDeclaringType().getType(getNewElementName());
    if (siblingType.exists()) {
      String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_member_type_exists,
          new String[] { getNewElementLabel(), BasicElementLabels.getJavaElementName(fType.getDeclaringType().getFullyQualifiedName('.')) });
      result.addError(msg, JavaStatusContext.create(siblingType));
    }
  }
  return result;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkTypesInCompilationUnit() {
  RefactoringStatus result= new RefactoringStatus();
  if (! Checks.isTopLevel(fType)){ //the other case checked in checkTypesInPackage
    IType siblingType= fType.getDeclaringType().getType(getNewElementName());
    if (siblingType.exists()){
      String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_member_type_exists,
        new String[] { getNewElementLabel(), BasicElementLabels.getJavaElementName(fType.getDeclaringType().getFullyQualifiedName('.'))});
      result.addError(msg, JavaStatusContext.create(siblingType));
    }
  }
  return result;
}
origin: eclipse/eclipse.jdt.ls

@Override
public Object getNewElement() {
  if (Checks.isTopLevel(fType)) {
    return getNewCompilationUnit().getType(getNewElementName());
  } else {
    return fType.getDeclaringType().getType(getNewElementName());
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

private Expression createAccessExpressionToEnclosingInstanceFieldText(ASTNode node, IBinding binding, AbstractTypeDeclaration declaration) {
  if (Modifier.isStatic(binding.getModifiers()))
    return node.getAST().newName(JavaModelUtil.getTypeQualifiedName(fType.getDeclaringType()));
  else if ((isInAnonymousTypeInsideInputType(node, declaration) || isInLocalTypeInsideInputType(node, declaration) || isInNonStaticMemberTypeInsideInputType(node, declaration)))
    return createQualifiedReadAccessExpressionForEnclosingInstance(node.getAST());
  else
    return createReadAccessExpressionForEnclosingInstance(node.getAST());
}
org.eclipse.jdt.coreITypegetDeclaringType

Popular methods of IType

  • getFullyQualifiedName
    Returns the fully qualified name of this type, including qualification for any containing types and
  • getElementName
    Returns the simple name of this type, unqualified by package or enclosing type. This is a handle-onl
  • getMethods
    Returns the methods and constructors declared by this type. For binary types, this may include the s
  • getFlags
  • getPackageFragment
    Returns the package fragment in which this element is defined. This is a handle-only method.
  • getCompilationUnit
  • newSupertypeHierarchy
    Creates and returns a type hierarchy for this type containing this type and all of its supertypes, c
  • exists
  • getJavaProject
  • isInterface
    Returns whether this type represents an interface. Note that an interface can also be an annotation
  • getMethod
    Returns the method with the specified name and parameter types in this type (for example, "foo", {"I
  • getParent
  • getMethod,
  • getParent,
  • isClass,
  • getSourceRange,
  • newTypeHierarchy,
  • isAnonymous,
  • isBinary,
  • getResource,
  • getTypeParameters

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • addToBackStack (FragmentTransaction)
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • JButton (javax.swing)
  • JComboBox (javax.swing)
  • JOptionPane (javax.swing)
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