本文整理汇总了Java中org.eclipse.core.resources.IResourceProxy类的典型用法代码示例。如果您正苦于以下问题:Java IResourceProxy类的具体用法?Java IResourceProxy怎么用?Java IResourceProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceProxy类属于org.eclipse.core.resources包,在下文中一共展示了IResourceProxy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collectAllWorkspaceFiles
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
public static List<ResourceItem> collectAllWorkspaceFiles(IWorkspaceRoot workspace) {
List<ResourceItem> files = new ArrayList<>();
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() != IResource.FILE) return true;
if (proxy.isDerived()) return false;
if (proxy.isPhantom()) return false;
if (proxy.isHidden()) return false;
IFile file = (IFile) proxy.requestResource();
files.add(makeResourceItem(file));
return false;
}
};
try {
IResource[] resources = workspace.members();
for(IResource resource : resources) {
if (!resource.getProject().isOpen()) continue;
resource.accept(visitor, 0);
}
} catch (CoreException e) {
throw new RuntimeException(e);
}
return files;
}
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:27,代码来源:EclipseWorkbench.java
示例2: run
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
startTime = System.currentTimeMillis();
AbstractTextSearchResult textResult = (AbstractTextSearchResult) getSearchResult();
textResult.removeAll();
try {
IContainer dir = configFile.getParent();
dir.accept(new AbstractSectionPatternVisitor(section) {
@Override
protected void collect(IResourceProxy proxy) {
Match match = new FileMatch((IFile) proxy.requestResource());
result.addMatch(match);
}
}, IResource.NONE);
return Status.OK_STATUS;
} catch (Exception ex) {
return new Status(IStatus.ERROR, EditorConfigPlugin.PLUGIN_ID, ex.getMessage(), ex);
}
}
开发者ID:angelozerr,项目名称:ec4e,代码行数:24,代码来源:EditorConfigSearchQuery.java
示例3: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@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;
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:22,代码来源:TsconfigBuildPath.java
示例4: testVisitFolderParentFolderPathDoesNotEqualsPath
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
public void testVisitFolderParentFolderPathDoesNotEqualsPath() throws Exception {
List<String> javaPackages = new ArrayList<String>();
String parentFolderPath = "Something";
String additionalPath = "Else";
JavaPackageVisitor visitor = new JavaPackageVisitor(javaPackages, parentFolderPath);
IResourceProxy proxy = createMock(IResourceProxy.class);
expect(proxy.getType()).andReturn(IResource.FOLDER);
expect(proxy.requestFullPath()).andReturn(
new Path(parentFolderPath + System.getProperty("file.separator") + additionalPath));
replay(proxy);
assertTrue(visitor.visit(proxy));
assertEquals(1, javaPackages.size());
assertEquals(additionalPath, javaPackages.get(0));
verify(proxy);
}
开发者ID:mhevery,项目名称:testability-explorer,代码行数:17,代码来源:JavaPackageVisitorTest.java
示例5: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@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;
}
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:21,代码来源:SwaggerFileFinder.java
示例6: validateProject
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
private void validateProject(IValidationContext helper,
final IReporter reporter) {
// if uris[] length 0 -> validate() gets called for each project
if (helper instanceof IWorkbenchContext) {
IProject project = ((IWorkbenchContext) helper).getProject();
IResourceProxyVisitor visitor = new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (shouldValidate(proxy)) {
validateFile((IFile) proxy.requestResource(), reporter);
}
return true;
}
};
try {
// collect all jsp files for the project
project.accept(visitor, IResource.DEPTH_INFINITE);
} catch (CoreException e) {
Logger.logException(e);
}
}
}
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONSyntaxValidator.java
示例7: ProjectListSelectionDialog
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
/**
* @param parent
*/
public ProjectListSelectionDialog(Shell parent) {
super(parent, WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
setTitle(Messages.ProjectSelectionDialog_Title);
setMessage(Messages.ProjectSelectionDialog_Message);
final List<Object> list = new ArrayList<Object>();
try {
ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() == IResource.ROOT) {
return true;
}
if (proxy.isAccessible()) {
list.add(proxy.requestResource());
}
return false;
}
}, 0);
} catch (CoreException e) {
IdeLog.logError(UIPlugin.getDefault(), e);
}
setElements(list.toArray());
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:ProjectListSelectionDialog.java
示例8: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ClassPathDetector.java
示例9: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException
{
if (proxy.isDerived())
return false;
if (proxy.getType() == IResource.FILE && proxy.getName().endsWith(".xml"))
{
IFile file = (IFile)proxy.requestResource();
IContentDescription contentDesc = file.getContentDescription();
if (contentDesc != null)
{
IContentType contentType = contentDesc.getContentType();
if (contentType != null && (contentType.isKindOf(configContentType)
|| contentType.isKindOf(springConfigContentType)))
{
configFiles.put(file, contentType);
}
}
}
return true;
}
开发者ID:mybatis,项目名称:mybatipse,代码行数:23,代码来源:ConfigRegistry.java
示例10: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
int type = proxy.getType();
switch (type) {
case IResource.FOLDER:
case IResource.PROJECT:
IResource resource = proxy.requestResource();
return resource.equals(current);
case IResource.FILE:
if (ResourceHelper.isMatchingWebResourceType(proxy.getName(),
context.getResourceType().getType())) {
// current file matches the given web resource type
// collect it.
IResource file = proxy.requestResource();
if (collector.add(file, WebResourceKind.ECLIPSE_RESOURCE,
context, resolver)) {
stop = true;
}
}
default:
break;
}
return !stop;
}
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:25,代码来源:WebResourcesProxyVisitor.java
示例11: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
switch (proxy.getType()) {
case IResource.FILE:
if (proxy.getName().endsWith(classExtension)
|| proxy.getName().endsWith(triggerExtension)) {
files.add((IFile) proxy.requestResource());
}
return false;
case IResource.FOLDER:
// Only traverse resources that are not inside the Referenced Packages folder
return !proxy.getName().equals(Constants.REFERENCED_PACKAGE_FOLDER_NAME);
case IResource.PROJECT:
return true;
default:
return false;
}
}
开发者ID:forcedotcom,项目名称:idecore,代码行数:19,代码来源:ApexResourcesVisitor.java
示例12: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
if (terminated) {
return false;
}
IResource resource = proxy.requestResource();
long value = (resource.getLocalTimeStamp() / 1000) * 1000;
if (value > lastModified) {
lastModified = value;
if (lastModified > threashold) {
terminated = true;
return false;
}
}
return true;
}
开发者ID:dashie,项目名称:m2e-plugins,代码行数:17,代码来源:CheckLastModifiedVisitor.java
示例13: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
IPath path = proxy.requestFullPath();
if (proxy.getType() == IResource.FILE && section.match(Ec4jPaths.of(path.toString()))) {
collect(proxy);
}
return true;
}
开发者ID:angelozerr,项目名称:ec4e,代码行数:9,代码来源:AbstractSectionPatternVisitor.java
示例14: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getName().equals(expectedName) && proxy.getType() == type) {
IResource resource = proxy.requestResource();
int distance = resourcePathDistanceComputer.distance(expectedPath, resource.getFullPath());
if (distance < resourceCandidateDistance) {
resourceCandidate = resource;
resourceCandidateDistance = distance;
}
}
return true;
}
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:13,代码来源:FuzzyResourceFinder.java
示例15: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public boolean visit(IResourceProxy proxy) throws CoreException {
if (FileUtils.isTsConfigFile(proxy.getName())) {
collect(proxy.requestResource());
}
return true;
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:8,代码来源:AbstractTsconfigJsonCollector.java
示例16: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
public boolean visit(IResourceProxy resourceProxy) {
switch (resourceProxy.getType()) {
case IResource.ROOT :
return true; // all projects are in the "root"
case IResource.PROJECT :
this.processProject(resourceProxy);
return false; // no nested projects
case IResource.FOLDER :
return false; // ignore
case IResource.FILE :
return false; // ignore
default :
return false;
}
}
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:16,代码来源:TitaniumProjectsManager.java
示例17: accept
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
@Override
public void accept(final IResourceVisitor visitor, int depth, int memberFlags)
throws CoreException {
// use the fast visitor if visiting to infinite depth
if (depth == IResource.DEPTH_INFINITE) {
accept(
new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
return visitor.visit(proxy.requestResource());
}
},
memberFlags);
return;
}
// it is invalid to call accept on a phantom when INCLUDE_PHANTOMS is not specified
final boolean includePhantoms = (memberFlags & IContainer.INCLUDE_PHANTOMS) != 0;
ResourceInfo info = getResourceInfo(includePhantoms, false);
int flags = getFlags(info);
if ((memberFlags & IContainer.DO_NOT_CHECK_EXISTENCE) == 0) checkAccessible(flags);
// check that this resource matches the member flags
if (!isMember(flags, memberFlags)) return;
// visit this resource
if (!visitor.visit(this) || depth == DEPTH_ZERO) return;
// get the info again because it might have been changed by the visitor
info = getResourceInfo(includePhantoms, false);
if (info == null) return;
// thread safety: (cache the type to avoid changes -- we might not be inside an operation)
int type = info.getType();
if (type == FILE) return;
// if we had a gender change we need to fix up the resource before asking for its members
IContainer resource =
getType() != type
? (IContainer) workspace.newResource(getFullPath(), type)
: (IContainer) this;
IResource[] members = resource.members(memberFlags);
for (int i = 0; i < members.length; i++)
members[i].accept(visitor, DEPTH_ZERO, memberFlags | IContainer.DO_NOT_CHECK_EXISTENCE);
}
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:Resource.java
示例18: visit
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
public boolean visit(IResourceProxy proxy) {
boolean inScope = fScope.contains(proxy);
if (inScope && proxy.getType() == IResource.FILE) {
fFiles.add(proxy.requestResource());
}
return inScope;
}
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:FilesOfScopeCalculator.java
示例19: contains
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
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;
}
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:FileNamePatternSearchScope.java
示例20: testVisitSimple
import org.eclipse.core.resources.IResourceProxy; //导入依赖的package包/类
public void testVisitSimple() throws Exception {
JavaPackageVisitor visitor = new JavaPackageVisitor(null, null);
IResourceProxy proxy = createMock(IResourceProxy.class);
expect(proxy.getType()).andReturn(IResource.FILE);
replay(proxy);
assertFalse(visitor.visit(proxy));
verify(proxy);
}
开发者ID:mhevery,项目名称:testability-explorer,代码行数:10,代码来源:JavaPackageVisitorTest.java
注:本文中的org.eclipse.core.resources.IResourceProxy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论