Java Code Examples for org.eclipse.swt.widgets.Combo#setVisibleItemCount()

The following examples show how to use org.eclipse.swt.widgets.Combo#setVisibleItemCount() . 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: RelationDialog.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void createParentMandatoryGroup(Group parent) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.marginHeight = 10;

	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	Group group = new Group(parent, SWT.NONE);
	group.setLayout(gridLayout);
	group.setLayoutData(gridData);
	group.setText(ResourceString.getResourceString("label.mandatory"));

	parentCardinalityCombo = new Combo(group, SWT.NONE);
	parentCardinalityCombo.setLayoutData(gridData);

	parentCardinalityCombo.setVisibleItemCount(5);

	parentCardinalityCombo.add("1");
	parentCardinalityCombo.add("0..1");
}
 
Example 2
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Combo newComboControl( Composite composite, Key key,
		String[] values, String[] valueLabels )
{
	ControlData data = new ControlData( key, values );

	Combo comboBox = new Combo( composite, SWT.READ_ONLY );
	comboBox.setVisibleItemCount( 30 );
	comboBox.setItems( valueLabels );
	comboBox.setData( data );
	comboBox.addSelectionListener( getSelectionListener( ) );
	comboBox.setFont( JFaceResources.getDialogFont( ) );

	String currValue = getValue( key );
	comboBox.select( data.getSelection( currValue ) );

	fComboBoxes.add( comboBox );

	return comboBox;
}
 
Example 3
Source File: DefaultParameterDialogControlTypeHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void createContent( Composite parent )
{
	controlTypeChooser = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
	controlTypeChooser.setVisibleItemCount( 30 );
	controlTypeChooser.addListener( SWT.Selection, new Listener( ) {

		public void handleEvent( Event e )
		{
			List<Listener> listeners = DefaultParameterDialogControlTypeHelper.this.listeners.get( SWT.Selection );
			if ( listeners == null )
				return;
			for ( int i = 0; i < listeners.size( ); i++ )
				listeners.get( i ).handleEvent( e );
		}
	} );
}
 
Example 4
Source File: RelationshipDialog.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void createChildMandatoryGroup(Group parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginHeight = 10;
    final GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(gridLayout);
    group.setLayoutData(gridData);
    group.setText(DisplayMessages.getMessage("label.mandatory"));
    childCardinalityCombo = new Combo(group, SWT.NONE);
    childCardinalityCombo.setLayoutData(gridData);
    childCardinalityCombo.setVisibleItemCount(5);
    childCardinalityCombo.add("1..n");
    childCardinalityCombo.add("0..n");
    childCardinalityCombo.add("1");
    childCardinalityCombo.add("0..1");
}
 
Example 5
Source File: RelationshipDialog.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void createParentMandatoryGroup(Group parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginHeight = 10;

    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(gridLayout);
    group.setLayoutData(gridData);
    group.setText(DisplayMessages.getMessage("label.mandatory"));

    parentCardinalityCombo = new Combo(group, SWT.NONE);
    parentCardinalityCombo.setLayoutData(gridData);
    parentCardinalityCombo.setVisibleItemCount(5);
    parentCardinalityCombo.add("1");
    parentCardinalityCombo.add("0..1");
}
 
Example 6
Source File: RelationDialog.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
private void createParentMandatoryGroup(final Group parent) {
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginHeight = 10;

    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(gridLayout);
    group.setLayoutData(gridData);
    group.setText(ResourceString.getResourceString("label.mandatory"));

    parentCardinalityCombo = new Combo(group, SWT.NONE);
    parentCardinalityCombo.setLayoutData(gridData);

    parentCardinalityCombo.setVisibleItemCount(5);

    parentCardinalityCombo.add(Relation.PARENT_CARDINALITY_1);

    if (!relation.getForeignKeyColumns().get(0).isPrimaryKey()) {
        parentCardinalityCombo.add(Relation.PARENT_CARDINALITY_0_OR_1);
    }
}
 
Example 7
Source File: SelectVariableDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea( Composite parent )
{
	Composite content = new Composite( parent, SWT.NONE );
	content.setLayoutData( GridDataFactory.swtDefaults( ).hint( 300,
			SWT.DEFAULT ).create( ) );
	content.setLayout( GridLayoutFactory.swtDefaults( )
			.numColumns( 2 )
			.margins( 15, 15 )
			.create( ) );
	new Label( content, SWT.NONE ).setText( Messages.getString("SelectVariableDialog.AvailableVariables") ); //$NON-NLS-1$
	variablesCombo = new Combo( content, SWT.READ_ONLY );
	variablesCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	variablesCombo.setVisibleItemCount( 30 );
	variablesCombo.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			validate( );
		}
	} );
	UIUtil.bindHelp( parent, IHelpContextIds.SELECT_VARIABLE_DIALOG_ID );
	return content;
}
 
Example 8
Source File: MySQLAdvancedComposite.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public static Combo createEngineCombo(Composite parent,
		AbstractDialog dialog) {
	Combo combo = CompositeFactory.createCombo(dialog, parent,
			"label.storage.engine", 1);
	combo.setVisibleItemCount(20);

	initEngineCombo(combo);

	return combo;
}
 
