org.eclipse.swt.widgets.Combo#setItems ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Combo#setItems ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: birt   文件: CrosstabBindingDialogHelper.java
private void initCalculationDataFields( Combo cmbDataField, String name,
		List<Period_Type> list )
{
	String[] strs = new String[list.size( )];
	for ( int i = 0; i < list.size( ); i++ )
	{
		strs[i] = list.get( i ).displayName( );
	}
	cmbDataField.setItems( strs );
	if ( calculationParamsValueMap.containsKey( name ) )
	{
		cmbDataField.setText( calculationParamsValueMap.get( name ) );
		return;
	}
	cmbDataField.select( 0 );
}
 
源代码2 项目: sarl   文件: FixedFatJarExportPage.java
private void createLaunchConfigSelectionGroup(Composite parent) {
	fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo);
	fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations()));
	String[] names= new String[fLauchConfigurationModel.size()];
	for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) {
		LaunchConfigurationElement element= fLauchConfigurationModel.get(i);
		names[i]= element.getLaunchConfigurationName();
	}
	fLaunchConfigurationCombo.setItems(names);

	fLaunchConfigurationCombo.addListener(SWT.Selection, this);
	fLaunchConfigurationCombo.addListener(SWT.Modify, this);
}
 
源代码3 项目: birt   文件: OptionsConfigurationBlock.java
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;
}
 
源代码4 项目: xtext-eclipse   文件: OptionsConfigurationBlock.java
protected Combo newComboControl(Composite composite, String key, String[] values, String[] valueLabels) {
	ControlData data = new ControlData(key, values);

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

	makeScrollableCompositeAware(comboBox);

	updateCombo(comboBox);

	comboBoxes.add(comboBox);
	return comboBox;
}
 
源代码5 项目: birt   文件: TimeOptionDialog.java
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 );

}
 
源代码6 项目: birt   文件: HyperlinkBuilder.java
private void createTargetBar( )
{
	if ( bTargetEnabled )
	{
		new Label( displayArea, SWT.NONE ).setText( LABEL_TARGET );
		targetChooser = new Combo( displayArea, SWT.READ_ONLY | SWT.BORDER );
		targetChooser.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
		targetChooser.setVisibleItemCount( 30 );
		targetChooser.setItems( ChoiceSetFactory.getDisplayNamefromChoiceSet( CHOICESET_TARGET ) );
		UIUtil.createBlankLabel( displayArea );
	}
}
 
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(5, 5, 5, 5).applyTo(tparent);
	GridDataFactory.fillDefaults().hint(400, 170).grab(true, true).applyTo(tparent);

	if (addOrEditDialog == DIALOG_ADD) {
		new Label(tparent, SWT.None).setText(Messages.getString("dialog.AddOrUpdateNoteDialog.label"));
		cmbRange = new Combo(tparent, SWT.READ_ONLY);
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmbRange);
		cmbRange.setItems(new String[] { NatTableConstant.CURRENT_TEXT, NatTableConstant.ALL_TEXT });
		cmbRange.select(0);
	}

	Group noteGroup = new Group(tparent, SWT.None);
	noteGroup.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.noteGroup"));
	GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(noteGroup);
	// noteGroup.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
	noteGroup.setLayout(new GridLayout());
	txtNote = new Text(noteGroup, SWT.BORDER | SWT.WRAP | SWT.MULTI);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(txtNote);
	if (addOrEditDialog == DIALOG_EDIT) {
		txtNote.setText(noteItem[3]);
	}
	txtNote.forceFocus();
	return tparent;
}
 
public void createContents(int numColumns, Composite parent) {

            fPageBook= new PageBook(parent, SWT.NONE);
            fPageBook.setLayoutData(createGridData(numColumns, GridData.FILL_BOTH, SWT.DEFAULT));

            fJavaElementComponent.createContents(numColumns, fPageBook);
            fSyntaxComponent.createContents(numColumns, fPageBook);

            fSwitchCombo= new Combo(parent, SWT.READ_ONLY);
    		SWTUtil.setDefaultVisibleItemCount(fSwitchCombo);
            final GridData gd= createGridData(numColumns, GridData.HORIZONTAL_ALIGN_END, SWT.DEFAULT);
            fSwitchCombo.setLayoutData(gd);
            fSwitchCombo.setItems(fItems);
        }
 
