本文整理了Java中org.eclipse.emf.common.util.URI.encodeSegment()
方法的一些代码示例,展示了URI.encodeSegment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI.encodeSegment()
方法的具体详情如下:
包路径:org.eclipse.emf.common.util.URI
类名称:URI
方法名:encodeSegment
[英]Encodes a string so as to produce a valid segment, as defined by the RFC. All excluded characters, such as space and #
, are escaped, as are /
and ?
[中]对字符串进行编码,以生成RFC定义的有效段。所有被排除的字符(如空格和#
)都会被转义,而/
和?
也会被转义
代码示例来源:origin: org.jabylon/rest.ui
private String getURIPath(List<String> segments) {
StringBuilder builder = new StringBuilder();
for (String string : segments) {
builder.append(URI.encodeSegment(string, true));
builder.append("/");
}
if(builder.length()>0)
builder.setLength(builder.length()-1);
else
builder.append("workspace");
return builder.toString();
}
代码示例来源:origin: org.eclipse.xtext/ui
/**
* @return whether there's possibly an {@link IResourceServiceProvider} for the given storage
* @since 2.4
*/
public boolean isPossiblyManaged(IStorage storage) {
if (!registry.getContentTypeToFactoryMap().isEmpty())
return true;
String name = storage.getName();
if (name == null) {
return true;
}
name = URI.encodeSegment(name, true);
int index = name.lastIndexOf('.');
if (index == -1) {
return true;
}
return registry.getExtensionToFactoryMap().containsKey(name.substring(index + 1));
}
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.codegen.ecore
name = URI.encodeSegment(name, false);
return
count > 0 || name.contains(".") ?
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
result.append(source == null ? "%" : URI.encodeSegment(source, false));
result.append('%');
if (count > 0)
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
result.append(source == null ? "%" : URI.encodeSegment(source, false));
result.append('%');
if (count > 0)
代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml
@Override
public String eURIFragmentSegment(EStructuralFeature eStructuralFeature,
EObject eObject) {
if (eObject instanceof NamedElement) {
String name = ((NamedElement) eObject).getName();
if (!UML2Util.isEmpty(name)) {
int count = 0;
for (EObject otherEObject : eContents()) {
if (otherEObject == eObject) {
break;
} else if (otherEObject instanceof NamedElement) {
if (name
.equals(((NamedElement) otherEObject).getName())) {
count++;
}
}
}
name = URI.encodeSegment(name, true);
return count > 0
? name + '.' + count
: name;
}
}
return super.eURIFragmentSegment(eStructuralFeature, eObject);
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.common.types
/**
* And if we are in the indexing phase, we don't want to see the local resources.
*/
@Override
public IResourceDescriptions getResourceDescriptions(ResourceSet resourceSet) {
IResourceDescriptions result = super.getResourceDescriptions(resourceSet);
if (compilerPhases.isIndexing(resourceSet)) {
// during indexing we don't want to see any local files
String projectName = getProjectName(resourceSet);
if(projectName != null) {
final String encodedProjectName = URI.encodeSegment(projectName, true);
Predicate<URI> predicate = new Predicate<URI>() {
@Override
public boolean apply(URI uri) {
return isProjectLocal(uri, encodedProjectName);
}
};
if (result instanceof IShadowedResourceDescriptions) {
return new ShadowedFilteringResourceDescriptions(result, predicate);
} else {
return new FilteringResourceDescriptions(result, predicate);
}
}
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!