Java Code Examples for org.eclipse.swt.custom.CCombo#setFocus()

The following examples show how to use org.eclipse.swt.custom.CCombo#setFocus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createMultiValueExpressionButton( Composite parent,
		final CCombo combo )
{
	Listener listener = new Listener( ) {

		public void handleEvent( Event event )
		{
			addBtn.setEnabled( false );

			boolean change = false;

			Expression expression = ExpressionButtonUtil.getExpression( combo );
			if ( expression == null
					|| expression.getStringExpression( ).trim( ).length( ) == 0 )
				return;
			if ( valueList.indexOf( expression ) < 0 )
			{
				valueList.add( expression );
				change = true;
			}

			if ( change )
			{
				tableViewer.refresh( );
				updateButtons( );
				combo.setFocus( );
				combo.setText( "" );
			}
		}
	};

	ExpressionButtonUtil.createExpressionButton( parent,
			combo,
			getCrosstabExpressionProvider( ),
			designHandle,
			listener );

}
 
Example 2
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void selectMultiValues( CCombo CCombo )
{
	String[] retValue = null;

	List selectValueList = getSelectedValueList( );
	if ( selectValueList == null || selectValueList.size( ) == 0 )
	{
		MessageDialog.openInformation( null,
				Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
				Messages.getString( "SelectValueDialog.messages.info.selectVauleUnavailable" ) ); //$NON-NLS-1$

	}
	else
	{
		SelectValueDialog dialog = new SelectValueDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "ExpressionValueCellEditor.title" ) ); //$NON-NLS-1$
		dialog.setSelectedValueList( selectValueList );
		dialog.setMultipleSelection( true );
		if ( dialog.open( ) == IDialogConstants.OK_ID )
		{
			retValue = dialog.getSelectedExprValues( );
		}
	}

	if ( retValue != null )
	{
		addBtn.setEnabled( false );

		if ( retValue.length == 1 )
		{
			CCombo.setText( DEUtil.resolveNull( retValue[0] ) );
		}
		else if ( retValue.length > 1 )
		{
			CCombo.setText( "" ); //$NON-NLS-1$
		}

		boolean change = false;
		List strValues = new ArrayList( );
		for ( int i = 0; i < valueList.size( ); i++ )
		{
			strValues.add( ( (Expression) valueList.get( i ) ).getStringExpression( ) );
		}
		for ( int i = 0; i < retValue.length; i++ )
		{
			if ( strValues.indexOf( DEUtil.resolveNull( retValue[i] ) ) < 0 )
			{
				valueList.add( new Expression( DEUtil.resolveNull( retValue[i] ),
						ExpressionButtonUtil.getExpressionButton( CCombo )
								.getExpressionHelper( )
								.getExpressionType( ) ) );
				change = true;
			}
		}
		if ( change )
		{
			tableViewer.refresh( );
			updateButtons( );
			CCombo.setFocus( );
		}
	}
}
 
Example 3
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void selectMultiValues( CCombo CCombo )
{
	String[] retValue = null;

	List selectValueList = getSelectedValueList( );
	if ( selectValueList == null || selectValueList.size( ) == 0 )
	{
		MessageDialog.openInformation( null,
				Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
				Messages.getString( "SelectValueDialog.messages.info.selectVauleUnavailable" ) ); //$NON-NLS-1$

	}
	else
	{
		SelectValueDialog dialog = new SelectValueDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "ExpressionValueCellEditor.title" ) ); //$NON-NLS-1$
		dialog.setSelectedValueList( selectValueList );
		dialog.setMultipleSelection( true );
		if ( dialog.open( ) == IDialogConstants.OK_ID )
		{
			retValue = dialog.getSelectedExprValues( );
		}
	}

	if ( retValue != null )
	{
		addBtn.setEnabled( false );

		if ( retValue.length == 1 )
		{
			CCombo.setText( DEUtil.resolveNull( retValue[0] ) );
		}
		else if ( retValue.length > 1 )
		{
			CCombo.setText( "" ); //$NON-NLS-1$
		}

		boolean change = false;
		List strValues = new ArrayList( );
		for ( int i = 0; i < valueList.size( ); i++ )
		{
			strValues.add( ( (Expression) valueList.get( i ) ).getStringExpression( ) );
		}
		for ( int i = 0; i < retValue.length; i++ )
		{
			if ( strValues.indexOf( DEUtil.resolveNull( retValue[i] ) ) < 0 )
			{
				valueList.add( new Expression( DEUtil.resolveNull( retValue[i] ),
						ExpressionButtonUtil.getExpressionButton( CCombo )
								.getExpressionHelper( )
								.getExpressionType( ) ) );
				change = true;
			}
		}
		if ( change )
		{
			tableViewer.refresh( );
			updateButtons( );
			CCombo.setFocus( );
		}
	}
}