/** * Only constructor which needs an input definition. * * @param inputDefinition * The input definition. */ public RootEditorInput(InputDefinition inputDefinition) { Assert.isNotNull(inputDefinition); this.inputDefinition = inputDefinition; }
private void assertInitialized() { //avoid the Policy.bind if assertion is true if (!initialized) Assert.isTrue(false, Messages.meta_appNotInit); }
/** Asserts that an argument is legal. If the given boolean is * not <code>true</code>, an <code>IllegalArgumentException</code> * is thrown. * * @param expression the outcome of the check * @return <code>true</code> if the check passes (does not return * if the check fails) * @exception IllegalArgumentException if the legality test failed */ public static boolean isLegal(boolean expression) { return isLegal(expression, ""); //$NON-NLS-1$ }
@Override public Control createControl(CompositeRuler parentRuler, Composite parentControl) { Assert.isTrue(fDelegate != null); ITextViewer viewer= parentRuler.getTextViewer(); Assert.isLegal(viewer instanceof ISourceViewer); fViewer= (ISourceViewer) viewer; initialize(); Control control= fDelegate.createControl(parentRuler, parentControl); return control; }
/** * {@inheritDoc} */ @Override public void setInputDefinition(InputDefinition inputDefinition) { Assert.isNotNull(inputDefinition); this.inputDefinition = inputDefinition; }
/** * 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; }
/** * Sets the severity. * * @param severity the severity; one of <code>OK</code>, <code>ERROR</code>, * <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code> */ protected void setSeverity(int severity) { Assert.isLegal(severity == OK || severity == ERROR || severity == WARNING || severity == INFO || severity == CANCEL); this.severity = severity; }
/** * {@inheritDoc} */ @Override public void setRootEditor(IRootEditor rootEditor) { Assert.isNotNull(rootEditor); this.rootEditor = rootEditor; }
public static void assertVisibility(int visibility){ Assert.isTrue( visibility == Modifier.PUBLIC || visibility == Modifier.PROTECTED || visibility == Modifier.NONE || visibility == Modifier.PRIVATE); }
@Override public void setOptions(CleanUpOptions options) { Assert.isLegal(options != null); fOptions = options; }
/** * Creates a new processor on the given document and using the given tab width. * * @param document the document * @param tabWidth the tabulator width in space equivalents, must be <code>>=0</code> */ public SelectionProcessor(IDocument document, int tabWidth) { Assert.isNotNull(document); Assert.isTrue(tabWidth >= 0); fDocument= document; fTabWidth= tabWidth; }
/** * @return the rootEditor */ protected IRootEditor getRootEditor() { Assert.isNotNull(rootEditor); return rootEditor; }
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); }
@Override public ImageRegistry getImageRegistry() { /* Just to be sure that we don't access this * plug-ins image registry. */ Assert.isLegal(false); return null; }
/** * Set the owning refactoring. * * @param refactoring the refactoring * * @since 3.1 */ /* package */ void setRefactoring(ProcessorBasedRefactoring refactoring) { Assert.isTrue(fRefactoring == null, "The refactoring can only be set once"); //$NON-NLS-1$ Assert.isNotNull(refactoring); fRefactoring= refactoring; }