源代码9 项目: birt   文件: DataDefinitionSelector.java
private void refreshSeriesCombo( Combo cmbSeriesSelect )
{
	ArrayList<String> itemList = new ArrayList<String>( );
	int seriesSize = seriesDefns.size( );
	for ( int i = 1; i <= seriesSize; i++ )
	{
		itemList.add( selectionName + " " + i ); //$NON-NLS-1$
	}
	if( !isPartChart( ) )
	{
		itemList.add( Messages.getString( "DataDefinitionSelector.Text.NewSeries" ) ); //$NON-NLS-1$
	}
	cmbSeriesSelect.removeAll( );
	cmbSeriesSelect.setItems( itemList.toArray( new String[seriesSize] ) );
}
 
源代码10 项目: nebula   文件: PShelfExampleTab.java
public void createParameters(Composite parent) {
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(parent);

	Listener listenerRecreates = event -> {
		if (event.widget instanceof Button) {
			Button b = (Button) event.widget;
			if ((b.getStyle() & SWT.RADIO) != 0) {
				if (!b.getSelection())
					return;
			}
		}
		recreateExample();
	};

	Group styles = new Group(parent, SWT.NONE);
	styles.setText("Styles");
	GridLayoutFactory.swtDefaults().applyTo(styles);
	GridDataFactory.fillDefaults().applyTo(styles);

	border = ButtonFactory.create(styles, SWT.CHECK, "SWT.BORDER", listenerRecreates, false);
	simple = ButtonFactory.create(styles, SWT.CHECK, "SWT.SIMPLE", listenerRecreates, false);

	Group parms = new Group(parent, SWT.NONE);
	parms.setText("Other");
	GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(parms);

	new Label(parms, SWT.NONE).setText("Renderer:");

	rendererCombo = new Combo(parms, SWT.READ_ONLY);
	rendererCombo.setItems(new String[] { "PaletteShelfRenderer", "RedmondShelfRenderer" });
	rendererCombo.select(0);
	rendererCombo.addListener(SWT.Selection, listenerRecreates);

}
 
源代码11 项目: elexis-3-core   文件: RnDialogs.java
@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;
}
 
源代码12 项目: elexis-3-core   文件: RnDialogs.java
@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));
	Label lblSelectState = new Label(ret, SWT.NONE);
	lblSelectState.setText(Messages.RnDialogs_pleaseNewStateForMulti);
	
	cbStates = new Combo(ret, SWT.READ_ONLY);
	cbStates.setItems(RnStatus.getStatusTexts());
	cbStates.setVisibleItemCount(RnStatus.getStatusTexts().length);
	cbStates.select(rechnungen.get(0).getStatus());
	cbStates.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	
	tableViewer = new TableViewer(ret, SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
	GridData gd_Table = new GridData();
	gd_Table.grabExcessHorizontalSpace = true;
	gd_Table.horizontalSpan = 1;
	gd_Table.minimumHeight = 150;
	gd_Table.heightHint = 150;
	tableViewer.getTable().setLayoutData(gd_Table);
	tableViewer.getTable().setHeaderVisible(true);
	tableViewer.getTable().setLinesVisible(false);
	
	tableViewer.setContentProvider(new ArrayContentProvider());
	TableViewerColumn colRnNumber = new TableViewerColumn(tableViewer, SWT.NONE);
	colRnNumber.getColumn().setWidth(200);
	colRnNumber.getColumn().setText(Messages.RnDialogs_invoiceNumber);
	colRnNumber.setLabelProvider(new ColumnLabelProvider());
	
	tableViewer.setInput(rnNumbers);
	
	return ret;
}
 
源代码13 项目: gama   文件: BoxSettingsTab.java
protected Combo newCombo(final Composite c, final String[] items, final SelectionListener listener) {
	final Combo combo1 = new Combo(c, SWT.READ_ONLY);
	combo1.setItems(items);
	combo1.addSelectionListener(listener);
	return combo1;
}
 
