当前位置: 首页>>代码示例>>Java>>正文


Java IResourceProxyVisitor类代码示例

本文整理汇总了Java中org.eclipse.core.resources.IResourceProxyVisitor的典型用法代码示例。如果您正苦于以下问题:Java IResourceProxyVisitor类的具体用法?Java IResourceProxyVisitor怎么用?Java IResourceProxyVisitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IResourceProxyVisitor类属于org.eclipse.core.resources包,在下文中一共展示了IResourceProxyVisitor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectAllWorkspaceFiles

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的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: validateProject

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的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

示例3: ProjectListSelectionDialog

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的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

示例4: accept

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的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

示例5: fillContentProvider

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
@Override
protected void fillContentProvider(AbstractContentProvider contentProvider,
		ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
		throws CoreException {
	if (itemsFilter instanceof ResourceFilter) {
		IResourceProxyVisitor resourceProxyVisitor = getNewResourceProxyVisitor(contentProvider, itemsFilter,
				progressMonitor);
		container.accept(resourceProxyVisitor,
				IResource.NONE);
	}
	if (progressMonitor != null)
		progressMonitor.done();

}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:EnsembleOpenResourceDialog.java

示例6: accept

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags)
		throws CoreException {
	// not required
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:6,代码来源:ProjectRoot.java

示例7: accept

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void accept(final IResourceProxyVisitor visitor, final int memberFlags) throws CoreException {
  resource().accept(visitor, memberFlags);
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:8,代码来源:AbstractBaseResourceDecorator.java

示例8: getNewResourceProxyVisitor

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
protected abstract IResourceProxyVisitor getNewResourceProxyVisitor(
AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
IProgressMonitor progressMonitor) throws CoreException;
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:4,代码来源:EnsembleOpenResourceDialog.java

示例9: accept

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
public void accept(IResourceProxyVisitor arg0, int arg1) throws CoreException {
    throw new RuntimeException("not implemented"); //$NON-NLS-1$
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:4,代码来源:TestFile.java

示例10: collectMappers

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
private void collectMappers(IJavaProject project, final Map<String, IFile> map,
	final IReporter reporter)
{
	try
	{
		for (IPackageFragmentRoot root : project.getAllPackageFragmentRoots())
		{
			if (root.getKind() != IPackageFragmentRoot.K_SOURCE)
			{
				continue;
			}

			root.getResource().accept(new IResourceProxyVisitor()
			{
				@Override
				public boolean visit(IResourceProxy proxy) throws CoreException
				{
					if (!proxy.isDerived() && 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(mapperContentType))
							{
								String namespace = extractNamespace(file);
								if (namespace != null)
								{
									map.put(namespace, file);
								}
								return false;
							}
						}
					}
					return true;
				}
			}, IContainer.NONE);
		}
	}
	catch (CoreException e)
	{
		Activator.log(Status.ERROR, "Searching MyBatis Mapper xml failed.", e);
	}
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:47,代码来源:MapperNamespaceCache.java

示例11: validateAllMappers

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
private void validateAllMappers(final IProgressMonitor monitor)
{
	final int totalWork = countResources();
	monitor.beginTask("Mybatipse validation", totalWork);
	currentWork = 1;

	try
	{
		getProject().accept(new IResourceProxyVisitor()
		{
			private MessageFormat pattern = new MessageFormat("Validating {0}... ({1}/{2})");

			@Override
			public boolean visit(IResourceProxy proxy) throws CoreException
			{
				if (monitor.isCanceled())
				{
					forgetLastBuiltState();
					throw new OperationCanceledException();
				}

				monitor.subTask(pattern.format(new Object[]{
					proxy.getName(), currentWork, totalWork
				}));

				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(mapperContentType)))
						{
							ValidationFramework.getDefault().validate(file, monitor);
						}
					}
				}

				monitor.worked(1);
				currentWork++;
				return true;
			}
		}, IContainer.NONE);
	}
	catch (CoreException e)
	{
		Activator.log(Status.ERROR, e.getMessage(), e);
	}
	finally
	{
		monitor.done();
	}
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:59,代码来源:MybatipseIncrementalBuilder.java

示例12: clean

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
@Override
protected void clean(IProgressMonitor monitor) throws CoreException
{
	try
	{
		IProject project = getProject();
		project.accept(new IResourceProxyVisitor()
		{
			@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)))
						{
							file.deleteMarkers(XmlValidator.MARKER_ID, false, IResource.DEPTH_ZERO);
						}
					}
				}
				return true;
			}
		}, IContainer.NONE);

		TypeAliasCache.getInstance().remove(project);
		BeanPropertyCache.clearBeanPropertyCache(project);
		MapperNamespaceCache.getInstance().remove(project);
		ConfigRegistry.getInstance().remove(project);
	}
	catch (CoreException e)
	{
		Activator.log(Status.ERROR, e.getMessage(), e);
	}
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:43,代码来源:MybatipseIncrementalBuilder.java

示例13: buildNow

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
@Override
public void buildNow(IProgressMonitor monitor) throws CoreException {
	if(monitor.isCanceled())
		return;
	
	SubMonitor sm = SubMonitor.convert(monitor, "Build project for Android", 100);

	try {
		HybridProject hybridProject = HybridProject.getHybridProject(this.getProject());
		if (hybridProject == null) {
			throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID,
					"Not a hybrid mobile project, can not generate files"));
		}
		String buildType = "--debug";
		if(isRelease()){
			buildType = "--release";
		}
		hybridProject.build(sm.split(90), "android",buildType);
		
		IFolder androidProject = hybridProject.getProject().getFolder("platforms/android");
		androidProject.accept(new IResourceProxyVisitor() {
			
			@Override
			public boolean visit(IResourceProxy proxy) throws CoreException {
				switch (proxy.getType()) {
				case IResource.FOLDER:
					for (String folder : outputFolders) {
							if(folder.equals(proxy.getName())){
							return true;
						}
					}
					break;
				case IResource.FILE:
					if(isRelease() && proxy.getName().endsWith("-release-unsigned.apk")){
						setBuildArtifact(proxy.requestResource().getLocation().toFile());
						return false;
					}
					if(proxy.getName().endsWith("-debug.apk")){
						setBuildArtifact(proxy.requestResource().getLocation().toFile());
						return false;
					}
				default:
					break;
				}
				return false;
			}
		}, IContainer.INCLUDE_HIDDEN | IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS );
		
       	if(getBuildArtifact() == null || !getBuildArtifact().exists()){
       		throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Build failed... Build artifact does not exist"));
       	}
	}
	finally{
		sm.done();
	}
}
 
开发者ID:eclipse,项目名称:thym,代码行数:57,代码来源:BuildDelegate.java

示例14: accept

import org.eclipse.core.resources.IResourceProxyVisitor; //导入依赖的package包/类
@Override
public void accept(IResourceProxyVisitor visitor, int memberFlags) throws CoreException {
    throw new RuntimeException("Not implemented");
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:5,代码来源:AbstractIResourceStub.java


注:本文中的org.eclipse.core.resources.IResourceProxyVisitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。