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


Java URI.isPlatformResource方法代码示例

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


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

示例1: getProjectDescription

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public ProjectDescription getProjectDescription(URI location) {
	if (!location.isPlatformResource()) {
		return null;
	}
	ProjectDescription existing = cache.get(location);
	if (existing == null) {
		if (location.isPlatformResource() && location.segmentCount() == DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) {
			existing = loadManifest(location.appendSegment(IN4JSProject.N4MF_MANIFEST));
		} else {
			existing = loadManifest(ArchiveURIUtil.createURI(location, IN4JSProject.N4MF_MANIFEST));
		}
		if (existing != null) {
			cache.put(location, existing);
			if (listener != null) {
				listener.onDescriptionLoaded(location);
			}
		}
	}
	return existing;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:EclipseBasedN4JSWorkspace.java

示例2: getN4JSProject

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public N4JSEclipseProject getN4JSProject(URI location) {
	checkArgument(
			location.isPlatformResource() || location.isFile(),
			"Expected either platform:/resource or file:/ URI. Was: " + location);

	if (location.isPlatformResource() && location.segmentCount() != DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT) {
		checkArgument(
				DIRECT_RESOURCE_IN_PROJECT_SEGMENTCOUNT == location.segmentCount(),
				"Expected 2 segment counts for platform resource URI. Was " + location.segmentCount());
	}

	final String projectName = location.lastSegment();
	final IProject project;
	if (location.isFile()) {
		project = externalLibraryWorkspace.getProject(projectName);
		checkNotNull(project, "Project does not exist in external workspace. URI: " + location);
	} else {
		project = workspace.getProject(projectName);
	}

	return doGetN4JSProject(project, location);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4JSEclipseModel.java

示例3: showInstruction

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Show the given {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instruction
 *            the {@link EObject instruction} to show
 */
public static void showInstruction(DialectEditor editorPart, EObject instruction) {
	final URI resourceURI = instruction.eResource().getURI();
	if (resourceURI.isPlatformResource()) {
		final String resourcePath = resourceURI.toPlatformString(true);
		final IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
				resourcePath));
		try {
			final IMarker marker = resource.createMarker(EValidator.MARKER);
			marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
			final TraceabilityMarkerNavigationProvider navigationProvider = new TraceabilityMarkerNavigationProvider(
					(DialectEditor)editorPart);
			navigationProvider.gotoMarker(marker);
			marker.delete();
		} catch (CoreException e) {
			DebugSiriusIdeUiPlugin.INSTANCE.log(e);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:SiriusEditorUtils.java

示例4: 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

示例5: getArchiveStream

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private ZipInputStream getArchiveStream(final URI archiveLocation) throws CoreException, IOException {
	if (archiveLocation.isPlatformResource()) {
		IFile workspaceFile = workspace.getFile(new Path(archiveLocation.toPlatformString(true)));
		return new ZipInputStream(workspaceFile.getContents());
	} else {
		return new ZipInputStream(new URL(archiveLocation.toString()).openStream());
	}

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:EclipseBasedN4JSWorkspace.java

示例6: onDescriptionLoaded

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
void onDescriptionLoaded(URI location) {
	if (location.isPlatformResource() && location.segmentCount() == 2) {
		IN4JSEclipseProject n4project = eclipseCore.create(location);
		IProject eclipseProject = n4project.getProject();
		updateProjectReferencesIfNecessary(eclipseProject);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:ProjectDescriptionLoadListener.java

示例7: isProjectVisible

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private boolean isProjectVisible(Resource contextResource, URI elementLocation) {
	URI moduleURI = getURI(contextResource);

	if (moduleURI.isPlatformResource() && elementLocation.isPlatformResource()) {
		// Not valid for PUBLIC_INTERNAL
		final boolean visible = moduleURI.segment(1).equals(elementLocation.segment(1));
		// A special case when checking visibility between host and test project. Since type is not resolved and
		// we do not want additional CPU cycles we check whether the context resource contained in a test
		// project that has a host at all.
		// TODO IDEBUG-640 this needs to be reviewed again, since the refactoring made here are invalid.
		if (visible) {
			return true;
		} else {
			if (getTestedProjects(getURI(contextResource)).isEmpty()) {
				return false;
			}
			//$FALL-THROUGH$ if the project for the context resource has a host project.
		}
	} else {
		ResourceSet resourceSet = contextResource.getResourceSet();

		EObject loadedType = resourceSet.getEObject(elementLocation, false);
		if (loadedType == null) {
			loadedType = resourceSet.getEObject(elementLocation, true);
		}
		if (loadedType instanceof Type) {
			// delegate to the *real* impl
			return isVisible(contextResource, TypeAccessModifier.PROJECT, (Type) loadedType).visibility;
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:TypeVisibilityChecker.java

示例8: removePlatformScheme

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public static String removePlatformScheme(URI uri)
{
	String result = uri.toString();
	if (uri.isPlatformResource())
	{
		result = uri.toString().replace("platform:/resource", "");
	}		
	else if (uri.isPlatformPlugin())
	{
		result = uri.toString().replace("platform:/plugin", "");
	}
	return result;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:14,代码来源:URIHelper.java

示例9: isExternal

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private boolean isExternal(URI resourceURI) {
	return !resourceURI.isPlatformResource();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:N4MFWizardTestedProjectPage.java

示例10: toIResource

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Returns the equivalent {@linkplain org.eclipse.core.resources.IResource
 * Eclipse IResource} for an {@linkplain org.eclipse.emf.common.util.URI Ecore
 * URI}, if available.
 * 
 * <p>
 * {@code uri} can be represented as IResource if {@code uri} is an
 * {@linkplain URI#isPlatformResource() platform resource} (i.e. {@code uri}
 * starts with {@code platform:/resource/}). Otherwise, this method returns
 * {@code null}.
 * </p>
 * 
 * <p>
 * This method ignores any {@linkplain URI#fragment() fragment} or
 * {@linkplain URI#query() query} of {@code uri}.
 * </p>
 * 
 * <p>
 * If the resulting IResource exists, this method returns the existing kind of
 * IResource ({@linkplain org.eclipse.core.resources.IWorkspaceRoot
 * IWorkspaceRoot}, {@linkplain org.eclipse.core.resources.IProject IProject},
 * {@linkplain org.eclipse.core.resources.IFolder IFolder}, or
 * {@linkplain org.eclipse.core.resources.IFile IFile}).
 * </p>
 * 
 * <p>
 * If the resulting IResource does not exist, this method returns an IFile
 * pointing to the place equivalent to {@code uri}.
 * </p>
 * 
 * <p>
 * This method handles excess slashes (behind the platform resource identifiers)
 * gracefully (i.e. ignores the slashes).<br/>
 * Example: An URI of
 * {@code platform:/resource/////MyProject///folder///deep/myFile.ext//} leads
 * to an IFile for path {@code /MyProject/folder/deep/myFile.ext}.
 * </p>
 * 
 * <p>
 * <b>Note:</b> This method treats {@code uri} as case-sensitive (on <i>all</i>
 * platforms, including Windows). Therefore, if the workspace contained a file
 * at {@code /MyProject/myFolder/myFile.ext} and we passed the URI
 * {@code platform:/resource/MyProject/myFolder/mYfILE.ext} to this method, the
 * result is an IFile for path {@code /MyProject/myFolder/mYfILE.ext}.
 * {@link IResource#exists() result.exists()} will return {@code false}.
 * </p>
 * 
 * @param uri
 *            The Ecore URI to return as Eclipse IResource.
 * @return {@code uri} as Eclipse IResource, if available; {@code null}
 *         otherwise.
 * 
 * @throws IllegalArgumentException
 *             If {@code uri} is seriously ill-formatted.
 * 
 * @since 0.1
 */
public static @Nullable IResource toIResource(final @NonNull URI uri) {
	if (uri.isPlatformResource()) {
		String platformString = uri.toPlatformString(true);
		IPath path = Path.fromOSString(platformString);
		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
		if (workspaceRoot.exists(path)) {
			return workspaceRoot.findMember(path);
		} else {
			return workspaceRoot.getFile(path);
		}
	}

	return null;
}
 
开发者ID:enikao,项目名称:eclipse-commons,代码行数:72,代码来源:UriUtils.java


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