Example 9
Source File: AbstractExportDialog.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
protected void initCategoryCombo(final Combo categoryCombo) {
    categoryCombo.add(ResourceString.getResourceString("label.all"));

    for (final Category category : categoryList) {
        categoryCombo.add(category.getName());
    }

    categoryCombo.setVisibleItemCount(20);
}
 
Example 10
Source File: RnDialogs.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout());
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	cbStates = new Combo(ret, SWT.READ_ONLY);
	cbStates.setItems(RnStatus.getStatusTexts());
	cbStates.setVisibleItemCount(RnStatus.getStatusTexts().length);
	cbStates.select(rn.getStatus());
	cbStates.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.WRAP).setText(Messages.RnDialogs_warningDontChangeManually); //$NON-NLS-1$
	return ret;
}
 
Example 11
Source File: MySQLAdvancedComposite.java    From erflute with Apache License 2.0 5 votes vote down vote up
public static Combo createEngineCombo(Composite parent, AbstractDialog dialog) {
    final Combo combo = CompositeFactory.createCombo(dialog, parent, "label.storage.engine", 1);
    combo.setVisibleItemCount(20);

    initEngineCombo(combo);

    return combo;
}
 
Example 12
Source File: RelationshipByExistingColumnsDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void createReferredColumnSelector(Composite composite) {
    final Label label = new Label(composite, SWT.NONE);
    label.setText("Referred Column");
    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    referredColumnSelector = new Combo(composite, SWT.READ_ONLY);
    referredColumnSelector.setLayoutData(gridData);
    referredColumnSelector.setVisibleItemCount(20);
}
 
Example 13
Source File: DataSourceSelectionDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );
	new Label( composite, SWT.NONE ).setText( Messages.getString( "dataset.editor.label.selectDataSource" ) ); //$NON-NLS-1$
	combo = new Combo( composite, SWT.BORDER | SWT.READ_ONLY );
	combo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	combo.setVisibleItemCount( 30 );
	combo.setItems( dataSourceNames );

	UIUtil.bindHelp( parent,
			IHelpContextIds.ADD_DATA_SOURCE_SELECTION_DIALOG_ID );
	return composite;
}
 
Example 14
Source File: IntroduceIndirectionInputPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Combo createIntermediaryTypeCombo(Composite composite) {
	final Combo textCombo= new Combo(composite, SWT.SINGLE | SWT.BORDER);
	textCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	textCombo.setItems(fgIntermediaryTypes.toArray(new String[fgIntermediaryTypes.size()]));
	textCombo.setVisibleItemCount(INTERMEDIARY_TYPE_COUNT);

	JavaTypeCompletionProcessor processor= new JavaTypeCompletionProcessor(false, false, true);
	processor.setPackageFragment(getIntroduceIndirectionRefactoring().getInvocationPackage());
	ControlContentAssistHelper.createComboContentAssistant(textCombo, processor);
	TextFieldNavigationHandler.install(textCombo);
	return textCombo;
}
 
Example 15
Source File: MySQLAdvancedComposite.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static Combo createEngineCombo(final Composite parent, final AbstractDialog dialog) {
    final Combo combo = CompositeFactory.createCombo(dialog, parent, "label.storage.engine", 1);
    combo.setVisibleItemCount(20);

    initEngineCombo(combo);

    return combo;
}
 
Example 16
Source File: TimeOptionDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createRightComponent( Composite composite )
{
	Label formatLabel = new Label( composite, SWT.CENTER | SWT.SINGLE );
	formatLabel.setText( LABEL_FORMAT );
	formatLabel.setBounds( 0, 8, 60, 30 );

	combo = new Combo( composite, SWT.READ_ONLY | SWT.DROP_DOWN );
	List list = TimeFormat.getDefaultFormat( ).getSupportList( );
	String[] items = new String[list.size( )];
	list.toArray( items );
	combo.setBounds( 60, 2, 150, 30 );
	combo.setVisibleItemCount( 30 );
	combo.setItems( items );
	combo.select( 0 );

	Label zoneLabel = new Label( composite, SWT.CENTER );
	zoneLabel.setText( LABEL_TIMEZONE );
	zoneLabel.setBounds( 0, 108, 60, 30 );

	zoneCombo = new Combo( composite, SWT.READ_ONLY | SWT.SINGLE );
	zoneCombo.setVisibleItemCount( 30 );
	items = TimeZone.getAvailableIDs( );
	zoneCombo.setBounds( 60, 102, 150, 30 );
	zoneCombo.setItems( items );
	zoneCombo.select( 0 );

}
 
