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


Java IWorkspaceRoot.findContainersForLocationURI方法代码示例

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


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

示例1: determineContainersToCheck

import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
/**
 * Given a base URI, figure out which {@link IFolder}, if any, it refers to.
 *
 * @param baseURI
 *          to find the folder(s) for; must not be {@code null}
 * @return an array of all folders mapping to that URI, or an empty array if none do.
 */
private static IContainer[] determineContainersToCheck(final URI baseURI) {
  Preconditions.checkNotNull(baseURI);
  IContainer[] result = {};
  if (baseURI.isPlatformResource() || baseURI.isFile()) {
    IWorkspaceRoot workspace = EcorePlugin.getWorkspaceRoot();
    if (workspace != null) {
      if (baseURI.isFile()) {
        result = workspace.findContainersForLocationURI(java.net.URI.create(baseURI.toString()));
      } else {
        // Must be a platform/resource URI
        IPath platformPath = new Path(baseURI.toPlatformString(true));
        IFolder folder = workspace.getFolder(platformPath);
        if (folder != null) {
          result = new IContainer[] {folder};
        }
      }
    }
  }
  return result;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:28,代码来源:CheckGenModelUtil.java

示例2: getOverlappingProjectName

import org.eclipse.core.resources.IWorkspaceRoot; //导入方法依赖的package包/类
/**
 * Returns the name of a {@link IProject} with a location that includes targetDirectory. Returns null if there is no
 * such {@link IProject}.
 *
 * @param targetDirectory
 *            the path of the directory to check.
 * @return the overlapping project name or <code>null</code>
 */
private String getOverlappingProjectName(String targetDirectory) {
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	IPath testPath = new Path(targetDirectory);
	IContainer[] containers = root.findContainersForLocationURI(testPath.makeAbsolute().toFile().toURI());
	if (containers.length > 0) {
		return containers[0].getProject().getName();
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:AbstractExportToSingleFileWizardPage.java


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