• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceMapping类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getSelectedResources

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
/**
 * Returns the selected resources.
 * 
 * @return the selected resources
 */
protected IResource[] getSelectedResources() {
	ArrayList resourceArray = new ArrayList();
	IResource[] resources = (IResource[])getSelectedResources(IResource.class);
	for (int i = 0; i < resources.length; i++) resourceArray.add(resources[i]);
	ResourceMapping[] resourceMappings = (ResourceMapping[])getSelectedAdaptables(selection, ResourceMapping.class);
	for (int i = 0; i < resourceMappings.length; i++) {
		ResourceMapping resourceMapping = (ResourceMapping)resourceMappings[i];
		try {
			ResourceTraversal[] traversals = resourceMapping.getTraversals(null, null);
			for (int j = 0; j < traversals.length; j++) {
				IResource[] traversalResources = traversals[j].getResources();
				for (int k = 0; k < traversalResources.length; k++) {
					if (!resourceArray.contains(traversalResources[k]))
						resourceArray.add(traversalResources[k]);
				}
			}
		} catch (CoreException e) {
			SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
		}
	}		
	IResource[] selectedResources = new IResource[resourceArray.size()];
	resourceArray.toArray(selectedResources);
	return selectedResources;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:30,代码来源:TeamAction.java


示例2: create

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
public static ResourceMapping create(IJavaElement element) {
  switch (element.getElementType()) {
    case IJavaElement.TYPE:
      return create((IType) element);
    case IJavaElement.COMPILATION_UNIT:
      return create((ICompilationUnit) element);
    case IJavaElement.CLASS_FILE:
      return create((IClassFile) element);
    case IJavaElement.PACKAGE_FRAGMENT:
      return create((IPackageFragment) element);
    case IJavaElement.PACKAGE_FRAGMENT_ROOT:
      return create((IPackageFragmentRoot) element);
    case IJavaElement.JAVA_PROJECT:
      return create((IJavaProject) element);
    case IJavaElement.JAVA_MODEL:
      return create((IJavaModel) element);
    default:
      return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:JavaElementResourceMapping.java


示例3: copy

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
public void copy(
    IPackageFragmentRoot sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
  add(sourceFolder, javaArgs, null);
  ResourceMapping mapping = JavaElementResourceMapping.create(sourceFolder);
  if (mapping != null) {
    add(mapping, resourceArgs, null);
  }
  IResource sourceResource = sourceFolder.getResource();
  if (sourceResource != null) {
    getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
    IFile classpath = getClasspathFile((IResource) resourceArgs.getDestination());
    if (classpath != null) {
      getResourceModifications().addChanged(classpath);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:CopyModifications.java


示例4: perform

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 2);
  try {
    String newName = getNewResourceName();
    IPackageFragmentRoot root = getRoot();
    ResourceMapping mapping = JavaElementResourceMapping.create(root);
    final Change result =
        doPerformReorg(
            getDestinationProjectPath().append(newName), new SubProgressMonitor(pm, 1));
    markAsExecuted(root, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:PackageFragmentRootReorgChange.java


示例5: readFiles

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private static <RES> List<RES> readFiles(ResourceMapping resourceMapping,
    final FileFilter<RES> fileFilter) {
  final List<RES> fileList = new ArrayList<RES>(1);
  IResourceVisitor visitor = new IResourceVisitor() {
    public boolean visit(IResource resource) throws CoreException {
      if (resource instanceof IFile == false) {
        return true;
      } else {
        IFile file = (IFile) resource;
        RES res = fileFilter.accept(file);
        if (res != null) {
          fileList.add(res);
        }
        return false;
      }
    }
  };
  try {
    resourceMapping.accept(null, visitor, null);
  } catch (CoreException e) {
    throw new RuntimeException(e);
  }
  return fileList;
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:25,代码来源:FileBasedAction.java


示例6: create

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
public static ResourceMapping create(IJavaElement element) {
	switch (element.getElementType()) {
		case IJavaElement.TYPE:
			return create((IType)element);
		case IJavaElement.COMPILATION_UNIT:
			return create((ICompilationUnit)element);
		case IJavaElement.CLASS_FILE:
			return create((IClassFile)element);
		case IJavaElement.PACKAGE_FRAGMENT:
			return create((IPackageFragment)element);
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			return create((IPackageFragmentRoot)element);
		case IJavaElement.JAVA_PROJECT:
			return create((IJavaProject)element);
		case IJavaElement.JAVA_MODEL:
			return create((IJavaModel)element);
		default:
			return null;
	}

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:JavaElementResourceMapping.java


示例7: getAdapter

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Object getAdapter(final Object adaptable, final Class adapter) {
	if (adaptable instanceof JavaModelProvider) {
		if (adapter == IResourceMappingMerger.class)
			return new JavaModelMerger((ModelProvider) adaptable);
		else if (adapter == ISynchronizationCompareAdapter.class)
			return new JavaSynchronizationCompareAdapter();
	} else if (adaptable instanceof RefactoringHistory) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable);
		else if (adapter == IResource.class)
			return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable).getResource();
	} else if (adaptable instanceof RefactoringDescriptorProxy) {
		if (adapter == ResourceMapping.class)
			return new JavaRefactoringDescriptorResourceMapping((RefactoringDescriptorProxy) adaptable);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaModelAdapterFactory.java


示例8: getAdapter

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
default <T> T getAdapter(final Class<T> adapter) {

	if (IWorkingSet.class == adapter || ResourceMapping.class == adapter) {
		return (T) new WorkingSetAdapter(this);
	}

	return Platform.getAdapterManager().getAdapter(this, adapter);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:WorkingSet.java


示例9: getResource

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
/**
 * Returns the resource for the given input object, or
 * null if there is no resource associated with it.
 *
 * @param object  the object to find the resource for
 * @return the resource for the given object, or null
 */
private IResource getResource(Object object) {
	if (object instanceof ResourceMapping) {
		object = ((ResourceMapping) object).getModelObject();
		return getModelObjectResource(object);
	}
	if (object instanceof IResource) {
		return (IResource) object;
	}
	if (object instanceof IAdaptable) {
		return (IResource) ((IAdaptable) object).getAdapter(
			IResource.class);
	}
	return null;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:22,代码来源:SVNLightweightDecorator.java


示例10: contains

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public boolean contains(ResourceMapping mapping) {
  if (mapping instanceof JavaElementResourceMapping) {
    JavaElementResourceMapping javaMapping = (JavaElementResourceMapping) mapping;
    IJavaElement element = getJavaElement();
    IJavaElement other = javaMapping.getJavaElement();
    if (other != null && element != null) return element.getPath().isPrefixOf(other.getPath());
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:JavaElementResourceMapping.java


示例11: markAsExecuted

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
  ReorgExecutionLog log = (ReorgExecutionLog) getAdapter(ReorgExecutionLog.class);
  if (log != null) {
    log.markAsProcessed(unit);
    log.markAsProcessed(mapping);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:CreateCopyOfCompilationUnitChange.java


示例12: perform

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public Change perform(IProgressMonitor monitor) throws CoreException {
  ResourceMapping mapping = JavaElementResourceMapping.create(fOldCu);
  final Change result = super.perform(monitor);
  markAsExecuted(fOldCu, mapping);
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:CreateCopyOfCompilationUnitChange.java


示例13: markAsExecuted

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private void markAsExecuted(IPackageFragmentRoot root, ResourceMapping mapping) {
  //		ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
  //		if (log != null) {
  //			log.markAsProcessed(root);
  //			log.markAsProcessed(mapping);
  //		}
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:PackageFragmentRootReorgChange.java


示例14: perform

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 1);
  try {
    ICompilationUnit unit = getCu();
    ResourceMapping mapping = JavaElementResourceMapping.create(unit);
    Change result = doPerformReorg(new SubProgressMonitor(pm, 1));
    markAsExecuted(unit, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:CompilationUnitReorgChange.java


示例15: markAsExecuted

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private void markAsExecuted(ICompilationUnit unit, ResourceMapping mapping) {
  //		ReorgExecutionLog log= (ReorgExecutionLog)getAdapter(ReorgExecutionLog.class);
  //		if (log != null) {
  //			log.markAsProcessed(unit);
  //			log.markAsProcessed(mapping);
  //		}
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:CompilationUnitReorgChange.java


示例16: perform

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public final Change perform(IProgressMonitor pm)
    throws CoreException, OperationCanceledException {
  pm.beginTask(getName(), 1);
  try {
    IPackageFragment pack = getPackage();
    ResourceMapping mapping = JavaElementResourceMapping.create(pack);
    final Change result = doPerformReorg(pm);
    // markAsExecuted(pack, mapping);
    return result;
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:PackageReorgChange.java


示例17: markAsExecuted

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private void markAsExecuted(IPackageFragment pack, ResourceMapping mapping) {
  ReorgExecutionLog log = (ReorgExecutionLog) getAdapter(ReorgExecutionLog.class);
  if (log != null) {
    log.markAsProcessed(pack);
    log.markAsProcessed(mapping);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:PackageReorgChange.java


示例18: getAdaptedResourceMapping

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
@Override
public ResourceMapping getAdaptedResourceMapping(IAdaptable adaptable) {
    if (adaptable instanceof TreeElement<?, ?>) {
        TreeElement<?, ?> elt = (TreeElement<?, ?>) adaptable;
        return super.getAdaptedResourceMapping(elt.getJavaElement());
    }
    return super.getAdaptedResourceMapping(adaptable);
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:9,代码来源:ElementAdapterFactory.java


示例19: addOpenWithMenu

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private void addOpenWithMenu(final IMenuManager aMenu) {
	final IStructuredSelection ss = (IStructuredSelection) getContext().getSelection();
	if (ss == null || ss.size() != 1) { return; }
	final Object o = ss.getFirstElement();
	// first try IResource
	IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, IResource.class);
	// otherwise try ResourceMapping
	if (openable == null) {
		openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, ResourceMapping.class);
	} else if (((IResource) openable).getType() != IResource.FILE) {
		openable = null;
	}
	if (openable != null) {
		// Create a menu flyout.
		final IMenuManager submenu =
				new MenuManager(WorkbenchNavigatorMessages.OpenActionProvider_OpenWithMenu_label,
						ICommonMenuConstants.GROUP_OPEN_WITH);
		submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP));
		submenu.add(new OpenWithMenu(viewSite.getPage(), openable));
		submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS));

		// Add the submenu.
		if (submenu.getItems().length > 2 && submenu.isEnabled()) {
			aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu);
		}
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:28,代码来源:OpenActionProvider.java


示例20: readFilesFromSelectionObject

import org.eclipse.core.resources.mapping.ResourceMapping; //导入依赖的package包/类
private static <RES> List<RES> readFilesFromSelectionObject(Object element,
    FileFilter<RES> fileFilter) {
  if (element instanceof ResourceMapping == false) {
    return null;
  }
  ResourceMapping resourceMapping = (ResourceMapping) element;
  return readFiles(resourceMapping, fileFilter);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:9,代码来源:FileBasedAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShareContent类代码示例发布时间:2022-05-22
下一篇:
Java MaxForwardsHeader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap