热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.eclipse.emf.common.util.URI.isPlatformResource()方法的使用及代码示例

本文整理了Java中org.eclipse.emf.common.util.URI.isPlatformResource()方法的一些代码示例,展示了URI

本文整理了Java中org.eclipse.emf.common.util.URI.isPlatformResource()方法的一些代码示例,展示了URI.isPlatformResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.isPlatformResource()方法的具体详情如下:
包路径:org.eclipse.emf.common.util.URI
类名称:URI
方法名:isPlatformResource

URI.isPlatformResource介绍

[英]Returns true if this is a platform resource URI, that is, a #isPlatform whose first segment is "resource"; false is returned otherwise.
[中]如果这是平台资源URI,即第一段为“资源”的#isPlatform,则返回true;否则返回false

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.common

@Override
public boolean isPlatformResource()
{
return uri.isPlatformResource();
}

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore

@Override
public boolean canHandle(URI uri)
{
return uri.isPlatformResource();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore

@Override
public boolean canHandle(URI uri)
{
return uri.isPlatformResource();
}

代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-core

@Override
public boolean isPlatformResource() {
return internalUri.isPlatformResource();
}

代码示例来源:origin: atlanmod/NeoEMF

@Override
public boolean isPlatformResource() {
return base.isPlatformResource();
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.common.types

/**
* @since 2.9
*/
protected boolean isProjectLocal(URI uri, final String encodedProjectName) {
if (uri == null || uri.segmentCount() <2 || !uri.isPlatformResource())
return false;
else
return !uri.segment(1).equals(encodedProjectName);
}

代码示例来源:origin: org.eclipse/xtext

public CharSequence wrapWithTraceData(CharSequence sequence, URI originResourceURI, int originOffset, int originLength, int originLineNumber, int originEndLineNumber) {
if (!originResourceURI.isPlatformResource()) {
throw new IllegalArgumentException("URI has to be a platform resource uri but was: " + originResourceURI+ ". Use #wrapWithTraceData(CharSequence, URI, String, int, int) instead.");
}
return wrapWithTraceData(sequence, originResourceURI, originResourceURI.segment(1), originOffset, originLength, originLineNumber, originEndLineNumber);
}

代码示例来源:origin: org.eclipse.xtext/ui

@SuppressWarnings("unchecked")
public T getAdapter(Class adapterType) {
URI uri = resource.getURI();
if ((adapterType == IFile.class || adapterType == IResource.class) && uri.isPlatformResource()) {
return (T) ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
}
return null;
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

public static void validateFile(URI modelPath) {
if (modelPath.isPlatformResource()) {
IFile file;
try {
file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(modelPath.toPlatformString(true)));
} catch (Exception e) {
throw new RuntimeException(format("The model file '%s' does not exist.", modelPath));
}
if (file == null || !file.exists()) {
throw new RuntimeException(format("The model file '%s' does not exist.", modelPath));
}
if (file.getType() != IResource.FILE) {
throw new RuntimeException(format("The '%s' path is not a file.", modelPath));
}
}
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

private File getOutletFolder(URI uri) {
if (uri.isPlatformResource()) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFolder folder = root.getFolder((IPath) toPath(uri));
return new File(folder.getLocationURI());
}
return new File(uri.toFileString());
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

protected String toRelativePath(URI uri) {
String relativePath = null;
if (uri.isPlatformResource()) {
IFolder folder = EcorePlugin.getWorkspaceRoot().getFolder((IPath) toPath(uri));
relativePath = folder.getProjectRelativePath().toString() + File.separator;
} else {
relativePath = new File(getConfiguration().getProjectFolder().toFileString()).toURI().relativize(
new File(uri.toFileString()).toURI()).getPath();
relativePath = relativePath + File.separator;
}
return relativePath;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.edit

/**
* Returns whether to expect that the resource corresponding to the given URI form will be read only.
* @deprecated this method is no longer called by {@link #isReadOnly(Resource)}
*/
@Deprecated
protected boolean isReadOnlyURI(URI uri)
{
if (uri.isArchive())
{
return isReadOnlyURI(URI.createURI(uri.authority()));
}
return !uri.isPlatformResource() && (uri.isRelative() || !uri.isFile());
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

private Outlet createOutlet(String name, URI uri, boolean overwrite, boolean required, PostProcessor postProcessor) {
Outlet outlet = null;
if (uri.isPlatformResource()) {
outlet = createResourceOutlet(name, uri, overwrite, required);
} else if (uri.isFile()) {
outlet = createOutlet(name, uri, overwrite, required);
}
if (outlet != null && postProcessor != null) {
outlet.addPostprocessor(postProcessor);
}
return outlet;
}

代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.patternlanguage.emf

@Override
public boolean isStandaloneFileURI(EObject context, URI uri) {
if (uri.isPlatformResource() && context.eResource() != null) {
IProjectConfig project = projectConfigurationProvider.getProjectConfig(context.eResource().getResourceSet());
if (project != null) {
return project.findSourceFolderContaining(uri) == null;
}
}
return true;
}
}

代码示例来源:origin: org.eclipse.xtext/ui

private IProject getProject(Resource resource) {
URI uri = resource.getURI();
if (uri.isPlatformResource()) {
final IProject project = getWorkspaceRoot().getProject(uri.segment(1));
if (project.isAccessible())
return project;
}
return null;
}

代码示例来源:origin: org.eclipse.xtext/ui

public Iterable> getStorages(URI uri) {
if (!uri.isPlatformResource()) {
// support storage lookup by absolute file URI as it is possibly resolved by importURI references
if (uri.isFile()) {
IPath path = new Path(uri.toFileString());
if (path.isAbsolute()) {
IFile file = getWorkspaceRoot().getFileForLocation(path);
return getStorages(file);
}
}
return emptySet();
}
IFile file = getWorkspaceRoot().getFile(new Path(uri.toPlatformString(true)));
return getStorages(file);
}

代码示例来源:origin: org.eclipse.xtext/ui

protected boolean isValidTargetFile(Resource resource, StatusWrapper status) {
IFile targetFile = projectUtil.findFileStorage(resource.getURI(), true);
if (targetFile != null)
return true;
String path = (resource.getURI().isPlatformResource())
? resource.getURI().toPlatformString(true)
: resource.getURI().toString();
status.add(FATAL, "Rename target file '" + path + "' cannot be accessed", resource.getURI());
return false;
}

代码示例来源:origin: org.codehaus.openxma/dsl-generator

private File getProjectDirectoryFile() {
if (projectDirectory == null) {
if (getConfiguration().getProjectFolder().isPlatformResource()) {
IProject project = EcorePlugin.getWorkspaceRoot().getProject(
getConfiguration().getProjectFolder().lastSegment());
projectDirectory = new File(project.getLocationURI());
} else {
projectDirectory = new File(getConfiguration().getProjectFolder().toFileString());
}
}
return projectDirectory;
}

代码示例来源:origin: org.eclipse/xtext

/**
* @return the resources uri in the normalized form or as is if it is a platform:/resource URI.
* @since 2.4
*/
public static URI getPlatformResourceOrNormalizedURI(Resource resource) {
URI rawURI = resource.getURI();
if (rawURI.isPlatformResource()) {
return rawURI;
}
if(resource.getResourceSet() != null) {
return resource.getResourceSet().getURIConverter().normalize(rawURI);
} else {
return URIConverter.INSTANCE.normalize(rawURI);
}
}

代码示例来源:origin: org.eclipse.xtext/ui

/**
* Produces hyperlinks for the given {@code region} that point to the referenced {@code target}.
*/
public void createHyperlinksTo(XtextResource from, Region region, EObject target, IHyperlinkAcceptor acceptor) {
final URIConverter uriCOnverter= from.getResourceSet().getURIConverter();
final String hyperlinkText = labelProvider.getText(target);
final URI uri = EcoreUtil.getURI(target);
final URI normalized = uri.isPlatformResource() ? uri : uriConverter.normalize(uri);
XtextHyperlink result = hyperlinkProvider.get();
result.setHyperlinkRegion(region);
result.setURI(normalized);
result.setHyperlinkText(hyperlinkText);
acceptor.accept(result);
}

推荐阅读
author-avatar
wonderoil
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有