protected String _toString(Object element) { return notNull(element); }
protected String _toString(Exception exc) { return notNull(exc.getMessage()); }
protected String canonicalName(JvmIdentifiableElement element) { return (element != null) ? notNull(element.getIdentifier()) : null; }
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; }
return result; } catch (Exception e) { LOG.error("Error detecting encoding for " + Strings.notNull(uri), e); return Charset.defaultCharset().name();
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()); } }
protected String _toString(EObject element) { return element.eClass().getName() + " '" + notNull(SimpleAttributeResolver.NAME_RESOLVER.apply(element)) + "' in " + _toString(element.eResource().getURI()); }
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());
public void add(int severity, String message, EObject element, ITextRegion region) { status.addEntry(new RefactoringStatusEntry(severity, notNull(message), createContext(element, region))); }
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); }
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())); }
buf.append("'").append(Strings.notNull(obj)).append("'"); return;
buf.append("'").append(Strings.notNull(obj)).append("'"); return;
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); } }
Messages.BuildScheduler_BuildOf + Strings.notNull(project.getName()) + Messages.BuildScheduler_FailedEtc, x));
@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); } }
@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; }
+ notNull(renameElementContext.getTargetElementURI())); String newName = renameStrategy.getOriginalName(); Iterable<URI> dependentElementURIs = dependentElementsCalculator.getDependentElementURIs(targetElement,
@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); } }