/** * 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; }
/** * 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 }
/** * 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$ }
/** * 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$ }
/** * 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$ }
/** * @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); }
/** * 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; }
/** * @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); } }
protected void setGroups(ActionGroup[] groups) { Assert.isTrue(fGroups == null); Assert.isNotNull(groups); fGroups= groups; }
/** * 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); }
/** * 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); }
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; }
/** * 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); } }
/** * 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); }
public ComboFieldEditor(String name, String labelText, String[][] entryNamesAndValues, Composite parent) { init(name, labelText); Assert.isTrue(checkArray(entryNamesAndValues)); _fEntryNamesAndValues = entryNamesAndValues; createControl(parent); }
Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
/** * 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); } }