源代码14 项目: ldparteditor   文件: YTruderDesign.java
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_title = new Label(cmp_container, SWT.NONE);
    lbl_title.setText(I18n.YTRUDER_Title);

    Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Label lbl_description = new Label(cmp_container, SWT.NONE);
    lbl_description.setText(I18n.YTRUDER_Description);

    {
        NButton btn_TranslateByDistance = new NButton(cmp_container, SWT.RADIO);
        this.btn_TranslateByDistance[0] = btn_TranslateByDistance;
        btn_TranslateByDistance.setText(I18n.YTRUDER_TranslationByDistance);
        btn_TranslateByDistance.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        btn_TranslateByDistance.setSelection(ys.getMode() == 1);
    }
    {
        NButton btn_SymmetryAcrossPlane = new NButton(cmp_container, SWT.RADIO);
        this.btn_SymmetryAcrossPlane[0] = btn_SymmetryAcrossPlane;
        btn_SymmetryAcrossPlane.setText(I18n.YTRUDER_SymmetryAcrossPlane);
        btn_SymmetryAcrossPlane.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        btn_SymmetryAcrossPlane.setSelection(ys.getMode() == 2);
    }
    {
        NButton btn_ProjectionOnPlane = new NButton(cmp_container, SWT.RADIO);
        this.btn_ProjectionOnPlane[0] = btn_ProjectionOnPlane;
        btn_ProjectionOnPlane.setText(I18n.YTRUDER_ProjectionOnPlane);
        btn_ProjectionOnPlane.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        btn_ProjectionOnPlane.setSelection(ys.getMode() == 3);
    }
    {
        NButton btn_ExtrudeRadially = new NButton(cmp_container, SWT.RADIO);
        this.btn_ExtrudeRadially[0] = btn_ExtrudeRadially;
        btn_ExtrudeRadially.setText(I18n.YTRUDER_ExtrudeRadially);
        btn_ExtrudeRadially.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        btn_ExtrudeRadially.setSelection(ys.getMode() == 4);
    }

    Label lbl_lineThreshold = new Label(cmp_container, SWT.NONE);
    lbl_lineThreshold.setText(I18n.YTRUDER_Value);

    BigDecimalSpinner spn_value = new BigDecimalSpinner(cmp_container, SWT.NONE);
    this.spn_value[0] = spn_value;
    spn_value.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    spn_value.setMaximum(new BigDecimal(999999));
    spn_value.setMinimum(new BigDecimal(-999999));
    spn_value.setValue(new BigDecimal(ys.getDistance()));

    Label lbl_rotationAngle = new Label(cmp_container, SWT.NONE);
    lbl_rotationAngle.setText(I18n.YTRUDER_CondlineAngle);

    BigDecimalSpinner spn_rotationAngle = new BigDecimalSpinner(cmp_container, SWT.NONE);
    this.spn_condlineAngleThreshold[0] = spn_rotationAngle;
    spn_rotationAngle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    spn_rotationAngle.setMaximum(new BigDecimal(180));
    spn_rotationAngle.setMinimum(new BigDecimal(0));
    spn_rotationAngle.setValue(new BigDecimal(ys.getCondlineAngleThreshold()));

    Label lbl_af = new Label(cmp_container, SWT.NONE);
    lbl_af.setText(I18n.YTRUDER_Axis);

    Combo cmb_axis = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_axis[0] = cmb_axis;
    cmb_axis.setItems(new String[] {I18n.YTRUDER_X, I18n.YTRUDER_Y, I18n.YTRUDER_Z});
    cmb_axis.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    cmb_axis.select(ys.getAxis());

    cmp_container.pack();
    return cmp_container;
}
 
