Java Code Examples for org.eclipse.swt.custom.CCombo#setEditable()
The following examples show how to use
org.eclipse.swt.custom.CCombo#setEditable() .
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: RuleDialog.java From LogViewer with Eclipse Public License 2.0 | 6 votes |
private void createMatchModeCombo(Composite parent) { // draw label Label comboLabel = new Label(parent,SWT.LEFT); comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); comboLabel.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.label")); //$NON-NLS-1$ // draw combo matchModeCombo = new CCombo(parent,SWT.BORDER); matchModeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); matchModeCombo.setEditable(false); String[] matchModes = {LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.find"), LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.match")}; matchModeCombo.setItems(matchModes); if(edit) { String[] items = matchModeCombo.getItems(); for(int i = 0 ; i < items.length ; i++) { if(items[i].toLowerCase().indexOf(this.data.getMatchMode())!=-1) { matchModeCombo.select(i); return; } } } }
Example 2
Source File: CComboWidget.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createControl() { final Composite container = new Composite(this, SWT.NONE); container.setLayout(GridLayoutFactory.fillDefaults().margins(1, 1).create()); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(labelAbove ? 2 : 1, 1).create()); container.setBackground( readOnly ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND) : Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); container.addListener(SWT.Paint, e -> drawBorder(container, e)); int textStyle = 0; if (readOnly) { textStyle = SWT.READ_ONLY; } combo = new CCombo(container, textStyle); combo.setData(SWTBOT_WIDGET_ID_KEY, id); combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); combo.addListener(SWT.FocusIn, event -> redraw(container)); combo.addListener(SWT.FocusOut, event -> redraw(container)); combo.setEditable(!readOnly); return container; }
Example 3
Source File: LabelTimeComposite.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public LabelTimeComposite( Composite composite, String labelText, String toolTipText ) { super( composite, SWT.NONE ); props.setLook( this ); int middle = props.getMiddlePct(); int threeQuarters = ( middle + 100 ) / 2; int margin = Const.MARGIN; FormLayout formLayout = new FormLayout(); formLayout.marginWidth = 0; formLayout.marginHeight = 0; formLayout.marginTop = 0; formLayout.marginBottom = 0; this.setLayout( formLayout ); wText = new Text( this, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); FormData fdText = new FormData(); fdText.left = new FormAttachment( middle, margin ); fdText.right = new FormAttachment( threeQuarters, 0 ); wText.setLayoutData( fdText ); wText.setToolTipText( toolTipText ); wTimeUnit = new CCombo( this, SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER | SWT.LEFT ); FormData fdCombo = new FormData(); fdCombo.left = new FormAttachment( threeQuarters, margin ); fdCombo.right = new FormAttachment( 100, 0 ); wTimeUnit.setEditable( false ); wTimeUnit.setLayoutData( fdCombo ); wTimeUnit.setItems( getTimeUnits() ); wTimeUnit.setToolTipText( toolTipText ); wLabel = new Label( this, SWT.RIGHT ); props.setLook( wLabel ); wLabel.setText( labelText ); FormData fdLabel = new FormData(); fdLabel.left = new FormAttachment( 0, 0 ); fdLabel.right = new FormAttachment( middle, 0 ); fdLabel.top = new FormAttachment( wText, 0, SWT.CENTER ); wLabel.setLayoutData( fdLabel ); wLabel.setToolTipText( toolTipText ); wText.addModifyListener( new ModifyListener() { public void modifyText( ModifyEvent e ) { if ( !StringUtils.isNumeric( wText.getText() ) ) { wText.setText( lastValidValue ); } else { lastValidValue = wText.getText(); } } } ); }