/** 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$ }
/** * 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; }
@Override public void setOptions(CleanUpOptions options) { Assert.isLegal(options != null); fOptions = options; }
@Override public ImageRegistry getImageRegistry() { /* Just to be sure that we don't access this * plug-ins image registry. */ Assert.isLegal(false); return null; }
/** * Creates a new descriptor for <code>element</code>. * <p> * This method is for internal use only. * </p> * * @param element the extension point element to be described. */ public SpellingEngineDescriptor(IConfigurationElement element) { Assert.isLegal(element != null); fConfiguration= element; }
/** * Creates a new descriptor for <code>element</code>. * <p> * This method is for internal use only. * </p> * * @param element the extension point element to be described. */ public ReferenceProviderDescriptor(IConfigurationElement element) { Assert.isLegal(element != null); fConfiguration= element; }
/** * Creates a new event. * * @param information the revision info */ public RevisionEvent(RevisionInformation information) { Assert.isLegal(information != null); fInformation= information; }
/** * @param orientation the orientation, allowed values are: SWT#RIGHT_TO_LEFT or SWT#LEFT_TO_RIGHT */ public TemplateInformationControlCreator(int orientation) { Assert.isLegal(orientation == SWT.RIGHT_TO_LEFT || orientation == SWT.LEFT_TO_RIGHT); fOrientation= orientation; }
/** * Creates a new default spell checker. * * @param store the preference store for this spell checker * @param locale the locale */ public DefaultSpellChecker(IPreferenceStore store, Locale locale) { Assert.isLegal(store != null); Assert.isLegal(locale != null); fPreferences= store; fLocale= locale; }
/** * Creates a new change hover for the given document partitioning. * * @param partitioning the document partitioning * @param orientation the orientation, allowed values are: SWT#RIGHT_TO_LEFT or SWT#LEFT_TO_RIGHT */ public JavaChangeHover(String partitioning, int orientation) { Assert.isLegal(orientation == SWT.RIGHT_TO_LEFT || orientation == SWT.LEFT_TO_RIGHT); fPartitioning= partitioning; fOrientation= orientation; }
private AssistContext(ICompilationUnit cu, ISourceViewer sourceViewer, IEditorPart editor, int offset, int length, SharedASTProviderCore.WAIT_FLAG waitFlag) { super(sourceViewer, offset, length); Assert.isLegal(cu != null); Assert.isLegal(waitFlag != null); fCompilationUnit= cu; fEditor= editor; fWaitFlag= waitFlag; }
public Destination(Object destination, int location) { Assert.isNotNull(destination); Assert.isLegal(location == LOCATION_AFTER || location == LOCATION_BEFORE || location == LOCATION_ON); fDestination= destination; fLocation= location; }
public boolean matchesClass(Class clazz) { Assert.isLegal(clazz != null); do { if (clazz.getName().equals(fClassName)) return true; clazz= clazz.getSuperclass(); } while (clazz != null); return false; }
@Override public void setStatusMessage(String message) { Assert.isLegal(message != null); fMessage= message; if (fProposalPopup != null) fProposalPopup.setMessage(message); }
/** * Installs the receiver with a text viewer. * * @param viewer the viewer to install on */ public void install(ITextViewer viewer) { Assert.isLegal(viewer != null); fViewer= viewer; connect(); }
@Override public void setReferencedProjects(IProject[] value) { Assert.isLegal(value != null); staticRefs = copyAndRemoveDuplicates(value); clearCachedDynamicReferences(null); }
public final boolean isColumnVisible(RulerColumnDescriptor descriptor) { Assert.isLegal(descriptor != null); CompositeRuler ruler= getRuler(); return ruler != null && getVisibleColumn(ruler, descriptor) != null; }
@Override public void showHyperlinks(IHyperlink[] hyperlinks) { Assert.isLegal(hyperlinks != null && hyperlinks.length == 1); highlightRegion(hyperlinks[0].getHyperlinkRegion()); }
/** * Checks that the editor input has profile with the {@link ExcludeRulesProfileData}. If so, * sets the {@link #profile} and {@link #profileData}. */ private void checkAndGetEditorInput() { ProfileEditorInput input = (ProfileEditorInput) formPage.getEditor().getEditorInput(); Assert.isNotNull(input.getProfile()); Assert.isNotNull(input.getProfile().getProfileData()); Assert.isLegal(input.getProfile().getProfileData().isOfType(ExcludeRulesProfileData.class), "Given profile can not be opened with the exclude rules part."); profile = input.getProfile(); profileData = profile.getProfileData().getIfInstance(ExcludeRulesProfileData.class); }
/** * Checks that the editor input has profile with the {@link SensorAssignmentProfileData}. If so, * sets the {@link #profile} and {@link #profileData}. */ private void checkAndGetEditorInput() { ProfileEditorInput input = (ProfileEditorInput) formPage.getEditor().getEditorInput(); Assert.isNotNull(input.getProfile()); Assert.isNotNull(input.getProfile().getProfileData()); Assert.isLegal(input.getProfile().getProfileData().isOfType(SensorAssignmentProfileData.class), "Given profile can not be opened with the exclude rules part."); this.profile = input.getProfile(); this.profileData = profile.getProfileData().getIfInstance(SensorAssignmentProfileData.class); }