Java Code Examples for org.eclipse.core.resources.IResourceProxy#getType()

The following examples show how to use org.eclipse.core.resources.IResourceProxy#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TsconfigBuildPath.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
	IResource resource = proxy.requestResource();
	if (tsconfigFile.equals(resource)) {
		return true;
	}
	int type = proxy.getType();
	if (type == IResource.FILE && !(TypeScriptResourceUtil.isTsOrTsxFile(resource)
			|| TypeScriptResourceUtil.isJsOrJsMapFile(resource))) {
		return false;
	}
	if (tsconfig.isInScope(resource)) {
		if (type == IResource.PROJECT || type == IResource.FOLDER) {
			return true;
		} else {
			members.add(resource);
		}
		return true;
	}
	return false;
}
 
Example 2
Source File: SwaggerFileFinder.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 6 votes vote down vote up
@Override
  public boolean visit(IResourceProxy proxy) throws CoreException {
      if (proxy.getType() == IResource.FILE
              && (proxy.getName().endsWith("yaml") || proxy.getName().endsWith("yml"))) {

          if (!proxy.isDerived()) {
              IFile file = (IFile) proxy.requestResource();
              if (!file.equals(currentFile)) {
String currFileType = file.getContentDescription().getContentType().getId();
if (fileContentType == null || fileContentType.equals(currFileType)) {
	files.add(file);
}
              }
          }
      } else if (proxy.getType() == IResource.FOLDER
              && (proxy.isDerived() || proxy.getName().equalsIgnoreCase("gentargets"))) {
          return false;
      }
      return true;
  }
 
Example 3
Source File: ClassPathDetector.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public boolean visit(IResourceProxy proxy) {
	if (fMonitor.isCanceled()) {
		throw new OperationCanceledException();
	}

	if (proxy.getType() == IResource.FILE) {
		String name= proxy.getName();
		if (isValidCUName(name)) {
			visitCompilationUnit((IFile) proxy.requestResource());
		} else if (hasExtension(name, ".class")) { //$NON-NLS-1$
			fClassFiles.add(proxy.requestResource());
		} else if (hasExtension(name, ".jar")) { //$NON-NLS-1$
			fJARFiles.add(proxy.requestFullPath());
		}
		return false;
	}
	return true;
}
 
Example 4
Source File: SarlClassPathDetector.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public boolean visit(IResourceProxy proxy) {
	if (this.monitor.isCanceled()) {
		throw new OperationCanceledException();
	}
	if (proxy.getType() == IResource.FILE) {
		final String name = proxy.getName();
		if (isValidJavaCUName(name)) {
			visitJavaCompilationUnit((IFile) proxy.requestResource());
		} else if (isValidSarlCUName(name)) {
			visitSarlCompilationUnit((IFile) proxy.requestResource());
		} else if (FileSystem.hasExtension(name, ".class")) { //$NON-NLS-1$
			this.classFiles.add(proxy.requestResource());
		} else if (FileSystem.hasExtension(name, ".jar")) { //$NON-NLS-1$
			this.jarFiles.add(proxy.requestFullPath());
		}
		return false;
	}
	return true;
}
 
Example 5
Source File: FilesOfScopeCalculator.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean visit(IResourceProxy proxy) {
	boolean inScope= fScope.contains(proxy);

	if (inScope && proxy.getType() == IResource.FILE) {
		fFiles.add(proxy.requestResource());
	}
	return inScope;
}
 
Example 6
Source File: FileNamePatternSearchScope.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean contains(IResourceProxy proxy) {
	if (!fVisitDerived && proxy.isDerived()) {
		return false; // all resources in a derived folder are considered to be derived, see bug 103576
	}

	if (proxy.getType() == IResource.FILE) {
		return matchesFileName(proxy.getName());
	}
	return true;
}
 
Example 7
Source File: JavaPackageVisitor.java    From testability-explorer with Apache License 2.0 5 votes vote down vote up
public boolean visit(IResourceProxy proxy) {
  if (proxy.getType() == IResource.FOLDER) {
    String pathString = proxy.requestFullPath().toOSString();
    if (!parentFolderPath.equals(pathString)) {
      pathString = pathString.substring(parentFolderPath.length() + 1, pathString.length());
      pathString = pathString.replace("\\", "/");
      javaPackages.add(pathString);
    }
    return true;
  } else {
    return false;
  }
}