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

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

Best Java code snippets using org.eclipse.jdt.core.IType.getResource (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: cbeust/testng-eclipse

private static Object[] findDependsOnMethodsOrGroups(IType[] types) {
 List<IResource> resources = new ArrayList<>(types.length);
 for(int i= 0; i < types.length; i++) {
  resources.add(types[i].getResource());
 }
 return findDependenciesBySearch(resources, "@Test\\(.*\\s*(dependsOnGroups)|(dependsOnMethods)\\s*=.*");
}
origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e

protected boolean acceptType(IType candidate) {
 final IResource resource = candidate.getResource();
 if (resource == null || !resource.isAccessible()) {
  return false; // exclude binary types
 }
 if (selection().isEmpty()) {
  return true; // not limited to resources: accept all
 }
 return isInResources(resource);
}
origin: org.eclipse/org.eclipse.jst.j2ee.ejb

protected IFile getFile(JavaClass clazz) {
  // Not in the current project, so check the IType's project
  IType type = getType(clazz);
  if (type == null) {
    return null;
  }
  IResource resource = type.getResource();
  if (resource != null && resource.getType() == IResource.FILE && resource.isAccessible())
    return (IFile) resource;
  return null;
}
origin: eclipse/eclipse.jdt.ls

private RefactoringStatus analyzeAffectedCompilationUnits(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result = new RefactoringStatus();
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences, fType.getResource()));
  pm.beginTask("", fReferences.length); //$NON-NLS-1$
  result.merge(checkConflictingTypes(pm));
  return result;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus analyzeAffectedCompilationUnits(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result= new RefactoringStatus();
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences, fType.getResource()));
  pm.beginTask("", fReferences.length); //$NON-NLS-1$
  result.merge(checkConflictingTypes(pm));
  return result;
}
origin: org.eclipse/org.eclipse.jdt.ui

private RefactoringStatus analyzeAffectedCompilationUnits(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result= new RefactoringStatus();
    
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences, fType.getResource()));	
  
  pm.beginTask("", fReferences.length); //$NON-NLS-1$
  result.merge(checkConflictingTypes(pm));
  return result;
}

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

private RefactoringStatus analyzeAffectedCompilationUnits(IProgressMonitor pm) throws CoreException {
  RefactoringStatus result= new RefactoringStatus();
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences, fType.getResource()));
  pm.beginTask("", fReferences.length); //$NON-NLS-1$
  result.merge(checkConflictingTypes(pm));
  return result;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public IResource getRefactoredResource(IResource element) {
  if (element instanceof IFile) {
    if (Checks.isTopLevel(fType) && element.equals(fType.getResource()))
      return getNewCompilationUnit().getResource();
  }
  return element;
}
origin: eclipse/eclipse.jdt.ls

