private void assertInitialized() { //avoid the Policy.bind if assertion is true if (!initialized) Assert.isTrue(false, Messages.meta_appNotInit); }
public Plugin(IPluginDescriptor descriptor) { Assert.isNotNull(descriptor); Assert.isTrue(!CompatibilityHelper.hasPluginObject(descriptor), NLS.bind(Messages.plugin_deactivatedLoad, this.getClass().getName(), descriptor.getUniqueIdentifier() + " is not activated")); //$NON-NLS-1$ this.descriptor = descriptor;
/** * Sets the granularity to use during the searches. * <p> * This method must be called before start searching. The default is a granularity of {@link #GRANULARITY_SEARCH_MATCH}. * * @param granularity The granularity to use. Must be one of the <code>GRANULARITY_XXX</code> constants. */ public final void setGranularity(final int granularity) { Assert.isTrue(granularity == GRANULARITY_COMPILATION_UNIT || granularity == GRANULARITY_SEARCH_MATCH); fGranularity= granularity; }
public static void assertVisibility(int visibility){ Assert.isTrue( visibility == Modifier.PUBLIC || visibility == Modifier.PROTECTED || visibility == Modifier.NONE || visibility == Modifier.PRIVATE); }
public Cache(int initialCapacity, int maximumCapacity, double threshold) { Assert.isTrue(maximumCapacity >= initialCapacity, "maximum capacity < initial capacity"); //$NON-NLS-1$ Assert.isTrue(threshold >= 0 && threshold <= 1, "threshold should be between 0 and 1"); //$NON-NLS-1$ Assert.isTrue(initialCapacity > 0, "initial capacity must be greater than zero"); //$NON-NLS-1$ entries = new KeyedHashSet(initialCapacity); this.maximumCapacity = maximumCapacity; this.threshold = threshold; }
public CopyResourceChange(IResource res, IContainer dest, INewNameQuery newNameQuery) { Assert.isTrue(res instanceof IFile || res instanceof IFolder); Assert.isTrue(dest instanceof IProject || dest instanceof IFolder); fNewNameQuery= newNameQuery; fSource= res; fTarget= dest; // Copy resource change isn't undoable and isn't used // as a redo/undo change right now. setValidationMethod(SAVE_IF_DIRTY); }
public IPath setDevice(String value) { if (value != null) { Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) == (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$ } //return the receiver if the device is the same if (value == device || (value != null && value.equals(device))) return this; return new Path(value, segments, separators); }
protected ReplaceRewrite(ASTRewrite rewrite, ASTNode[] nodes) { Assert.isNotNull(rewrite); Assert.isNotNull(nodes); Assert.isTrue(nodes.length > 0); fRewrite= rewrite; fToReplace= nodes; fDescriptor= fToReplace[0].getLocationInParent(); if (nodes.length > 1) { Assert.isTrue(fDescriptor instanceof ChildListPropertyDescriptor); } }
public String suggestNewMethodName(String oldMethodName, String oldTypeName, String newTypeName) { Assert.isNotNull(oldMethodName); Assert.isNotNull(oldTypeName); Assert.isNotNull(newTypeName); Assert.isTrue(oldMethodName.length() > 0); Assert.isTrue(oldTypeName.length() > 0); Assert.isTrue(newTypeName.length() > 0); resetPrefixes(); return match(oldTypeName, newTypeName, oldMethodName); }
private IResource getCommonResourceParent() { Assert.isNotNull(fResources); Assert.isTrue(fResources.length > 0);//safe - checked before return fResources[0].getParent(); }
public GroupMemberFinder(InfixExpression groupRoot) { super(true); Assert.isTrue(isAssociativeInfix(groupRoot)); fGroupRoot = groupRoot; fGroupRoot.accept(this); }
private ChildListPropertyDescriptor getBodyDeclarationsProperty(ASTNode declaration) { if (declaration instanceof AnonymousClassDeclaration) { return AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY; } else if (declaration instanceof AbstractTypeDeclaration) { return ((AbstractTypeDeclaration) declaration).getBodyDeclarationsProperty(); } Assert.isTrue(false); return null; }
public ChangeMethodSignatureProposal(String label, ICompilationUnit targetCU, ASTNode invocationNode, IMethodBinding binding, ChangeDescription[] paramChanges, ChangeDescription[] exceptionChanges, int relevance) { super(label, CodeActionKind.QuickFix, targetCU, null, relevance); Assert.isTrue(binding != null && Bindings.isDeclarationBinding(binding)); fInvocationNode= invocationNode; fSenderBinding= binding; fParameterChanges= paramChanges; fExceptionChanges= exceptionChanges; }
public static TypeReference createQualifiedReference(IJavaElement enclosingElement, int accuracy, int start, int length, boolean insideDocComment, IResource resource, int simpleNameStart) { Assert.isTrue(start < simpleNameStart && simpleNameStart < start + length); return new TypeReference(enclosingElement, accuracy, start, length, insideDocComment, resource, simpleNameStart, null); }
public void disconnect(IDocument document) { Assert.isTrue(fRightDocument == document); --fOpenConnections; if (fOpenConnections == 0) uninstall(); }
private static InfixExpression findGroupRoot(InfixExpression node) { Assert.isTrue(isAssociativeInfix(node)); while (!isAGroupRoot(node)) { ASTNode parent = node.getParent(); Assert.isNotNull(parent); Assert.isTrue(isAssociativeInfix(parent)); Assert.isTrue(((InfixExpression) parent).getOperator() == node.getOperator()); node = (InfixExpression) parent; } return node; }
public DocEquivalenceComparator(DocumentEquivalenceClass equivalenceClass, ILineRange range) { fEquivalenceClass= equivalenceClass; if (range == null) { fLineOffset= 0; fLines= fEquivalenceClass.getCount(); } else { fLineOffset= range.getStartLine(); fLines= range.getNumberOfLines(); Assert.isTrue(fLineOffset >= 0); Assert.isTrue(fLineOffset + fLines <= fEquivalenceClass.getCount()); } }
private boolean isMemberReferenceValidInClassInitialization(Name name) { IBinding binding = name.resolveBinding(); Assert.isTrue(binding instanceof IVariableBinding || binding instanceof IMethodBinding); if (name instanceof SimpleName) { return Modifier.isStatic(binding.getModifiers()); } else { Assert.isTrue(name instanceof QualifiedName); return checkName(((QualifiedName) name).getQualifier()); } } }
@Override public void documentAboutToBeChanged(DocumentEvent e) { Assert.isTrue(e.getDocument() == fDocument); fPreviousDocumentLength= e.getDocument().getLength(); fStartOffset= -1; fEndOffset= -1; fDeleteOffset= -1; }