本文整理了Java中org.eclipse.jface.util.Assert.isNotNull()
方法的一些代码示例,展示了Assert.isNotNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isNotNull()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Assert
类名称:Assert
方法名:isNotNull
[英]Asserts that the given object is not null
. If this is not the case, some kind of unchecked exception is thrown.
As a general rule, parameters passed to API methods must not be null
unless explicitly allowed in the method's specification. Similarly, results returned from API methods are never null
unless explicitly allowed in the method's specification. Implementations are encouraged to make regular use of Assert.isNotNull
to ensure that null
parameters are detected as early as possible.
[中]断言给定对象不是null
。如果不是这样,则会引发某种未经检查的异常。
作为一般规则,传递给API方法的参数不得为null
,除非方法规范中明确允许。类似地,从API方法返回的结果永远不会是null
,除非方法规范中明确允许。鼓励实施定期使用Assert.isNotNull
,以确保尽早检测null
参数。
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Sets the status to INFO.
* @param infoMessage the info message (can be empty, but not null)
*/
public void setInfo(String infoMessage)
{
Assert.isNotNull(infoMessage);
fStatusMessage= infoMessage;
fSeverity= IStatus.INFO;
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Sets the status to WARNING.
* @param warningMessage the warning message (can be empty, but not null)
*/
public void setWarning(String warningMessage)
{
Assert.isNotNull(warningMessage);
fStatusMessage= warningMessage;
fSeverity= IStatus.WARNING;
}
代码示例来源:origin: org.apache.uima/uimaj-ep-configurator
/**
* Constructor for NonRuleBasedDamagerRepairer.
*
* @param defaultTextAttribute the default text attribute
*/
public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
Assert.isNotNull(defaultTextAttribute);
fDefaultTextAttribute = defaultTextAttribute;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
public XSDSearchActionGroup(IEditorPart editor)
{
Assert.isNotNull(editor);
// fEditor = editor;
// fReferencesGroup = new ReferencesSearchGroup(editor);
// fDeclarationsGroup = new DeclarationsSearchGroup();
// fImplementorsGroup = new ImplementorsSearchGroup();
// fOccurrencesGroup = new OccurrencesSearchGroup();
}
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Sets the status to ERROR.
* @param errorMessage the error message (can be empty, but not null)
*/
public void setError(String errorMessage)
{
Assert.isNotNull(errorMessage);
fStatusMessage= errorMessage;
fSeverity= IStatus.ERROR;
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Creates a new action with no text and no image.
* <p>
* Configure the action later using the set methods.
* </p>
*
* @param site the site this action is working on
*/
protected SelectionDispatchAction(IWorkbenchSite site)
{
Assert.isNotNull(site);
_fSite = site;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
protected SelectionDispatchAction(ISelection selection) {
Assert.isNotNull(selection);
this.selection = selection;
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
/**
* Create a AJdocWriter on the given output stream.
* It is the client's responsibility to close the output stream.
* @param basePath The base path to which all path will be made relative (if
* possible). If <code>null</code>, paths are not made relative.
*/
public AJdocWriter(OutputStream outputStream, IPath basePath, IJavaProject[] projects) {
Assert.isNotNull(outputStream);
fOutputStream= new BufferedOutputStream(outputStream);
fBasePath= basePath;
fJavaProjects= projects;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
protected static void initAction(SelectionDispatchAction action,
ISelection selection) {
Assert.isNotNull(selection);
Assert.isNotNull(action);
action.update(selection);
//provider.addSelectionChangedListener(action);
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
/**
* Creates a new text input page.
* @param isLastUserPage <code>true</code> if this page is the wizard's last
* user input page. Otherwise <code>false</code>
* @param initialValue the initial value
*/
public RenameInputWizardPage(String description, boolean isLastUserPage, String initialValue) {
super("RenameInputWizardPage");
Assert.isNotNull(initialValue);
setDescription(description);
fInitialValue= initialValue;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
protected void setGroups(ActionGroup[] groups) {
Assert.isTrue(fGroups == null);
Assert.isNotNull(groups);
fGroups= groups;
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Sets the size of the image created by calling <code>createImage()</code>.
*
* @param size the size of the image returned from calling <code>createImage()</code>
* @see ImageDescriptor#createImage()
*/
public void setImageSize(Point size)
{
Assert.isNotNull(size);
Assert.isTrue(size.x >= 0 && size.y >= 0);
_fSize = size;
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
/**
* Creates a new image descriptor registry for the given display. All images
* managed by this registry will be disposed when the display gets disposed.
*
* @param display the display the images managed by this registry are allocated for
*/
public ImageDescriptorRegistry(Display display) {
fDisplay= display;
Assert.isNotNull(fDisplay);
hookDisplay();
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
/**
* Sets the list of choices for the combo box
*
* @param items
* the list of choices for the combo box
*/
public void setItems(String[] items)
{
Assert.isNotNull(items);
this.items = items;
populateComboBoxItems();
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sql
/**
*
* @param viewer where the node is displayed
* @see getGreatestEndOffset
*/
public int getEndOffset(IDocument document)
{
Assert.isNotNull(document);
int offset = 0;
if (_lastToken != null)
{
offset = _lastToken.getEndOffset(document);
}
return offset;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
/**
* Note: This constructor is for internal use only. Clients should not call this constructor.
* @param editor
*/
public ReferencesSearchGroup(IEditorPart editor) {
Assert.isNotNull(editor);
fEditor= editor;
fSite= fEditor.getSite();
initialize();
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
public void fillActionBars(IActionBars actionBars) {
Assert.isNotNull(actionBars);
super.fillActionBars(actionBars);
fActionBars= actionBars;
updateGlobalActionHandlers();
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui.properties
/**
* @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabSelectionListener#tabSelected(org.eclipse.wst.common.ui.properties.internal.provisional.internal.view.TabDescriptor)
*/
public void tabSelected(TabDescriptor tabDescriptor) {
IDynamicTabListSection section = getDynamicTabListSection();
Assert.isNotNull(section);
int selectedIndex = tabbedPropertyViewer.getSelectionIndex();
section.selectTab(selectedIndex);
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
/**
* Creates a new image descriptor registry for the current or default display,
* respectively.
*/
public ImageDescriptorRegistry() {
fDisplay = Display.getCurrent();
if (fDisplay == null)
fDisplay= Display.getDefault();
Assert.isNotNull(fDisplay);
hookDisplay();
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sql
public int getStartOffset(IDocument document)
{
Assert.isNotNull(document);
int offset = 0;
try
{
offset = document.getLineOffset(this.beginLine - 1) + this.beginColumn - 1;
}
catch (BadLocationException e1)
{
SQLActivator.getDefault().log(Messages.SimpleNode_1, e1);
}
return offset;
}
内容来源于网络,如有侵权,请联系作者删除!