Example 17
Source File: ComboBoxSelectionDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	getShell( ).setText( fShellTitle );

	Composite composite = (Composite) super.createDialogArea( parent );
	Composite innerComposite = new Composite( composite, SWT.NONE );
	innerComposite.setLayoutData( new GridData( ) );
	GridLayout gl = new GridLayout( );
	gl.numColumns = 2;
	innerComposite.setLayout( gl );

	Label label = new Label( innerComposite, SWT.NONE );
	label.setText( fLabelText );
	label.setLayoutData( new GridData( ) );

	final Combo combo = new Combo( innerComposite, SWT.READ_ONLY );
	for ( int i = 0; i < fAllowedStrings.length; i++ )
	{
		combo.add( fAllowedStrings[i] );
	}
	if ( fInitialSelectionIndex != -1 )
	{
		combo.select( fInitialSelectionIndex );
		fSelection = combo.getItem( combo.getSelectionIndex( ) );
	}
	GridData gd = new GridData( );
	gd.widthHint = convertWidthInCharsToPixels( getMaxStringLength( ) );
	combo.setLayoutData( gd );
	combo.setVisibleItemCount( 30 );
	combo.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			fSelection = combo.getItem( combo.getSelectionIndex( ) );
		}
	} );
	applyDialogFont( composite );
	return composite;
}
 
Example 18
Source File: GroupDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the group area
 * 
 * @param parent
 *            the parent composite
 */
private void createGroupArea( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	layoutData.verticalSpan = 2;
	composite.setLayoutData( layoutData );
	composite.setLayout( new GridLayout( ) );

	sortingGroup = new Group( composite, SWT.NONE );
	sortingGroup.setText( SORT_GROUP_TITLE );
	sortingGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	sortingGroup.setLayout( new FillLayout( SWT.VERTICAL ) );

	Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE );
	sortingGroupComposite.setLayout( new GridLayout( ) );

	ascending = new Button( sortingGroupComposite, SWT.RADIO );
	// ascending.setText( sortByAscending.getDisplayName( ) );
	ascending.setText( Messages.getString( "GroupDialog.Button.Ascending" ) ); //$NON-NLS-1$
	descending = new Button( sortingGroupComposite, SWT.RADIO );
	// descending.setText( sortByDescending.getDisplayName( ) );
	descending.setText( Messages.getString( "GroupDialog.Button.Descending" ) ); //$NON-NLS-1$

	Group pagebreakGroup = new Group( composite, SWT.NONE );

	pagebreakGroup.setText( Messages.getString( "GroupDialog.PageBreak" ) ); //$NON-NLS-1$
	pagebreakGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	pagebreakGroup.setLayout( layout );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakBefore" ) ); //$NON-NLS-1$
	pagebreakBeforeCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakBeforeChoicesAll.length; i++ )
	{
		pagebreakBeforeCombo.add( pagebreakBeforeChoicesAll[i].getDisplayName( ) );
	}
	pagebreakBeforeCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	pagebreakBeforeCombo.setVisibleItemCount( 30 );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );
	pagebreakBeforeCombo.setData( pagebreakBeforeChoicesAll );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakAfter" ) ); //$NON-NLS-1$
	pagebreakAfterCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakAfterChoicesAll.length; i++ )
	{
		pagebreakAfterCombo.add( pagebreakAfterChoicesAll[i].getDisplayName( ) );
	}
	pagebreakAfterCombo.setVisibleItemCount( 30 );
	pagebreakAfterCombo.setData( pagebreakAfterChoicesAll );
	pagebreakAfterCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakInside" ) ); //$NON-NLS-1$
	pagebreakInsideCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakInsideChoicesAll.length; i++ )
	{
		pagebreakInsideCombo.add( pagebreakInsideChoicesAll[i].getDisplayName( ) );
	}
	pagebreakInsideCombo.setVisibleItemCount( 30 );
	pagebreakInsideCombo.setData( pagebreakInsideChoicesAll );
	pagebreakInsideCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	repeatHeaderButton = new Button( pagebreakGroup, SWT.CHECK );
	repeatHeaderButton.setText( Messages.getString( "GroupDialog.RepeatHeader" ) ); //$NON-NLS-1$
	GridData data = new GridData( );
	data.horizontalSpan = 3;
	repeatHeaderButton.setLayoutData( data );

	PropertyHandle propertyHandle = inputGroup.getPropertyHandle( TableHandle.SORT_PROP );
	if ( propertyHandle.iterator( ).hasNext( ) )
	{
		ascending.setEnabled( false );
		descending.setEnabled( false );
	}
}
 
Example 19
Source File: SWTUtil.java    From Pydev with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Sets the default visible item count for {@link Combo}s.
 * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=7845 .
 *
 * @param combo the combo
 *
 * @see Combo#setVisibleItemCount(int)
 * @see #COMBO_VISIBLE_ITEM_COUNT
 *
 * @since 3.5
 */
public static void setDefaultVisibleItemCount(Combo combo) {
    combo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT);
}
 
Example 20
Source File: SWTUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Sets the default visible item count for {@link Combo}s.
 * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=7845 .
 *
 * @param combo the combo
 *
 * @see Combo#setVisibleItemCount(int)
 * @see #COMBO_VISIBLE_ITEM_COUNT
 *
 * @since 3.5
 */
public static void setDefaultVisibleItemCount(Combo combo) {
	combo.setVisibleItemCount(COMBO_VISIBLE_ITEM_COUNT);
}