本文整理了Java中org.eclipse.jface.util.Assert.isTrue()
方法的一些代码示例,展示了Assert.isTrue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isTrue()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Assert
类名称:Assert
方法名:isTrue
[英]Asserts that the given boolean is true
. If this is not the case, some kind of unchecked exception is thrown.
[中]断言给定的布尔值为true
。如果不是这样,则会引发某种未经检查的异常。
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Sets the descriptors adornments. Valid values are:</code> WARNING <code>,</code> ERROR <code>,
* <code>PORTABLE</code>, or any combination of those.
*
* @param adornments the image descritpors adornments
*/
public void setAdornments(int adornments)
{
Assert.isTrue(adornments >= 0);
_fFlags = adornments;
}
代码示例来源:origin: org.eclipse/org.eclipse.compare
/**
* Called whenever a copy operation has been performed on a tree node.
* This implementation throws an <code>AssertionFailedException</code>
* since we cannot update a zip archive.
*
* @param structure the node for which to save the new content
* @param input the object from which the structure tree was created in <code>getStructure</code>
*/
public void save(IStructureComparator structure, Object input) {
Assert.isTrue(false); // Cannot update zip archive
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Asserts that the given boolean is <code>true</code>. If this
* is not the case, some kind of unchecked exception is thrown.
*
* @param expression the outcome of the check
* @return <code>true</code> if the check passes (does not return
* if the check fails)
*/
public static boolean isTrue(boolean expression) {
// succeed as quickly as possible
if (expression) {
return true;
}
return isTrue(expression, "");//$NON-NLS-1$
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Asserts that the given boolean is <code>true</code>. If this
* is not the case, some kind of unchecked exception is thrown.
*
* @param expression the outcome of the check
* @return <code>true</code> if the check passes (does not return
* if the check fails)
*/
public static boolean isTrue(boolean expression) {
// succeed as quickly as possible
if (expression) {
return true;
}
return isTrue(expression, "");//$NON-NLS-1$
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Asserts that the given boolean is <code>true</code>. If this
* is not the case, some kind of unchecked exception is thrown.
*
* @param expression the outcome of the check
* @return <code>true</code> if the check passes (does not return
* if the check fails)
*/
public static boolean isTrue(boolean expression) {
// succeed as quickly as possible
if (expression) {
return true;
}
return isTrue(expression, "");//$NON-NLS-1$
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui.properties
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
Assert.isTrue(inputElement instanceof ISelection);
return registry
.getTabDescriptors(currentPart, (ISelection) inputElement);
}
代码示例来源: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.wst.common.ui.properties
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (tabbedPropertyViewer == null) {
Assert.isTrue(viewer instanceof TabbedPropertyViewer);
init((TabbedPropertyViewer) viewer);
}
}
代码示例来源: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.wst.xsd.ui
/**
* The <code>ComboBoxCellEditor</code> implementation of this
* <code>CellEditor</code> framework method accepts a zero-based index of a
* selection.
*
* @param value
* the zero-based index of the selection wrapped as an
* <code>Integer</code>
*/
protected void doSetValue(Object value)
{
Assert.isTrue(comboBox != null && (value instanceof Integer));
selection = ((Integer) value).intValue();
comboBox.select(selection);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui
/**
* Sorts keys and values in parallel.
*
* @param keys
* the keys to use for sorting.
* @param values
* the values associated with the keys.
*/
public void sort(Object[] keys, Object[] values) {
if ((keys == null) || (values == null)) {
Assert.isTrue(false, "Either keys or values in null"); //$NON-NLS-1$
return;
}
if (keys.length <= 1)
return;
internalSort(keys, values, 0, keys.length - 1);
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.common.ui
private Point computeTableSize(Table table)
{
Point result = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = 0;
int size = _columns.size();
for (int i = 0; i < size; ++i)
{
ColumnLayoutData layoutData = (ColumnLayoutData) _columns.get(i);
if (layoutData instanceof ColumnPixelData)
{
ColumnPixelData col = (ColumnPixelData) layoutData;
width += col.width;
}
else if (layoutData instanceof ColumnWeightData)
{
ColumnWeightData col = (ColumnWeightData) layoutData;
width += col.minimumWidth;
}
else
{
Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
}
}
if (width > result.x)
result.x = width;
return result;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui.properties
/**
* We do not consider multiple selections. Only the first
* element will represent the selection.
*/
protected void setSelectionToWidget(List l, boolean reveal) {
if (l == null || l.size() == 0) { // clear selection
list.deselectAll();
} else {
Object object = l.get(0);
int index = -1;
for (int i = 0; i < elements.size(); i++) {
if (elements.get(i) == object) {
index = i;
}
}
Assert.isTrue(index != -1, "Could not set the selected tab in the tabbed property viewer");//$NON-NLS-1$
list.select(index, reveal);
}
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor
/**
* Creates a new SQLImageDescriptor.
*
* @param baseImage an image descriptor used as the base image
* @param flags flags indicating which adornments are to be rendered. See <code>setAdornments</code> for valid
* values.
* @param size the size of the resulting image
* @see #setAdornments(int)
*/
public SQLImageDescriptor(ImageDescriptor baseImage, int flags, Point size)
{
_fBaseImage = baseImage;
Assert.isNotNull(_fBaseImage);
_fFlags = flags;
Assert.isTrue(_fFlags >= 0);
_fSize = size;
Assert.isNotNull(_fSize);
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.common.ui
public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent)
{
init(name, labelText);
Assert.isTrue(checkArray(entryNamesAndValues));
_fEntryNamesAndValues = entryNamesAndValues;
createControl(parent);
}
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.common.ui
Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
代码示例来源:origin: org.eclipse/org.eclipse.compare
if (left == null) {
if (right == null) {
Assert.isTrue(false);
if (left == null) {
if (right == null) {
Assert.isTrue(false);
代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.editor.core
/**
* Constructs an AbstractControlConnection.
*
* @param manager
* {@link EditorCorePlugin#getControlConnectionManager()}
* @param databaseIdentifier
* contains connection profile info and database name
*/
public AbstractControlConnection(IControlConnectionManager manager,
DatabaseIdentifier databaseIdentifier) {
Assert.isTrue(manager instanceof ControlConnectionManager);
this._manager = (ControlConnectionManager) manager;
this._databaseIdentifier = databaseIdentifier;
try {
IConnectionProfile profile = ProfileUtil
.getProfile(databaseIdentifier.getProfileName());
IManagedConnection managedConn = profile
.getManagedConnection("java.sql.Connection");
_managedConnectionListener = new SQLToolsManagedConnectionListener();
managedConn.addConnectionListener(_managedConnectionListener);
} catch (Exception e) {
EditorCorePlugin.getDefault().log(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!