源代码15 项目: nebula   文件: GalleryExampleTab.java
private void createGroupParametersGroup(Composite parent) {
	Group dataGroup = createEmptyGroup(parent, "Group parameters");
	GridLayoutFactory.swtDefaults().margins(3, 3).numColumns(3).applyTo(dataGroup);

	cGroupRenderer = new Combo(dataGroup, SWT.READ_ONLY);
	cGroupRenderer.setItems(new String[] { "Show groups", "Hide groups" });
	cGroupRenderer.setText("Show groups");
	cGroupRenderer.addListener(SWT.Selection, groupParamSelectionListener);
	GridData gridData = new GridData();
	gridData.horizontalSpan = 3;
	cGroupRenderer.setLayoutData(gridData);

	// Scale : set item size
	scale = createScale(dataGroup, "Item size", 16, 512, 16, 64);
	scale.addListener(SWT.Selection, e -> {
		if (g != null) {
			groupRenderer.setItemSize(scale.getSelection(), scale.getSelection());
			itemWidthScale.setSelection(scale.getSelection());
			itemHeightScale.setSelection(scale.getSelection());
			g.setGroupRenderer(groupRenderer);
		}
	});

	// Scale : set item width
	this.itemWidthScale = createScale(dataGroup, "Item width", 16, 512, 16, 64);
	itemWidthScale.addListener(SWT.Selection, e -> {
		if (g != null) {
			groupRenderer.setItemWidth(itemWidthScale.getSelection());
			g.setGroupRenderer(groupRenderer);
		}
	});

	// Scale : set item height
	this.itemHeightScale = createScale(dataGroup, "Item height", 16, 512, 16, 64);
	itemHeightScale.addListener(SWT.Selection, e -> {
		if (g != null) {
			groupRenderer.setItemHeight(itemHeightScale.getSelection());
			g.setGroupRenderer(groupRenderer);
		}
	});

	// Scale : set margins size
	this.marginsScale = createScale(dataGroup, "Margins", 0, 128, 16, 10);
	marginsScale.addListener(SWT.Selection, e -> {
		if (g != null) {
			groupRenderer.setMinMargin(marginsScale.getSelection());
			g.setGroupRenderer(groupRenderer);
		}
	});

}
 
源代码16 项目: XPagesExtensionLibrary   文件: WizardUtils.java
public static Combo createCombo(Composite parent, int span, String[] items, int index, SelectionListener listener) {
    Combo combo = createCombo(parent, span, listener);
    combo.setItems(items);
    combo.select(index);
    return combo;
}
 
源代码17 项目: XPagesExtensionLibrary   文件: WizardUtils.java
public static Combo createEditCombo(Composite parent, int span, String[] items, int index, SelectionListener listener) {
    Combo combo = createEditCombo(parent, span, listener);
    combo.setItems(items);
    combo.select(index);
    return combo;
}
 
源代码18 项目: bonita-studio   文件: CronEditor.java
protected Composite createStartTimeComposite(final Composite parentComposite,
        final IObservableValue hourObservable,
        final IObservableValue minuteObservable,
        final IObservableValue secondObservable) {
    final Composite timeComposite = new Composite(parentComposite, SWT.NONE);
    timeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    timeComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(4).create());

    final Label startTimeLabel = new Label(timeComposite, SWT.NONE);
    startTimeLabel.setText(Messages.startTime);

    final Combo hourCombo = new Combo(timeComposite, SWT.READ_ONLY | SWT.BORDER);
    hourCombo.setItems(HOURS_IN_DAY);

    NumberFormat formatter = new DecimalFormat("#00");
    UpdateValueStrategy hourStrategy = new UpdateValueStrategy();
    hourStrategy.setConverter(StringToNumberConverter.toInteger(true));

    UpdateValueStrategy hourStrategy2 = new UpdateValueStrategy();
    hourStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));

    context.bindValue(SWTObservables.observeText(hourCombo), hourObservable, hourStrategy, hourStrategy2);

    final Combo minuteCombo = new Combo(timeComposite, SWT.READ_ONLY | SWT.BORDER);
    minuteCombo.setItems(MINUTES_IN_HOURS);
    UpdateValueStrategy minuteStrategy = new UpdateValueStrategy();
    minuteStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy minuteStrategy2 = new UpdateValueStrategy();
    minuteStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(minuteCombo), minuteObservable, minuteStrategy, minuteStrategy2);

    final Combo secondCombo = new Combo(timeComposite, SWT.READ_ONLY | SWT.BORDER);
    secondCombo.setItems(MINUTES_IN_HOURS);
    UpdateValueStrategy secondStrategy = new UpdateValueStrategy();
    secondStrategy.setConverter(StringToNumberConverter.toInteger(true));
    UpdateValueStrategy secondStrategy2 = new UpdateValueStrategy();
    secondStrategy2.setConverter(NumberToStringConverter.fromInteger(formatter, true));
    context.bindValue(SWTObservables.observeText(secondCombo), secondObservable, secondStrategy, secondStrategy2);

    return timeComposite;
}
 
