当前位置: 首页>>代码示例>>Java>>正文


Java Assert类代码示例

本文整理汇总了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;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:23,代码来源:ImageSaveUtil.java

示例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);
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:ImageSaveUtil.java

示例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();
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:22,代码来源:AddSearchEntryDialog.java

示例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 );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:31,代码来源:ComboBoxMeasureFieldEditor.java

示例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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:22,代码来源:GridProvider.java

示例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);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:11,代码来源:TextWithDialogCellEditor.java

示例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();
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:10,代码来源:CompareDialog.java

示例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( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:13,代码来源:ParameterComboCellEditor.java

示例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( ) );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:8,代码来源:TestingMatrixUI.java

示例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$
}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:Utility.java

示例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( ) );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:23,代码来源:CTextCellEditor.java

示例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 );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:16,代码来源:AbstractGlobalSelectionAction.java

示例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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:PaletteCategory.java

示例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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:9,代码来源:LayoutTable.java

示例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( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:11,代码来源:TableArea.java


注:本文中的org.eclipse.jface.util.Assert类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。