本文整理汇总了Java中org.eclipse.jface.util.Assert类的典型用法代码示例。如果您正苦于以下问题:Java Assert类的具体用法?Java Assert怎么用?Java Assert使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Assert类属于org.eclipse.jface.util包,在下文中一共展示了Assert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public static boolean save(IEditorPart editorPart, GraphicalViewer viewer,
String saveFilePath, int format) {
Assert.isNotNull(editorPart,
"null editorPart passed to ImageSaveUtil::save");
Assert.isNotNull(viewer, "null viewer passed to ImageSaveUtil::save");
Assert.isNotNull(saveFilePath,
"null saveFilePath passed to ImageSaveUtil::save");
if (format != SWT.IMAGE_BMP && format != SWT.IMAGE_JPEG
&& format != SWT.IMAGE_PNG && format != SWT.IMAGE_GIF)
throw new IllegalArgumentException("Save format not supported");
try {
saveEditorContentsAsImage(editorPart, viewer, saveFilePath, format);
} catch (Exception ex) {
MessageDialog.openError(editorPart.getEditorSite().getShell(),
"Save Error", "Could not save editor contents");
return false;
}
return true;
}
示例2: save
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public static boolean save(IEditorPart editorPart, GraphicalViewer viewer) {
Assert.isNotNull(editorPart, "null editorPart passed to ImageSaveUtil::save");
Assert.isNotNull(viewer, "null viewer passed to ImageSaveUtil::save");
String saveFilePath = getSaveFilePath(editorPart, viewer, -1);
if (saveFilePath == null)
return false;
int format = SWT.IMAGE_JPEG;
if (saveFilePath.endsWith(".jpeg"))
format = SWT.IMAGE_JPEG;
else if (saveFilePath.endsWith(".bmp"))
format = SWT.IMAGE_BMP;
// else if (saveFilePath.endsWith(".ico"))
// format = SWT.IMAGE_ICO;
return save(editorPart, viewer, saveFilePath, format);
}
示例3: okPressed
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@SuppressWarnings("deprecation")
@Override
protected void okPressed() {
if (validateValue()) {
this.searEntry.setSearchName(nameText.getText());
if (style == ADD) {
this.searEntry.setDefault(false);
}
this.searEntry.setSearchUrl(urlText.getText());
this.searEntry.setChecked(btnYesRadioButton.getSelection());
Assert.isNotNull(handler, "OKhandler can not be null");
if (!handler.doOk()) {
return;
}
}
super.okPressed();
}
示例4: ComboBoxMeasureFieldEditor
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
* Constructs new instance width value choice and measure choice field
* editor. Put the editor working in Combo Mode.
*
* @param prop_name
* preference name of the field editor
* @param labelText
* label text of the preference
* @param entryNamesAndValues
* names and values list for entry Combo
* @param measureNamesAndValues
* names and values list for measure Combo
* @param parent
* parent Composite of field editors
*/
public ComboBoxMeasureFieldEditor( String prop_name, String labelText,
String[][] entryNamesAndValues, String[][] measureNamesAndValues,
Composite parent )
{
hasChoice = true;
init( prop_name, labelText );
Assert.isTrue( checkArray( entryNamesAndValues ) );
Assert.isTrue( checkArray( measureNamesAndValues ) );
fBoxNamesAndValues = entryNamesAndValues;
fMeasureNamesAndValues = measureNamesAndValues;
this.parent = parent;
createControl( parent );
}
示例5: performInsert
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
protected boolean performInsert( Object model, SlotHandle slotHandle,
String type, String position, Map extendData ) throws Exception
{
Assert.isLegal( type.equals( ReportDesignConstants.ROW_ELEMENT ) );
GridHandleAdapter adapter = HandleAdapterFactory.getInstance( )
.getGridHandleAdapter( model );
if ( slotHandle.getCount( ) > 0 )
{
int rowNumber = HandleAdapterFactory.getInstance( )
.getRowHandleAdapter( slotHandle.get( slotHandle.getCount( ) - 1 ) )
.getRowNumber( );
adapter.insertRow( 1, rowNumber );
}
else
{
adapter.insertRowInSlotHandle( slotHandle.getSlotID( ) );
}
return true;
}
示例6: doSetValue
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
@Override
protected void doSetValue(Object value) {
if (value == null) {
value = ""; //$NON-NLS-1$
}
Assert.isTrue(text != null && (value instanceof String));
text.setText((String) value);
}
示例7: CompareDialog
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public CompareDialog(Shell shell, CompareEditorInput input) {
super(shell);
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
Assert.isNotNull(input);
compareEditorInput= input;
settings = SVNUIPlugin.getPlugin().getDialogSettings();
}
示例8: setItems
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
* 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( );
}
示例9: updateFigure
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public void updateFigure( ExtendedItemHandle handle, IFigure figure )
{
Assert.isNotNull( handle );
( (LabelFigure) figure ).setText( handle.getProperty( TEST_PROPERTY[0] )
+ ":"
+ handle.getProperty( TEST_PROPERTY[1] ).toString( ) );
}
示例10: getColumnExpression
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
* Create a row expression base on a binding column name.
*
* @param columnName
* the column name
* @return the expression, or null if the column name is blank.
*/
public static String getColumnExpression( String columnName )
{
Assert.isNotNull( columnName );
if ( StringUtil.isBlank( columnName ) )
{
return null;
}
return ExpressionUtil.createJSRowExpression( columnName );//$NON-NLS-1$ //$NON-NLS-2$
}
示例11: doSetValue
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
* The <code>TextCellEditor</code> implementation of this
* <code>CellEditor</code> framework method accepts a text string (type
* <code>String</code>).
*
* @param value
* a text string (type <code>String</code>)
*/
protected void doSetValue( Object value )
{
Assert.isTrue( text != null && (value == null || value instanceof String ) );
text.removeModifyListener( getModifyListener( ) );
if(value == null)
{
text.setText( "" );
}else
{
text.setText( (String) value );
}
text.addModifyListener( getModifyListener( ) );
}
示例12: AbstractGlobalSelectionAction
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
protected AbstractGlobalSelectionAction( ISelectionProvider provider, String id )
{
super( null );
Assert.isNotNull( provider );
setId( id );
setSelectionProvider( provider );
provider.addSelectionChangedListener( new ISelectionChangedListener( ) {
public void selectionChanged( SelectionChangedEvent event )
{
update( );
}
} );
setLazyEnablementCalculation( true );
}
示例13: PaletteCategory
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
/**
*
*
* @param name
* @param displayLabellabel
* @param icon
*/
public PaletteCategory( String name, String displayLabel,
ImageDescriptor icon )
{
super( displayLabel, icon );
Assert.isNotNull( name );
this.name = name;
}
示例14: ColumnsDescription
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public ColumnsDescription( ColumnLayoutData[] columns,
String[] headers, boolean drawLines )
{
Assert.isNotNull( columns );
this.columns = columns;
this.headers = headers;
this.drawLines = drawLines;
}
示例15: TableArea
import org.eclipse.jface.util.Assert; //导入依赖的package包/类
public TableArea( Composite parent, int tableStyle,
IBaseTableAreaModifier modifier )
{
super( parent, SWT.NONE );
Assert.isNotNull( modifier );
setLayout( UIUtil.createGridLayoutWithoutMargin( 2, false ) );
this.modifier = modifier;
createTableViewer( tableStyle );
createButtonBar( );
}