本文整理了Java中org.eclipse.emf.common.util.URI.segmentCount()
方法的一些代码示例,展示了URI.segmentCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.segmentCount()
方法的具体详情如下:
包路径:org.eclipse.emf.common.util.URI
类名称:URI
方法名:segmentCount
[英]Returns the number of elements in the segment array that would be returned by #segments.
[中]返回段数组中由#段返回的元素数。
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.common
@Override
public int segmentCount()
{
return uri.segmentCount();
}
代码示例来源:origin: org.eclipse/org.eclipse.jem.util
public static boolean isValidFullyQualifiedModuleURI(URI aModuleURI) {
if (aModuleURI.segmentCount() < 3) {
return false;
}
return true;
}
/*
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.ui.workbench
static public String EMFtoPlatform(org.eclipse.emf.common.util.URI uri) {
if (!PLATFORM_SCHEMA_EMF.equals(uri.scheme()))
return null;
// remove all segments but first two - only need bundle/fragment name
int segments = uri.segmentCount();
// segments: { "plugin", "org.eclipse.platform", "myDir", "model.e4xmi" }
if (segments > 2)
uri = uri.trimSegments(segments - 2);
return uri.toString();
}
代码示例来源: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: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
/**
* Checks for folder mappings to cleanup the {@link #prefixMaps prefix maps}.
*/
@Override
protected void didRemove(Entry<URI, URI> entry)
{
if (((MappingEntryImpl)entry).isPrefixMapEntry)
{
int length = entry.getKey().segmentCount();
prefixMaps.get(length).remove(entry);
}
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
/**
* Checks for folder mappings to cleanup the {@link #prefixMaps prefix maps}.
*/
@Override
protected void didRemove(Entry<URI, URI> entry)
{
if (((MappingEntryImpl)entry).isPrefixMapEntry)
{
int length = entry.getKey().segmentCount();
prefixMaps.get(length).remove(entry);
}
}
代码示例来源:origin: org.emfjson/emfjson-jackson
@Override
public URI deresolve(URI baseURI, URI uri) {
return !uri.isPlatform() ||
(uri.segmentCount() > 0 &&
baseURI.segmentCount() > 0 && uri.segment(0).equals(baseURI.segment(0))) ?
super.deresolve(baseURI, uri) : uri;
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore.xmi
@Override
public URI deresolve(URI uri)
{
return !uri.isPlatform() || (uri.segmentCount() > 0 && baseURI.segmentCount() > 0 && uri.segment(0).equals(baseURI.segment(0))) ?
super.deresolve(uri) : uri;
}
}
代码示例来源:origin: emfjson/emfjson-jackson
@Override
public URI deresolve(URI baseURI, URI uri) {
return !uri.isPlatform() ||
(uri.segmentCount() > 0 &&
baseURI.segmentCount() > 0 && uri.segment(0).equals(baseURI.segment(0))) ?
super.deresolve(baseURI, uri) : uri;
}
代码示例来源:origin: org.eclipse/org.eclipse.jem
public String getPackageName(URI javaURI) {
if (isTypeURI(javaURI) || isPackageURI(javaURI)) {
if (javaURI.segmentCount() == 1) {
return javaURI.segment(0);
} else if (javaURI.segmentCount() == 0)
return ""; //$NON-NLS-1$
else
throw new IllegalArgumentException(javaURI.toString());
} else
throw new IllegalArgumentException(javaURI.toString());
}
代码示例来源:origin: org.jabylon/properties
public static URI computeTemplateResourceLocation(Locale locale, URI translationLocation, Locale masterLocale, ProjectVersion version) {
PropertyScanner scanner = createScanner(version);
URI parentPath = version.absoluteFilePath();
File path = scanner.findTemplate(new File(parentPath.path()+translationLocation.toString()), null);
URI location = URI.createFileURI(path.getAbsolutePath());
URI trimmedLocation = URI.createURI(location.segment(parentPath.segmentCount()));
for (int i = parentPath.segmentCount()+1; i < location.segmentCount(); i++) {
//append the other segments
trimmedLocation = trimmedLocation.appendSegment(location.segment(i));
}
return trimmedLocation;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore.xmi
@Override
public URI deresolve(URI uri)
{
return !uri.isPlatform() || (uri.segmentCount() > 1 && baseURI.segmentCount() > 1 && uri.segment(0).equals(baseURI.segment(0)) && uri.segment(1).equals(baseURI.segment(1))) ?
super.deresolve(uri) : uri;
}
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore.xmi
@Override
public URI deresolve(URI uri)
{
return !uri.isPlatform() || (uri.segmentCount() > 1 && baseURI.segmentCount() > 1 && uri.segment(0).equals(baseURI.segment(0)) && uri.segment(1).equals(baseURI.segment(1))) ?
super.deresolve(uri) : uri;
}
}
代码示例来源:origin: org.emfjson/emfjson-jackson
@Override
public URI deresolve(URI baseURI, URI uri) {
return !uri.isPlatform() ||
(uri.segmentCount() > 1 && baseURI.segmentCount() > 1 &&
uri.segment(0).equals(baseURI.segment(0)) &&
uri.segment(1).equals(baseURI.segment(1))) ?
super.deresolve(baseURI, uri) : uri;
}
代码示例来源:origin: emfjson/emfjson-jackson
@Override
public URI deresolve(URI baseURI, URI uri) {
return !uri.isPlatform() ||
(uri.segmentCount() > 1 && baseURI.segmentCount() > 1 &&
uri.segment(0).equals(baseURI.segment(0)) &&
uri.segment(1).equals(baseURI.segment(1))) ?
super.deresolve(baseURI, uri) : uri;
}
代码示例来源:origin: org.eclipse.xtext/ui
protected String getName() {
StringBuilder buffer = new StringBuilder(getURI().lastSegment());
buffer.append(" - ");
buffer.append(getURI().segment(1));
for (int i = 2; i < getURI().segmentCount() - 1; ++i) {
buffer.append("/");
buffer.append(getURI().segment(i));
}
return buffer.toString();
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.codegen.ecore
public String getRelativeGenModelLocation()
{
URI genModelURI = eResource().getURI();
String result = genModelURI.deresolve(genModelURI.trimSegments(genModelURI.segmentCount() - 2).appendSegment("")).toString();
return result;
}
代码示例来源:origin: org.eclipse/org.eclipse.jem.util
protected URI normalizePluginURI(URI uri, String fragment) {
if (uri.segmentCount() < 2)
return uri; // Invalid, just let it go on.
// See if already normalized.
int u_scoreNdx = uri.segment(1).lastIndexOf('_');
if (u_scoreNdx != -1) {
// Not normalized. Remove the version to make it normalized.
String[] segments = uri.segments();
segments[1] = segments[1].substring(0, u_scoreNdx);
return URI.createHierarchicalURI(uri.scheme(), uri.authority(), uri.device(), segments, uri.query(), fragment);
} else
return uri;
}
代码示例来源:origin: org.eclipse/org.eclipse.jem.util
protected static String getContentTypeName(URI uri) {
if (WorkbenchResourceHelperBase.isPlatformResourceURI(uri) || !isValidFullyQualifiedModuleURI(uri))
return null;
String contentTypeIdentifier = (uri.segmentCount() > 3 ? uri.segment(ModuleURI.CONTENT_TYPE_INDX) : null);
if (contentTypeIdentifier != null && Platform.getContentTypeManager().getContentType(uri.segment(ModuleURI.CONTENT_TYPE_INDX)) != null)
return contentTypeIdentifier;
else
return null;
}
public static boolean isValidFullyQualifiedModuleURI(URI aModuleURI) {
代码示例来源:origin: org.eclipse/org.eclipse.emf.codegen.ecore
public String getRelativeGenModelLocation()
{
URI genModelURI = eResource().getURI();
String result = genModelURI.deresolve(genModelURI.trimSegments(genModelURI.segmentCount() - 2).appendSegment("")).toString();
return result;
}
内容来源于网络,如有侵权,请联系作者删除!