本文整理了Java中org.eclipse.xtext.util.Strings.notNull()
方法的一些代码示例,展示了Strings.notNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.notNull()
方法的具体详情如下:
包路径:org.eclipse.xtext.util.Strings
类名称:Strings
方法名:notNull
暂无
代码示例来源:origin: org.eclipse.xtext/ui
protected String _toString(Object element) {
return notNull(element);
}
代码示例来源:origin: org.eclipse.xtext/ui
protected String _toString(Exception exc) {
return notNull(exc.getMessage());
}
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
protected String canonicalName(JvmIdentifiableElement element) {
return (element != null) ? notNull(element.getIdentifier()) : null;
}
代码示例来源:origin: org.eclipse.xtext/ui
protected Map<EObject, URI> resolveRenamedElements(Iterable<URI> renamedElementURIs, ResourceSet resourceSet) {
Map<EObject, URI> renamedElement2oldURI = newHashMap();
for (URI renamedElementURI : renamedElementURIs) {
EObject renamedElement = resourceSet.getEObject(renamedElementURI, true);
if (renamedElement == null)
throw new RefactoringException("Cannot resolve dependent element " + notNull(renamedElementURI));
renamedElement2oldURI.put(renamedElement, renamedElementURI);
}
return renamedElement2oldURI;
}
代码示例来源:origin: org.eclipse/xtext
return result;
} catch (Exception e) {
LOG.error("Error detecting encoding for " + Strings.notNull(uri), e);
return Charset.defaultCharset().name();
代码示例来源:origin: org.eclipse.xtext/builder
protected void createFolder(IContainer parent) throws CoreException {
if(!parent.exists()) {
if(!(parent instanceof IFolder))
throw new RuntimeException("IContainer " + notNull(parent) + " does not exist");
createFolder(parent.getParent());
((IFolder)parent).create(true, false, new NullProgressMonitor());
}
}
代码示例来源:origin: org.eclipse.xtext/ui
protected String _toString(EObject element) {
return element.eClass().getName() + " '" + notNull(SimpleAttributeResolver.NAME_RESOLVER.apply(element)) + "' in " + _toString(element.eResource().getURI());
}
代码示例来源:origin: org.eclipse.xtext/ui
public LinkedPosition apply(ReplaceEdit edit) {
try {
String textToReplace = document.get(edit.getOffset(), edit.getLength());
int indexOf = textToReplace.indexOf(originalName);
if (indexOf != -1) {
int calculatedOffset = edit.getOffset() + indexOf;
return new LinkedPosition(document, calculatedOffset, originalName.length());
}
} catch (BadLocationException exc) {
LOG.error("Skipping invalid text edit " + notNull(edit), exc);
}
return null;
}
}), Predicates.notNull());
代码示例来源:origin: org.eclipse.xtext/ui
public void add(int severity, String message, EObject element, ITextRegion region) {
status.addEntry(new RefactoringStatusEntry(severity, notNull(message), createContext(element, region)));
}
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
protected void checkWildcardSupertype(XtendTypeDeclaration xtendType, JvmTypeReference superTypeReference,
EStructuralFeature feature, int index) {
if(isInvalidWildcard(superTypeReference))
error("The type "
+ notNull(xtendType.getName())
+ " cannot extend or implement "
+ superTypeReference.getIdentifier()
+ ". A supertype may not specify any wildcard", feature, index, WILDCARD_IN_SUPERTYPE);
}
代码示例来源:origin: org.eclipse/xtext
public int compare(MWEDiagnostic o1, MWEDiagnostic o2) {
Issue issue1 = (Issue) o1.getElement();
Issue issue2 = (Issue) o2.getElement();
int lineNumberCompare = nullSafeCompare(issue1.getLineNumber(), issue2.getLineNumber());
if (lineNumberCompare != 0) {
return lineNumberCompare;
}
int offsetCompare = nullSafeCompare(issue1.getOffset(), issue2.getOffset());
if (offsetCompare != 0) {
return offsetCompare;
}
return Strings.notNull(o1.getMessage()).compareTo(Strings.notNull(o2.getMessage()));
}
代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.util
buf.append("'").append(Strings.notNull(obj)).append("'");
return;
代码示例来源:origin: org.eclipse.xtext/util
buf.append("'").append(Strings.notNull(obj)).append("'");
return;
代码示例来源:origin: org.eclipse/xtext
public Object toValue(String string, INode node) throws ValueConverterException {
try {
Object value = dataType.getEPackage().getEFactoryInstance().createFromString(dataType, string);
if (value == null && dataType.getInstanceClass().isPrimitive()) {
throw new ValueConverterException("Couldn't convert '" + Strings.notNull(string) + "' to "
+ dataType.getName() + ".", node, null);
}
return value;
} catch (Exception exc) {
throw new ValueConverterException("Error converting string to value", node, exc);
}
}
代码示例来源:origin: org.eclipse.xtext/builder
Messages.BuildScheduler_BuildOf + Strings.notNull(project.getName())
+ Messages.BuildScheduler_FailedEtc, x));
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
@Check
public void checkSuperTypes(XtendInterface xtendInterface) {
for (int i = 0; i < xtendInterface.getExtends().size(); ++i) {
JvmTypeReference extendedType = xtendInterface.getExtends().get(i);
if (!isInterface(extendedType.getType()) && !isAnnotation(extendedType.getType())) {
error("Extended interface must be an interface", XTEND_INTERFACE__EXTENDS, i, INTERFACE_EXPECTED);
}
checkWildcardSupertype(xtendInterface, extendedType, XTEND_INTERFACE__EXTENDS, i);
}
JvmGenericType inferredType = associations.getInferredType(xtendInterface);
if(inferredType != null && hasCycleInHierarchy(inferredType, Sets.<JvmGenericType> newHashSet())) {
error("The inheritance hierarchy of " + notNull(xtendInterface.getName()) + " contains cycles",
XTEND_TYPE_DECLARATION__NAME, CYCLIC_INHERITANCE);
}
}
代码示例来源:origin: org.eclipse.xtext/ui
@Override
public RefactoringStatus validateNewName(String newName) {
RefactoringStatus status = super.validateNewName(newName);
if(nameRuleName != null && valueConverterService != null) {
try {
String value = getNameAsValue(newName);
String text = getNameAsText(value);
if(!equal(text, newName)) {
status.addError("Illegal name: '" + newName + "'. Consider using '" + text + "' instead.");
}
} catch(ValueConverterException vce) {
status.addFatalError("Illegal name: " + notNull(vce.getMessage()));
}
}
return status;
}
代码示例来源:origin: org.eclipse.xtext/ui
+ notNull(renameElementContext.getTargetElementURI()));
String newName = renameStrategy.getOriginalName();
Iterable<URI> dependentElementURIs = dependentElementsCalculator.getDependentElementURIs(targetElement,
代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core
@Check
public void checkSuperTypes(XtendClass xtendClass) {
JvmTypeReference superClass = xtendClass.getExtends();
if (superClass != null && superClass.getType() != null) {
if (!(superClass.getType() instanceof JvmGenericType)
|| ((JvmGenericType) superClass.getType()).isInterface()) {
error("Superclass must be a class", XTEND_CLASS__EXTENDS, CLASS_EXPECTED);
} else {
if (((JvmGenericType) superClass.getType()).isFinal()) {
error("Attempt to override final class", XTEND_CLASS__EXTENDS, OVERRIDDEN_FINAL);
}
checkWildcardSupertype(xtendClass, superClass, XTEND_CLASS__EXTENDS, INSIGNIFICANT_INDEX);
}
}
for (int i = 0; i < xtendClass.getImplements().size(); ++i) {
JvmTypeReference implementedType = xtendClass.getImplements().get(i);
if (!isInterface(implementedType.getType()) && !isAnnotation(implementedType.getType())) {
error("Implemented interface must be an interface", XTEND_CLASS__IMPLEMENTS, i, INTERFACE_EXPECTED);
}
checkWildcardSupertype(xtendClass, implementedType, XTEND_CLASS__IMPLEMENTS, i);
}
JvmGenericType inferredType = associations.getInferredType(xtendClass);
if (inferredType != null && hasCycleInHierarchy(inferredType, Sets.<JvmGenericType> newHashSet())) {
error("The inheritance hierarchy of " + notNull(xtendClass.getName()) + " contains cycles",
XTEND_TYPE_DECLARATION__NAME, CYCLIC_INHERITANCE);
}
}
内容来源于网络,如有侵权,请联系作者删除!