org.eclipse.swt.widgets.Combo Java Examples
The following examples show how to use
org.eclipse.swt.widgets.Combo.
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: TypeCombo.java From uima-uimaj with Apache License 2.0 | 6 votes |
/** * Instantiates a new type combo. * * @param parent the parent */ public TypeCombo(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); typeCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER); typeCombo.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Type newType = getType(); for (ITypePaneListener listener : listeners) { listener.typeChanged(newType); } } }); }
Example #2
Source File: RelationshipDialog.java From erflute with Apache License 2.0 | 6 votes |
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 #3
Source File: HopGitPerspective.java From hop with Apache License 2.0 | 6 votes |
@GuiToolbarElement( root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_REPOSITORY_LABEL, type = GuiToolbarElementType.LABEL, label = "Git repository ", toolTip = "Click here to edit the active git repository", separator = true ) public void editGitRepository() { HopGui hopGui = HopGui.getInstance(); Combo combo = getRepositoryCombo(); if ( combo == null ) { return; } String repositoryName = combo.getText(); try { MetadataManager<GitRepository> manager = new MetadataManager<>( hopGui.getVariables(), hopGui.getMetadataProvider(), GitRepository.class ); if ( manager.editMetadata( repositoryName ) ) { refreshGitRepositoriesList(); selectRepositoryInList( repositoryName ); } } catch ( Exception e ) { new ErrorDialog( hopGui.getShell(), "Error", "Error editing environment '" + repositoryName, e ); } }
Example #4
Source File: ItemView.java From http4e with Apache License 2.0 | 6 votes |
private void initHttpCombo( Composite top){ httpCombo = new Combo(top, SWT.READ_ONLY); httpCombo.setItems(CoreConstants.HTTP11_METHODS); httpCombo.setText(model.getHttpMethod()); httpCombo.addSelectionListener(new SelectionAdapter() { private String prevMethod = model.getHttpMethod(); public void widgetSelected( SelectionEvent e){ // becomes GET, HEAD, PUT, etc if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) { state.setState(ItemState.POST_DISABLED); // becomes POST } else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) { state.setState(ItemState.POST_ENABLED); // no update } else { state.setState(ItemState.POST_NO_UPDATE); } prevMethod = httpCombo.getText(); model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model)); } }); }
Example #5
Source File: InputParameterDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * * set the default selected item in combo * * @param selectIndex * :indicate which item will be selected * @param combo * : Combo * */ protected void setSelectValueAfterInitCombo( int selectIndex, Combo combo ) { boolean found = dealWithValueInComboList( selectIndex, defaultValue, combo, parameter ); if ( !found ) { dealWithValueNotInComboList( defaultValue, combo, parameter, isCascade, valueList ); } }
Example #6
Source File: OptionsConfigurationBlock.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
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; }
Example #7
Source File: NewProjectWizardProjInfoPage.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 获取项目属性字段集合 * @return key 为属性名称,value 中第一个值为选中的属性值,第二个值为该属性对应的所有属性值集合 */ public LinkedHashMap<String, Object[]> getAttributeMap() { LinkedHashMap<String, Object[]> mapAttr = new LinkedHashMap<String, Object[]>(); if (lstCombo != null) { for (Combo cmb : lstCombo) { if (!cmb.isDisposed()) { ArrayList<String> lstAttrValue = new ArrayList<String>(); for (String attrVal : cmb.getItems()) { lstAttrValue.add(TextUtil.stringToXML(attrVal)); } mapAttr.put(TextUtil.stringToXML((String) cmb.getData()), new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue }); } } } return mapAttr; }
Example #8
Source File: CrosstabBindingDialogHelper.java From birt with Eclipse Public License 1.0 | 6 votes |
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 ); }
Example #9
Source File: TSLintWizardPage.java From typescript.java with MIT License | 6 votes |
private void createEmbeddedTslintPluginField(Composite parent) { useEmbeddedTslintPluginButton = new Button(parent, SWT.RADIO); useEmbeddedTslintPluginButton.setText(TypeScriptUIMessages.TSLintWizardPage_useEmbeddedTslintPlugin_label); useEmbeddedTslintPluginButton.addListener(SWT.Selection, this); useEmbeddedTslintPluginButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateTslintPluginMode(); } }); embeddedTslintPlugin = new Combo(parent, SWT.READ_ONLY); embeddedTslintPlugin.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); ComboViewer viewer = new ComboViewer(embeddedTslintPlugin); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new TypeScriptRepositoryLabelProvider(false, true)); List<ITypeScriptRepository> repositories = Arrays .stream(TypeScriptCorePlugin.getTypeScriptRepositoryManager().getRepositories()) .filter(r -> r.getTslintLanguageServiceName() != null).collect(Collectors.toList()); viewer.setInput(repositories); }
Example #10
Source File: CostDialog.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createCurrencyRow(Composite body, FormToolkit tk) { Combo widget = UI.formCombo(body, tk, M.Currency); currencyCombo = new ComboViewer(widget); currencyCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object obj) { if (!(obj instanceof Currency)) return super.getText(obj); return ((Currency) obj).name; } }); setCurrencyContent(currencyCombo); currencyCombo.addSelectionChangedListener(e -> { currency = Viewers.getFirst(e.getSelection()); exchange.currency = currency; updateCurrencyLabels(); }); UI.filler(body, tk); }
Example #11
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 6 votes |
protected Control findControl( Key key ) { Combo comboBox = getComboBox( key ); if ( comboBox != null ) { return comboBox; } Button checkBox = getCheckBox( key ); if ( checkBox != null ) { return checkBox; } Text text = getTextControl( key ); if ( text != null ) { return text; } return null; }
Example #12
Source File: AccountSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
public AccountSelector(Composite parent, IGoogleLoginService loginService) { super(parent, SWT.NONE); this.loginService = loginService; loginMessage = Messages.getString("ACCOUNT_SELECTOR_LOGIN"); combo = new Combo(this, SWT.READ_ONLY); List<Account> sortedAccounts = new ArrayList<>(loginService.getAccounts()); Collections.sort(sortedAccounts, new Comparator<Account>() { @Override public int compare(Account o1, Account o2) { return o1.getEmail().compareTo(o2.getEmail()); } }); for (Account account : sortedAccounts) { combo.add(account.getEmail()); combo.setData(account.getEmail(), account); } combo.add(loginMessage); combo.addSelectionListener(logInOnSelect); GridDataFactory.fillDefaults().grab(true, false).applyTo(combo); GridLayoutFactory.fillDefaults().generateLayout(this); }
Example #13
Source File: PipelineArgumentsTabTest.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Test public void testValidatePage_doesNotClearErrorSetByChildren() { String errorMessage; Combo emailKey = CompositeUtil.findControlAfterLabel(shellResource.getShell(), Combo.class, "&Account:"); if (emailKey.getText().isEmpty()) { errorMessage = "No Google account selected for this launch."; } else { Text serviceAccountKey = CompositeUtil.findControlAfterLabel(shellResource.getShell(), Text.class, "Service account key:"); serviceAccountKey.setText("/non/existing/file"); errorMessage = "/non/existing/file does not exist."; } assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage()); pipelineArgumentsTab.isValid(configuration1); assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage()); }
Example #14
Source File: HopGuiPipelineGraph.java From hop with Apache License 2.0 | 5 votes |
public void setZoomLabel() { Combo combo = (Combo) toolBarWidgets.getWidgetsMap().get( TOOLBAR_ITEM_ZOOM_LEVEL ); if ( combo == null ) { return; } String newString = Math.round( magnification * 100 ) + "%"; String oldString = combo.getText(); if ( !newString.equals( oldString ) ) { combo.setText( Math.round( magnification * 100 ) + "%" ); } }
Example #15
Source File: HopGuiPipelineGraph.java From hop with Apache License 2.0 | 5 votes |
/** * Allows for magnifying to any percentage entered by the user... */ private void readMagnification() { float oldMagnification = magnification; Combo zoomLabel = (Combo) toolBarWidgets.getWidgetsMap().get( TOOLBAR_ITEM_ZOOM_LEVEL ); if ( zoomLabel == null ) { return; } String possibleText = zoomLabel.getText().replace( "%", "" ); float possibleFloatMagnification; try { possibleFloatMagnification = Float.parseFloat( possibleText ) / 100; magnification = possibleFloatMagnification; if ( zoomLabel.getText().indexOf( '%' ) < 0 ) { zoomLabel.setText( zoomLabel.getText().concat( "%" ) ); } } catch ( Exception e ) { modalMessageDialog( BaseMessages.getString( PKG, "PipelineGraph.Dialog.InvalidZoomMeasurement.Title" ), BaseMessages.getString( PKG, "PipelineGraph.Dialog.InvalidZoomMeasurement.Message", zoomLabel.getText() ), SWT.YES | SWT.ICON_ERROR ); } // When zooming out we want to correct the scroll bars. // float factor = magnification / oldMagnification; int newHThumb = Math.min( (int) ( horizontalScrollBar.getThumb() / factor ), 100 ); horizontalScrollBar.setThumb( newHThumb ); horizontalScrollBar.setSelection( (int) ( horizontalScrollBar.getSelection() * factor ) ); int newVThumb = Math.min( (int) ( verticalScrollBar.getThumb() / factor ), 100 ); verticalScrollBar.setThumb( newVThumb ); verticalScrollBar.setSelection( (int) ( verticalScrollBar.getSelection() * factor ) ); canvas.setFocus(); redraw(); }
Example #16
Source File: HopGuiWorkflowGraph.java From hop with Apache License 2.0 | 5 votes |
public void setZoomLabel() { Combo zoomLabel = (Combo) toolBarWidgets.getWidgetsMap().get( TOOLBAR_ITEM_ZOOM_LEVEL ); if ( zoomLabel == null ) { return; } String newString = Math.round( magnification * 100 ) + "%"; String oldString = zoomLabel.getText(); if ( !newString.equals( oldString ) ) { zoomLabel.setText( Math.round( magnification * 100 ) + "%" ); } }
Example #17
Source File: ConfigurationWizardMainPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Utility method to create an editable combo box * * @param parent the parent of the combo box * @return the created combo */ protected Combo createEditableCombo(Composite parent) { Combo combo = new Combo(parent, SWT.NULL); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; combo.setLayoutData(data); return combo; }
Example #18
Source File: AbstractFormatterSelectionBlock.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private static Combo createProfileCombo(Composite composite, int span, int widthHint) { final GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; gd.widthHint = widthHint; final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); combo.setFont(composite.getFont()); combo.setLayoutData(gd); return combo; }
Example #19
Source File: MySQLAdvancedComposite.java From erflute with Apache License 2.0 | 5 votes |
private static void initEngineCombo(Combo combo) { combo.add(""); combo.add("MyISAM"); combo.add("InnoDB"); combo.add("Memory"); combo.add("Merge"); combo.add("Archive"); combo.add("Federated"); combo.add("NDB"); combo.add("CSV"); combo.add("Blackhole"); combo.add("CSV"); }
Example #20
Source File: HopGitPerspective.java From hop with Apache License 2.0 | 5 votes |
private Combo getRepositoryCombo() { Control control = toolBarWidgets.getWidgetsMap().get( TOOLBAR_ITEM_REPOSITORY_SELECT ); if ( ( control != null ) && ( control instanceof Combo ) ) { Combo combo = (Combo) control; return combo; } return null; }
Example #21
Source File: ExportToExcelDialog.java From ermaster-b with Apache License 2.0 | 5 votes |
private void createCategoryCombo(Composite parent) { GridData gridData = new GridData(); gridData.widthHint = 200; gridData.horizontalSpan = 2; this.categoryCombo = new Combo(parent, SWT.READ_ONLY); this.categoryCombo.setLayoutData(gridData); this.categoryCombo.setVisibleItemCount(20); }
Example #22
Source File: WizardUtils.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public static String getComboText(final Combo combo, final String defVal) { if ((combo == null) || (combo.isDisposed())) { return defVal; } return (combo.getText()); }
Example #23
Source File: ComboDialogField.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public Control[] doFillIntoGrid(Composite parent, int nColumns) { assertEnoughColumns(nColumns); Label label = getLabelControl(parent); label.setLayoutData(gridDataForLabel(1)); Combo combo = getComboControl(parent); combo.setLayoutData(gridDataForCombo(nColumns - 1)); return new Control[] { label, combo }; }
Example #24
Source File: GitlabQueryPage.java From mylyn-gitlab with Eclipse Public License 1.0 | 5 votes |
private void createOptionsArea(Composite parent) { Composite optionsArea = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(optionsArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsArea); Composite statusArea = new Composite(optionsArea, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(4).equalWidth(false).applyTo(statusArea); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(statusArea); new Label(statusArea, SWT.NONE).setText(Strings.QUERY_STATE); openButton = new Button(statusArea, SWT.CHECK); openButton.setSelection(true); openButton.setText(GitlabIssue.STATE_OPENED); openButton.addSelectionListener(completeListener); closedButton = new Button(statusArea, SWT.CHECK); closedButton.setSelection(true); closedButton.setText(GitlabIssue.STATE_CLOSED); closedButton.addSelectionListener(completeListener); Label milestonesLabel = new Label(optionsArea, SWT.NONE); milestonesLabel.setText(Strings.QUERY_MILESTONE); milestoneCombo = new Combo(optionsArea, SWT.DROP_DOWN | SWT.READ_ONLY); GridDataFactory.fillDefaults().grab(true, false).applyTo(milestoneCombo); GitlabConnection connection = ConnectionManager.getSafe(getTaskRepository()); if(connection != null) { milestoneCombo.add(""); for(GitlabMilestone s : connection.getMilestones()) { milestoneCombo.add(s.getTitle()); } } Label assigneeLabel = new Label(optionsArea, SWT.NONE); assigneeLabel.setText(Strings.QUERY_ASSIGNEE); assigneeText = new Text(optionsArea, SWT.BORDER | SWT.SINGLE); GridDataFactory.fillDefaults().grab(true, false).applyTo(assigneeText); }
Example #25
Source File: WidgetUtil.java From birt with Eclipse Public License 1.0 | 5 votes |
public static void setGridData( Control control, int hSpan, boolean grabSpace ) { GridData data = new GridData( ); data.horizontalSpan = hSpan; data.grabExcessHorizontalSpace = grabSpace; if ( control instanceof Text || control instanceof Combo ) { data.widthHint = MIN_TEXT_WIDTH; } data.horizontalAlignment = GridData.FILL; control.setLayoutData( data ); }
Example #26
Source File: MappingDialog.java From olca-app with Mozilla Public License 2.0 | 5 votes |
void render(Composite parent, FormToolkit tk) { Composite comp = tk.createComposite(parent); UI.gridLayout(comp, 2, 10, 5); UI.gridData(comp, true, false); UI.formLabel(comp, tk, M.Flow); flowLink = UI.formLink(comp, tk, ""); Controls.onClick(flowLink, _e -> { IProvider p = forSource ? tool.sourceSystem : tool.targetSystem; if (p == null) { MsgBox.error("Cannot select flow", "No data source for flows connected"); return; } FlowRefDialog.open(p, opt -> { if (!opt.isPresent()) return; updateWith(opt.get()); }); }); UI.formLabel(comp, tk, M.Category); categoryLabel = UI.formLabel(comp, tk, ""); UI.formLabel(comp, tk, M.FlowProperty); propertyLabel = UI.formLabel(comp, tk, ""); UI.formLabel(comp, tk, M.Unit); unitLabel = UI.formLabel(comp, tk, ""); // the provider link if (!forSource && tool.targetSystem instanceof DBProvider) { Combo combo = UI.formCombo(comp, tk, M.Provider); UI.gridData(combo, false, false).widthHint = 400; this.providerCombo = new ProviderCombo(ref, combo); } updateLabels(); }
Example #27
Source File: WizardUtils.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public static int getComboIndex(final Combo combo, final int defVal) { if ((combo == null) || (combo.isDisposed())) { return defVal; } return (combo.getSelectionIndex()); }
Example #28
Source File: TestingGuiPlugin.java From hop with Apache License 2.0 | 5 votes |
/** * Clear the current unit test from the active pipeline... */ @GuiToolbarElement( root = HopGuiPipelineGraph.GUI_PLUGIN_TOOLBAR_PARENT_ID, id = "HopGuiPipelineGraph-ToolBar-20030-unit-test-detach", toolTip = "Detach the unit test from this pipeline", image = "Test_tube_icon_detach.svg" ) public void detachUnitTest() { HopGui hopGui = HopGui.getInstance(); try { PipelineMeta pipelineMeta = getActivePipelineMeta(); if ( pipelineMeta == null ) { return; } // Remove // activeTests.remove( pipelineMeta ); pipelineMeta.setVariable( DataSetConst.VAR_RUN_UNIT_TEST, "N" ); // Clear the combo box // Combo combo = getUnitTestsCombo(); if ( combo != null ) { combo.setText( "" ); } // Update the GUI // hopGui.getActiveFileTypeHandler().updateGui(); } catch ( Exception e ) { new ErrorDialog( hopGui.getShell(), "Error", "Error detaching unit test", e ); } }
Example #29
Source File: GroupDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
private String getKeyExpression( Combo chooser, String key ) { for ( Iterator iter = columnList.iterator( ); iter.hasNext( ); ) { ComputedColumnHandle cachedColumn = (ComputedColumnHandle) iter.next( ); if ( cachedColumn.getName( ).equals( key ) ) { IExpressionConverter converter = ExpressionButtonUtil.getCurrentExpressionConverter( chooser ); return ExpressionUtility.getExpression( cachedColumn, converter ); } } return key; }
Example #30
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
protected Combo getComboBox( Key key ) { for ( int i = fComboBoxes.size( ) - 1; i >= 0; i-- ) { Combo curr = (Combo) fComboBoxes.get( i ); ControlData data = (ControlData) curr.getData( ); if ( key.equals( data.getKey( ) ) ) { return curr; } } return null; }