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

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

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

Refine searchRefine arrow

  • ICompilationUnit
  • IMethod
  • IJavaElement
  • IJavaProject
  • IPackageFragment
  • 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

public static org.eclipse.jdt.core.dom.AbstractTypeDeclaration findTypeDeclaration(IType searchType, List<?> nodes) {
  for (Object object : nodes) {
    if (object instanceof org.eclipse.jdt.core.dom.AbstractTypeDeclaration) {
      org.eclipse.jdt.core.dom.AbstractTypeDeclaration typeDeclaration = (org.eclipse.jdt.core.dom.AbstractTypeDeclaration) object;
      if (typeDeclaration.getName().toString().equals(searchType.getElementName()))
        return typeDeclaration;
    }
  }
  return null;
}

origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Returns the java project this hierarchy was created in.
 */
public IJavaProject javaProject() {
  return this.focusType.getJavaProject();
}
protected static byte[] readUntil(InputStream input, byte separator) throws JavaModelException, IOException{
origin: eclipse/eclipse.jdt.ls

static String[] getSuperTypeSignatures(IType subType, IType superType) throws JavaModelException {
  if (superType.isInterface()) {
    return subType.getSuperInterfaceTypeSignatures();
  } else {
    return new String[] {subType.getSuperclassTypeSignature()};
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void computeQualifiedNameMatches(IProgressMonitor pm) {
  IPackageFragment fragment= fType.getPackageFragment();
  if (fQualifiedNameSearchResult == null)
    fQualifiedNameSearchResult= new QualifiedNameSearchResult();
  QualifiedNameFinder.process(fQualifiedNameSearchResult, fType.getFullyQualifiedName(),
    fragment.getElementName() + "." + getNewElementName(), //$NON-NLS-1$
    fFilePatterns, fType.getJavaProject().getProject(), pm);
}
origin: org.eclipse/org.eclipse.jdt.ui

private IType resolveType(String qualifiedTypeName) throws JavaModelException{
  IType type= getDeclaringType().getJavaProject().findType(qualifiedTypeName);
  if (type == null)
    type= getDeclaringType().getJavaProject().findType(getDeclaringType().getPackageFragment().getElementName(), qualifiedTypeName);
  return type;
}

origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void handleType(IType type, IPackageFragment destination, IProgressMonitor pm) {
  QualifiedNameFinder.process(fQualifiedNameSearchResult, type.getFullyQualifiedName(), destination.getElementName() + "." + type.getTypeQualifiedName(), //$NON-NLS-1$
      fFilePatterns, type.getJavaProject().getProject(), pm);
}
origin: org.eclipse.jdt/org.eclipse.jdt.junit.core

public static boolean isTestImplementor(IType type) throws JavaModelException {
  ITypeHierarchy typeHier= type.newSupertypeHierarchy(null);
  IType[] superInterfaces= typeHier.getAllInterfaces();
  for (int i= 0; i < superInterfaces.length; i++) {
    if (JUnitCorePlugin.TEST_INTERFACE_NAME.equals(superInterfaces[i].getFullyQualifiedName('.'))) {
      return true;
    }
  }
  return false;
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Finds a method in a type.
 * Searches for a method with the same name and the same parameter count.
 * Parameter types are <b>not</b> compared.
 * @param method
 * @param type
 * @return The first found method or null, if nothing found
 * @throws JavaModelException
 */
public static IMethod findMethod(IMethod method, IType type) throws JavaModelException {
  return findMethod(method.getElementName(), method.getParameterTypes().length, method.isConstructor(), type.getMethods());
}
origin: eclipse/buildship

@Override
public String getQualifiedName() {
  IType declaringType = this.method.getDeclaringType();
  return declaringType.getFullyQualifiedName() + "#" + this.method.getElementName();
}
origin: org.eclipse/org.eclipse.jdt.ui

private void initialize() throws JavaModelException {
  fQualifiedTypeName= JavaModelUtil.concatenateName(fType.getPackageFragment().getElementName(), fType.getElementName());
  fEnclosingInstanceFieldName= getInitialNameForEnclosingInstanceField();
  fSourceRewrite= new CompilationUnitRewrite(fType.getCompilationUnit());
  fIsInstanceFieldCreationPossible= !(JdtFlags.isStatic(fType) || fType.isAnnotation() || fType.isEnum());
  fIsInstanceFieldCreationMandatory= fIsInstanceFieldCreationPossible && isInstanceFieldCreationMandatory();
  fCreateInstanceField= fIsInstanceFieldCreationMandatory;
}
origin: org.eclipse/org.eclipse.jdt.ui

private RefactoringStatus checkTypesImportedInCu() throws CoreException {
  IImportDeclaration imp= getImportedType(fType.getCompilationUnit(), getNewElementName());
  
  if (imp == null)
    return null;	
    
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, 
                    new Object[]{getNewElementName(), fType.getCompilationUnit().getResource().getFullPath()});
  IJavaElement grandParent= imp.getParent().getParent();
  if (grandParent instanceof ICompilationUnit)
    return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp));
  return null;	
}

origin: Microsoft/vscode-java-test

private static String parseTestItemFullName(IJavaElement element, TestLevel level) {
  switch (level) {
    case CLASS:
    case NESTED_CLASS:
      final IType type = (IType) element;
      return type.getFullyQualifiedName();
    case METHOD:
      final IMethod method = (IMethod) element;
      return method.getDeclaringType().getFullyQualifiedName() + "#" + method.getElementName();
    default:
      return element.getElementName();
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean isPrimaryType() {
  String cuName= fType.getCompilationUnit().getElementName();
  String typeName= fType.getElementName();
  return Checks.isTopLevel(fType) && JavaCore.removeJavaLikeExtension(cuName).equals(typeName);
}
origin: org.eclipse/org.eclipse.jdt.ui

private static Integer[] createOffsetArray(IType[] types) throws JavaModelException {
  List result= new ArrayList();
  for (int i= 0; i < types.length; i++) {
    IType iType= types[i];
    addOffset(result, iType.getNameRange().getOffset());
    addOffset(result, iType.getSourceRange().getOffset() + iType.getSourceRange().getLength());
    addMemberOffsetList(result, iType.getMethods());
    addMemberOffsetList(result, iType.getFields());
    addMemberOffsetList(result, iType.getInitializers());
  }
  return (Integer[]) result.toArray(new Integer[result.size()]);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

protected void openCodeTempatePage(String id) {
  HashMap<String, String> arg= new HashMap<>();
  arg.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, id);
  PreferencesUtil.createPropertyDialogOn(getShell(), fType.getJavaProject().getProject(), CodeTemplatePreferencePage.PROP_ID, null, arg).open();
}
origin: org.eclipse.pde/org.eclipse.pde.api.tools

private IElementDescriptor getElementDescriptor(IJavaElement element) {
  switch (element.getElementType()) {
    case IJavaElement.PACKAGE_FRAGMENT:
      return Factory.packageDescriptor(element.getElementName());
    case IJavaElement.TYPE:
      return Factory.typeDescriptor(((IType) element).getFullyQualifiedName('$'));
    default:
      return null;
  }
}
origin: org.eclipse/org.eclipse.jst.jsf.core

private boolean isInnerOrAnonymousClass(IType res) {
  try {
    if (res.isClass() && (res.isAnonymous() || 
                (Flags.isPrivate(res.getFlags())) || 
                res.getFullyQualifiedName().indexOf("$") > 0)) //must be better way to discover if it is an inner class //$NON-NLS-1$
      return true;
  } catch (JavaModelException e) {
    //ignore
  }
  return false;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
CodeGenerationSettings createSettings(IType type, SourceActionDialog dialog) {
  ToStringGenerationSettings settings= ((GenerateToStringDialog) dialog).getGenerationSettings();
  super.createSettings(type, dialog).setSettings(settings);
  settings.createComments= dialog.getGenerateComment();
  settings.useBlocks= useBlocks(type.getJavaProject());
  String version= fUnit.getJavaElement().getJavaProject().getOption(JavaCore.COMPILER_SOURCE, true);
  settings.is50orHigher= !JavaModelUtil.isVersionLessThan(version, JavaCore.VERSION_1_5);
  settings.is60orHigher= !JavaModelUtil.isVersionLessThan(version, JavaCore.VERSION_1_6);
  return settings;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean canEnable(IStructuredSelection selection) throws JavaModelException {
  if (getSelectedFields(selection) != null)
    return true;
  if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) {
    IType type= (IType) selection.getFirstElement();
    return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnonymous();
  }
  if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit))
    return true;
  return false;
}
origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e

@SuppressWarnings("squid:S1067")
protected boolean acceptType(IType jdtType) throws CoreException {
 //fast check before doing expensive source parsing
 return S2eUtils.exists(jdtType)
   && S2eUtils.exists(jdtType.getJavaProject()) // required!
   && !jdtType.isAnonymous()
   && !jdtType.isBinary()
   && jdtType.getDeclaringType() == null
   && Flags.isPublic(jdtType.getFlags());
}
org.eclipse.jdt.coreIType

Javadoc

Represents either a source type in a compilation unit (either a top-level type, a member type, a local type, an anonymous type or a lambda expression) or a binary type in a class file. Enumeration classes and annotation types are subkinds of classes and interfaces, respectively.

Note that the element name of an anonymous source type and lambda expressions is always empty. Types representing lambda expressions are pseudo-elements and not included in the children of their parent. Lambda expressions are created as the result of a ICodeAssist.codeSelect(...). For more information on such pseudo-elements, see ILocalVariable.

If a binary type cannot be parsed, its structure remains unknown. Use IJavaElement.isStructureKnown to determine whether this is the case.

The children are of type IMember, which includes IField, IMethod, IInitializer and IType. The children are listed in the order in which they appear in the source or class file.

Most used methods

  • 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
  • getDeclaringType
  • getMethod
    Returns the method with the specified name and parameter types in this type (for example, "foo", {"I
  • getDeclaringType,
  • 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