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


Java URI.createPlatformResourceURI方法代码示例

本文整理汇总了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 "";
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:20,代码来源:SelectEcoreProposal.java

示例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());
	}
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:25,代码来源:RegisterOCCIExtensionAction.java

示例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);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:NfarStorageMapper.java

示例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");
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:24,代码来源:RunConfiguration.java

示例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());
}
 
开发者ID:enikao,项目名称:eclipse-commons,代码行数:15,代码来源:TestToIResourcePositive.java

示例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());
}
 
开发者ID:enikao,项目名称:eclipse-commons,代码行数:10,代码来源:TestToIResourcePositive.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:12,代码来源:EclipseBasedProjectModelSetup.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:TaskGenerateAdoc.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSAllContainersState.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4JSStorage2UriMapper.java

示例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);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:9,代码来源:OcciHelper.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:EclipseBasedN4JSWorkspace.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:EclipseBasedN4JSWorkspace.java

示例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());
}
 
开发者ID:enikao,项目名称:eclipse-commons,代码行数:15,代码来源:TestToIResourcePositive.java

示例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();
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:9,代码来源:ResourceMerger.java


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