@Override
public IResource getRefactoredResource(IResource element) {
  if (element instanceof IFile) {
    if (Checks.isTopLevel(fType) && element.equals(fType.getResource())) {
      return getNewCompilationUnit().getResource();
    }
  }
  return element;
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * {@inheritDoc}
 */
public IResource getRefactoredResource(IResource element) {
  if (element instanceof IFile) {
    if (Checks.isTopLevel(fType) && element.equals(fType.getResource()))
      return getNewCompilationUnit().getResource();
  }
  return element;
}

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

@Override
public IResource getRefactoredResource(IResource element) {
  if (element instanceof IFile) {
    if (Checks.isTopLevel(fType) && element.equals(fType.getResource()))
      return getNewCompilationUnit().getResource();
  }
  return element;
}
origin: cbeust/testng-eclipse

public boolean accept(IType type) {
 IResource resource = type.getResource();
 ICompilationUnit cu = JDTUtil.getJavaElement((IFile) resource);
 CompilationUnit astRoot = JUnitConverterQuickAssistProcessor.createCompilationUnit(cu);
 JUnitVisitor visitor = new JUnitVisitor();
 astRoot.accept(visitor);
 return visitor.needsConversion();
}
origin: org.eclipse/org.eclipse.ajdt.ui

/**
 * Tells whether the specified manifest main class is valid.
 * 
 * @return <code>true</code> if a main class is specified and valid
 */
public static boolean isMainClassValid(JarPackageData data, IRunnableContext context) {
  if (data == null)
    return false;
  
  IType mainClass= data.getManifestMainClass();
  if (mainClass == null)
    // no main class specified
    return true;
  try {
    // Check if main method is in scope
    IFile file= (IFile)mainClass.getResource();
    if (file == null || !contains(asResources(data.getElements()), file))
      return false;
    // Test if it has a main method
    return JavaModelUtil.hasMainMethod(mainClass);
  } catch (JavaModelException e) {
  }
  return false;
}

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

/**
 * Returns the resource handle that corresponds to the compilation unit to was or
 * will be created or modified.
 * @return A resource or null if the page contains illegal values.
 * @since 3.0
 */
public IResource getModifiedResource() {
  IType enclosing= getEnclosingType();
  if (enclosing != null) {
    return enclosing.getResource();
  }
  IPackageFragment pack= getPackageFragment();
  if (pack != null) {
    String cuName= getCompilationUnitName(getTypeNameWithoutParameters());
    return pack.getCompilationUnit(cuName).getResource();
  }
  return null;
}
origin: org.eclipse/org.eclipse.jdt.ui

/**
 * Returns the resource handle that corresponds to the compilation unit to was or
 * will be created or modified.
 * @return A resource or null if the page contains illegal values.
 * @since 3.0
 */
public IResource getModifiedResource() {
  IType enclosing= getEnclosingType();
  if (enclosing != null) {
    return enclosing.getResource();
  }
  IPackageFragment pack= getPackageFragment();
  if (pack != null) {
    String cuName= getCompilationUnitName(getTypeNameWithoutParameters());
    return pack.getCompilationUnit(cuName).getResource();
  }
  return null;
}
    
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Returns the resource handle that corresponds to the compilation unit to was or
 * will be created or modified.
 * @return A resource or null if the page contains illegal values.
 * @since 3.0
 */
public IResource getModifiedResource() {
  IType enclosing= getEnclosingType();
  if (enclosing != null) {
    return enclosing.getResource();
  }
  IPackageFragment pack= getPackageFragment();
  if (pack != null) {
    String cuName= getCompilationUnitName(getTypeNameWithoutParameters());
    return pack.getCompilationUnit(cuName).getResource();
  }
  return null;
}
origin: org.eclipse/org.eclipse.ajdt.ui

/**
 * Returns the resource handle that corresponds to the compilation unit to was or
 * will be created or modified.
 * @return A resource or null if the page contains illegal values.
 * @since 3.0
 */
public IResource getModifiedResource() {
  IType enclosing= getEnclosingType();
  if (enclosing != null) {
    return enclosing.getResource();
  }
  IPackageFragment pack= getPackageFragment();
  if (pack != null) {
    String cuName= getCompilationUnitName(getTypeNameWithoutParameters());
    return pack.getCompilationUnit(cuName).getResource();
  }
  return null;
}
    
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Tells whether the specified manifest main class is valid.
 * 
 * @param data the Jar package data
 * @param context the runnable context
 * @return <code>true</code> if a main class is specified and valid
 */
public static boolean isMainClassValid(JarPackageData data, IRunnableContext context) {
  if (data == null)
    return false;
  IType mainClass= data.getManifestMainClass();
  if (mainClass == null)
    // no main class specified
    return true;
  try {
    // Check if main method is in scope
    IFile file= (IFile)mainClass.getResource();
    if (file == null || !contains(asResources(data.getElements()), file))
      return false;
    // Test if it has a main method
    return JavaModelUtil.hasMainMethod(mainClass);
  } catch (JavaModelException e) {
    JavaPlugin.log(e.getStatus());
  }
  return false;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Tells whether the specified manifest main class is valid.
 * 
 * @param data the Jar package data
 * @param context the runnable context
 * @return <code>true</code> if a main class is specified and valid
 */
public static boolean isMainClassValid(JarPackageData data, IRunnableContext context) {
  if (data == null)
    return false;
  IType mainClass= data.getManifestMainClass();
  if (mainClass == null)
    // no main class specified
    return true;
  try {
    // Check if main method is in scope
    IFile file= (IFile)mainClass.getResource();
    if (file == null || !contains(asResources(data.getElements()), file))
      return false;
    // Test if it has a main method
    return JavaModelUtil.hasMainMethod(mainClass);
  } catch (JavaModelException e) {
    JavaPlugin.log(e.getStatus());
  }
  return false;
}
origin: org.eclipse/org.eclipse.ajdt.ui

private long getContainerTimestamp(TypeNameMatch match) {
  try {
    IType type= match.getType();
    IResource resource= type.getResource();
    if (resource != null) {
      URI location= resource.getLocationURI();
      if (location != null) {
        IFileInfo info= EFS.getStore(location).fetchInfo();
        if (info.exists()) {
          // The element could be removed from the build path. So check
          // if the Java element still exists.
          IJavaElement element= JavaCore.create(resource);
          if (element != null && element.exists())
            return info.getLastModified();
        }
      }
    } else { // external JAR
      IPackageFragmentRoot root= match.getPackageFragmentRoot();
      IFileInfo info= EFS.getLocalFileSystem().getStore(root.getPath()).fetchInfo();
      if (info.exists()) {
        return info.getLastModified();
      }
    }
  } catch (CoreException e) {
    // Fall through
  }
  return IResource.NULL_STAMP;
}

org.eclipse.jdt.coreITypegetResource

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
  • 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,
  • getTypeParameters

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • orElseThrow (Optional)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
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