源代码19 项目: ldparteditor   文件: IntersectorDesign.java
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_specify = new Label(cmp_container, SWT.NONE);
    lbl_specify.setText(I18n.INTERSECTOR_Title);

    Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Label lbl_description = new Label(cmp_container, SWT.NONE);
    lbl_description.setText(I18n.INTERSECTOR_Description);
    
    NButton btn_hideOther = new NButton(cmp_container, SWT.CHECK);
    this.btn_hideOther[0] = btn_hideOther;
    btn_hideOther.setText(I18n.INTERSECTOR_HideOther);
    btn_hideOther.setSelection(ins.isHidingOther());
    
    Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_scope[0] = cmb_scope;
    cmb_scope.setItems(new String[] {I18n.INTERSECTOR_ScopeFile, I18n.INTERSECTOR_ScopeSelection});
    cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    cmb_scope.setText(cmb_scope.getItem(ins.getScope()));
    cmb_scope.select(ins.getScope());
    cmb_scope.setEnabled(false);

    {
        Combo cmb_colourise = new Combo(cmp_container, SWT.READ_ONLY);
        this.cmb_colourise[0] = cmb_colourise;
        cmb_colourise.setItems(new String[] {I18n.INTERSECTOR_NoMods, I18n.INTERSECTOR_ColourMods});
        cmb_colourise.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        cmb_colourise.setText(cmb_colourise.getItem(ins.isColourise() ? 1 : 0));
        cmb_colourise.select(ins.isColourise() ? 1 : 0);
    }

    cmp_container.pack();
    return cmp_container;
}
 
源代码20 项目: olca-app   文件: JsonImportDialog.java
@Override
protected Control createDialogArea(Composite parent) {
	Composite root = (Composite) super.createDialogArea(parent);
	UI.gridLayout(root, 1, 10, 10);

	Composite comp = new Composite(root, SWT.NONE);
	UI.gridLayout(comp, 2, 10, 0);
	UI.formLabel(comp, M.File);
	String fileText = Strings.cut(provider.file.getParent(), 50)
			+ File.separator
			+ Strings.cut(provider.file.getName(), 50);
	Label label = UI.formLabel(comp, fileText);
	label.setForeground(Colors.linkBlue());

	Button openCheck = new Button(root, SWT.RADIO);
	openCheck.setText("Open mapping definition");
	Combo combo = new Combo(root, SWT.READ_ONLY);
	Controls.onSelect(combo, e -> {
		selectedMap = flowMaps.get(combo.getSelectionIndex());
	});
	UI.gridData(combo, true, false);
	Controls.onSelect(openCheck, e -> {
		selectedMap = flowMaps.get(combo.getSelectionIndex());
		combo.setEnabled(true);
	});

	Button genCheck = new Button(root, SWT.RADIO);
	genCheck.setText("Generate mapping based on flow attributes");
	Controls.onSelect(genCheck, e -> {
		selectedMap = null;
		combo.setEnabled(false);
	});

	if (flowMaps.isEmpty()) {
		genCheck.setSelection(true);
		openCheck.setSelection(false);
		combo.setEnabled(false);
		openCheck.setEnabled(false);
	} else {
		openCheck.setSelection(true);
		genCheck.setSelection(false);
		String[] items = this.flowMaps
				.stream()
				.map(m -> m.name)
				.toArray(len -> new String[len]);
		combo.setItems(items);
		combo.select(0);
		selectedMap = flowMaps.get(0);
	}
	return root;
}