本文整理汇总了Java中org.eclipse.emf.common.util.URI.createPlatformResourceURI方法的典型用法代码示例。如果您正苦于以下问题:Java URI.createPlatformResourceURI方法的具体用法?Java URI.createPlatformResourceURI怎么用?Java URI.createPlatformResourceURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.URI
的用法示例。
在下文中一共展示了URI.createPlatformResourceURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReplacementText
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public String getReplacementText() {
SelectEcoreIFileDialog dialog = new SelectEcoreIFileDialog();
if (dialog.open() == Dialog.OK) {
Object[] selections = dialog.getResult();
if(selections != null
&& selections.length != 0
&& selections[0] instanceof IResource
){
IResource ecoreFile = (IResource) selections[0];
ecoreProject = ecoreFile.getProject();
String path = "/"+ecoreFile.getProject().getName() +"/"+ecoreFile.getProjectRelativePath();
URI uri = URI.createPlatformResourceURI(path,true);
String replacementText = "\""+uri.toString()+"\"";
return replacementText;
}
}
return "";
}
示例2: run
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
if (selection != null) {
IFile selectedFile = (IFile) ((IStructuredSelection) selection)
.getFirstElement();
// Use a platform:/resource/ URI
URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true);
ResourceSet rs = new ResourceSetImpl();
Resource r = rs.getResource(uri, true);
Extension extension = (Extension) r.getContents().get(0);
OcciRegistry.getInstance().registerExtension(extension.getScheme(),
uri.toString());
closeOtherSessions(selectedFile.getProject());
MessageDialog.openInformation(shell,
Messages.RegisterExtensionAction_ExtRegistration,
Messages.RegisterExtensionAction_RegisteredExtension
+ extension.getScheme());
}
}
示例3: collectNfarURIs
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public void collectNfarURIs(IFile nfarArchive, Set<URI> target) {
URI archiveURI = URI.createPlatformResourceURI(nfarArchive.getFullPath().toString(), true);
Set<URI> entries = knownEntries.get(archiveURI);
if (entries != null) {
target.addAll(entries);
} else if (nfarArchive.exists()) {
Optional<? extends IN4JSEclipseProject> projectOpt = eclipseCore.create(nfarArchive.getProject());
if (projectOpt.isPresent()) {
IN4JSEclipseProject n4jsProject = projectOpt.get();
if (n4jsProject.exists()) {
updateCache(n4jsProject);
}
entries = knownEntries.get(archiveURI);
if (entries != null) {
target.addAll(entries);
} else { // project exists but archive is not on the project path - we have to scan it nevertheless
Optional<? extends IN4JSEclipseArchive> archive = eclipseCore.findArchive(archiveURI);
if (archive.isPresent()) {
traverseArchive(archive.get(), target);
}
}
}
}
}
示例4: extractInformation
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
protected void extractInformation() throws CoreException {
_languageName = getAttribute(LAUNCH_SELECTED_LANGUAGE, "");
_modelURI = URI.createPlatformResourceURI(getAttribute(AbstractDSLLaunchConfigurationDelegate.RESOURCE_URI, ""),
true);
String animatorURIAsString = getAttribute("airdResource", "");
if (animatorURIAsString != null && !animatorURIAsString.equals("")) {
_animatorURI = URI.createPlatformResourceURI(animatorURIAsString, true);
_animationDelay = getAttribute(LAUNCH_DELAY, 0);
}
_deadlockDetectionDepth = getAttribute(LAUNCH_DEADLOCK_DETECTION_DEPTH, 10);
_methodEntryPoint = getAttribute(LAUNCH_METHOD_ENTRY_POINT, "");
_modelEntryPoint = getAttribute(LAUNCH_MODEL_ENTRY_POINT, "");
_modelInitializationMethod = getAttribute(LAUNCH_INITIALIZATION_METHOD, "");
_modelInitializationArguments = getAttribute(LAUNCH_INITIALIZATION_ARGUMENTS, "");
_melangeQuery = getAttribute(LAUNCH_MELANGE_QUERY, "");
for (EngineAddonSpecificationExtension extension : EngineAddonSpecificationExtensionPoint.getSpecifications()) {
_engineAddonExtensions.put(extension, getAttribute(extension.getName(), false));
}
_breakStart = getAttribute(LAUNCH_BREAK_START, Boolean.FALSE);
_debugModelID = getAttribute(DEBUG_MODEL_ID, ".debugModel");
}
示例5: folderSlashesInbetween
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
public void folderSlashesInbetween() throws Exception {
waitForWorkspaceChanges(() -> {
IFolder folder = project.getFolder("myFolder");
folder.create(true, true, null);
});
URI uri = URI.createPlatformResourceURI("/myProject///myFolder", true);
IResource iResource = UriUtils.toIResource(uri);
assertTrue(iResource instanceof IFolder);
assertTrue(iResource.exists());
assertEquals("/myProject/myFolder", iResource.getFullPath().toString());
}
示例6: projectSlashes
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
public void projectSlashes() throws Exception {
URI uri = URI.createPlatformResourceURI("/myProject///", true);
IResource iResource = UriUtils.toIResource(uri);
assertTrue(iResource instanceof IProject);
assertTrue(iResource.exists());
assertEquals("/myProject", iResource.getFullPath().toString());
}
示例7: createTempProject
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/***/
protected URI createTempProject(String projectName) throws CoreException {
IProjectDescription description = workspace.getWorkspace().newProjectDescription(projectName);
// deliberately avoid the build command
description.setNatureIds(new String[] { XtextProjectHelper.NATURE_ID });
IProject newProject = workspace.getProject(projectName);
newProject.create(null);
newProject.open(null);
newProject.setDescription(description, null);
return URI.createPlatformResourceURI(projectName, true);
}
示例8: getProjects
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private Set<IN4JSProject> getProjects() {
Set<IN4JSProject> projects = new HashSet<>();
for (Object element : selection.toList()) {
if (element instanceof IResource) {
URI uri = URI.createPlatformResourceURI((((IResource) element)).getFullPath().toString(), true);
Optional<? extends IN4JSProject> optProject = n4JSCore.findProject(uri);
IN4JSProject project = optProject.get();
projects.add(project);
}
}
return projects;
}
示例9: isSourceContainerModification
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private boolean isSourceContainerModification(final IResourceDelta delta) {
final String fullPath = delta.getFullPath().toString();
final URI folderUri = URI.createPlatformResourceURI(fullPath, true);
final IN4JSProject project = core.findProject(folderUri).orNull();
if (null != project && project.exists()) {
return from(project.getSourceContainers())
.transform(container -> container.getLocation())
.filter(uri -> uri.isPlatformResource())
.transform(uri -> uri.toString())
.transform(uri -> uri.replaceFirst(PLATFORM_RESOURCE_SCHEME, ""))
.firstMatch(uri -> uri.equals(fullPath))
.isPresent();
}
return false;
}
示例10: internalGetUri
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private URI internalGetUri(IStorage storage) {
if (storage instanceof IFile) {
if (storage instanceof ExternalFile) {
final File externalResource = ((ExternalFile) storage).getExternalResource();
if (externalResource.exists() && externalResource.isFile()) {
return URI.createFileURI(externalResource.getAbsolutePath());
}
} else {
return URI.createPlatformResourceURI(storage.getFullPath().toString(), true);
}
}
return null;
}
示例11: getRootElement
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public static EObject getRootElement(ResourceSet resourceSet, IFile file) {
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
System.out.println("file " + file.getFullPath().toString());
System.out.println("uri " + uri);
org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(uri, true);
EcoreUtil.resolveAll(resource);
return resource.getContents().get(0);
}
示例12: findProjectWith
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI findProjectWith(URI nestedLocation) {
if (nestedLocation.isPlatformResource()
&& nestedLocation.segmentCount() >= DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) {
return URI.createPlatformResourceURI(nestedLocation.segment(1), true);
}
return null;
}
示例13: getLocation
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI getLocation(URI projectURI, ProjectReference projectReference,
N4JSSourceContainerType expectedN4JSSourceContainerType) {
if (projectURI.segmentCount() >= DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) {
String expectedProjectName = projectReference.getProject().getProjectId();
if (expectedProjectName != null && expectedProjectName.length() > 0) {
IProject existingProject = workspace.getProject(expectedProjectName);
if (existingProject.isAccessible()) {
if (expectedN4JSSourceContainerType == N4JSSourceContainerType.ARCHIVE) {
return null;
} else {
return URI.createPlatformResourceURI(expectedProjectName, true);
}
} else if (expectedN4JSSourceContainerType == N4JSSourceContainerType.ARCHIVE) {
for (String libFolder : getLibraryFolders(projectURI)) {
IFile archiveFile = workspace.getFile(new Path(projectURI.segment(1) + "/" + libFolder
+ "/"
+ expectedProjectName
+ IN4JSArchive.NFAR_FILE_EXTENSION_WITH_DOT));
if (archiveFile.exists()) {
return URI.createPlatformResourceURI(archiveFile.getFullPath().toString(), true);
}
}
}
}
}
return null;
}
示例14: folderSlash
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
public void folderSlash() throws Exception {
waitForWorkspaceChanges(() -> {
IFolder folder = project.getFolder("myFolder");
folder.create(true, true, null);
});
URI uri = URI.createPlatformResourceURI("/myProject/myFolder/", true);
IResource iResource = UriUtils.toIResource(uri);
assertTrue(iResource instanceof IFolder);
assertTrue(iResource.exists());
assertEquals("/myProject/myFolder", iResource.getFullPath().toString());
}
示例15: getResources
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private EList<Resource> getResources() {
ResourceSet rs = new ResourceSetImpl();
URI inputURI = URI.createPlatformResourceURI(_context.getInputFile().getFullPath().toString(), true);
Resource r = rs.getResource(inputURI, true);
EcoreUtil.resolveAll(r);
EcoreUtil.resolveAll(rs); // result in the load of several resources
return rs.getResources();
}