本文整理汇总了Java中org.eclipse.emf.common.util.URI.appendSegment方法的典型用法代码示例。如果您正苦于以下问题:Java URI.appendSegment方法的具体用法?Java URI.appendSegment怎么用?Java URI.appendSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.URI
的用法示例。
在下文中一共展示了URI.appendSegment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerProject
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
*
* @param location
* project directory containing manifest.n4mf directly
*/
public void registerProject(URI location) {
if (location.lastSegment().isEmpty()) {
throw new IllegalArgumentException("lastSegment may not be empty");
}
if (!projectElementHandles.containsKey(location)) {
LazyProjectDescriptionHandle lazyDescriptionHandle = createLazyDescriptionHandle(location, false);
projectElementHandles.put(location, lazyDescriptionHandle);
for (String libraryPath : lazyDescriptionHandle.createProjectElementHandle().getLibraryPaths()) {
URI libraryFolder = location.appendSegment(libraryPath);
File lib = new File(java.net.URI.create(libraryFolder.toString()));
if (lib.isDirectory()) {
for (File archive : lib.listFiles()) {
if (archive.getName().endsWith(IN4JSArchive.NFAR_FILE_EXTENSION_WITH_DOT)) {
URI archiveLocation = URI.createURI(archive.toURI().toString());
projectElementHandles.put(archiveLocation,
createLazyDescriptionHandle(archiveLocation, true));
}
}
}
}
}
}
示例2: load
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public Optional<Pair<ExternalProject, ProjectDescription>> load(final URI rootLocation) throws Exception {
if (null != rootLocation && rootLocation.isFile()) {
final File projectRoot = new File(rootLocation.toFileString());
if (projectRoot.exists() && projectRoot.isDirectory()) {
final URI manifestLocation = rootLocation.appendSegment(IN4JSProject.N4MF_MANIFEST);
final ProjectDescription projectDescription = packageManager.loadManifest(manifestLocation);
if (null != projectDescription) {
final ExternalProject project = new ExternalProject(projectRoot, NATURE_ID, BUILDER_ID);
return Optional.of(Tuples.create(project, projectDescription));
}
}
}
return Optional.absent();
}