List of usage examples for org.eclipse.jface.fieldassist AutoCompleteField AutoCompleteField
public AutoCompleteField(Control control, IControlContentAdapter controlContentAdapter, String... proposals)
From source file:com.dubture.symfony.debug.launch.LaunchConfigurationTab.java
License:Open Source License
@Override public void createControl(Composite parent) { Font font = parent.getFont(); comp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); comp.setLayout(layout);/*from w w w . j a va2 s. com*/ comp.setFont(font); GridData gd = new GridData(GridData.FILL_BOTH); comp.setLayoutData(gd); setControl(comp); // setHelpContextId(); Group group = new Group(comp, SWT.NONE); group.setFont(font); layout = new GridLayout(); group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_BOTH)); String controlName = "Launch Settings"; group.setText(controlName); Label label = new Label(group, SWT.NONE); label.setText("Environment"); GridData data = new GridData(200, GridData.FILL, true, false); label.setLayoutData(data); kernelCombo = new Combo(group, SWT.READ_ONLY); data = new GridData(); data.horizontalIndent = 0; kernelCombo.setLayoutData(data); kernelCombo.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { for (AppKernel k : kernels) { String env = kernelCombo.getItem(kernelCombo.getSelectionIndex()); if (env.equals(k.getEnvironment())) { kernel = k; break; } } setDirty(true); updateLaunchConfigurationDialog(); updateURL(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); Label routeLabel = new Label(group, SWT.NONE); routeLabel.setText("Route"); route = new Text(group, SWT.SINGLE | SWT.BORDER); data = new GridData(); data.widthHint = 200; route.addKeyListener(routeListener); route.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { currentRoute = model.findRoute(route.getText(), project); setDirty(true); updateLaunchConfigurationDialog(); updateURL(); } @Override public void focusGained(FocusEvent e) { } }); route.setLayoutData(data); ac = new AutoCompleteField(route, new TextContentAdapter(), new String[] {}); Label urlLabel = new Label(group, SWT.NONE); urlLabel.setText("Generated URL"); url = new Text(group, SWT.BORDER | SWT.SINGLE); url.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { setDirty(true); updateLaunchConfigurationDialog(); } }); data = new GridData(GridData.FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false); url.setLayoutData(data); Dialog.applyDialogFont(comp); setControl(comp); }
From source file:com.opera.widgets.ui.editor.dialog.FeatureDetailsPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); composite.setLayout(layout);//w w w .j a v a 2s. c o m setControl(composite); GridData gd = new GridData(GridData.FILL_HORIZONTAL); new Label(composite, SWT.NONE).setText(Messages.FeatureDetailsPage_URILabel); fFeatureName = new Text(composite, SWT.NONE); fFeatureName.setLayoutData(gd); new AutoCompleteField(fFeatureName, new TextContentAdapter(), fProposals.keySet().toArray(new String[0])); new Label(composite, SWT.NONE).setText(Messages.FeatureDetailsPage_RequiredLabel); fRequired = new Button(composite, SWT.CHECK); Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; separator.setLayoutData(gd); if (fFeature.getName() != null) { fFeatureName.setText(fFeature.getName()); } fRequired.setSelection(fFeature.isRequired()); Label paramsTableLabel = new Label(composite, SWT.NONE); paramsTableLabel.setText(Messages.FeatureDetailsPage_ParametersLabel); fTableViewer = new TableViewer(composite); String[] titles = { Messages.FeatureDetailsPage_NameColumn, Messages.FeatureDetailsPage_ValueColumn }; int[] bounds = { 250, 250 }; for (int i = 0; i < titles.length; i++) { TableViewerColumn column = new TableViewerColumn(fTableViewer, SWT.NONE); column.getColumn().setText(titles[i]); column.getColumn().setWidth(bounds[i]); column.getColumn().setResizable(true); column.setEditingSupport(new ParamsEditingSupport(fTableViewer, i)); } gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; paramsTableLabel.setLayoutData(gd); fTableViewer.getTable().setHeaderVisible(true); fTableViewer.getTable().setLinesVisible(true); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; gd.minimumHeight = 100; fTableViewer.getTable().setLayoutData(gd); fTableViewer.setContentProvider(new ParamsContentProvider()); fTableViewer.setLabelProvider(new ParamsLabelProvider()); fTableViewer.setInput(fParams); // EDITING SUPPORT Composite buttonsComposite = new Composite(composite, SWT.NONE); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; buttonsComposite.setLayoutData(gd); GridLayout buttonsLayout = new GridLayout(2, false); buttonsLayout.marginLeft = 0; buttonsComposite.setLayout(buttonsLayout); Button addButton = new Button(buttonsComposite, SWT.PUSH); addButton.setText(Messages.OverviewPage_ButtonAdd); addButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { Param newParam = new Param(fFeature); newParam.setName(Messages.FeatureDetailsPage_NameDefaultValue); newParam.setValue(Messages.FeatureDetailsPage_ValueDefaultValue); fParams.add(newParam); fTableViewer.add(newParam); fTableViewer.editElement(newParam, 0); } }); Button removeButton = new Button(buttonsComposite, SWT.PUSH); removeButton.setText(Messages.OverviewPage_ButtonRemove); removeButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (!fTableViewer.getSelection().isEmpty()) { fParams.remove( ((Param) ((IStructuredSelection) fTableViewer.getSelection()).getFirstElement())); fTableViewer.setInput(fParams); } } }); }
From source file:com.sabre.buildergenerator.ui.wizard.GenerateBuilderWizardPage.java
License:Open Source License
private void createPackagePart(Composite mainComposite) throws JavaModelException { createLabel(mainComposite, "Package"); packageNameText = new Text(mainComposite, SWT.SINGLE | SWT.BORDER); packageNameText.setText(properties.getPackageName()); packageNameText.setLayoutData(createCenterFillGridData()); packageNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent aE) { Text text = (Text) aE.widget; properties.setPackageName(text.getText()); System.out.println(text.getText()); transferTreeModelToUI();// w w w . j ava 2s . c o m } }); new AutoCompleteField(packageNameText, new TextContentAdapter(), convertToStringArray(getSourcePackages())); Button selectPackageButton = new Button(mainComposite, SWT.None); selectPackageButton.setText("Browse..."); selectPackageButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent aE) { selectPackage(); } public void widgetSelected(SelectionEvent aE) { selectPackage(); } }); }
From source file:hydrograph.ui.dataviewer.filter.FilterConditionsDialog.java
License:Apache License
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener, ModifyListener modifyListener, FocusListener focusListener) { final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE); buttonPane.setLayout(new FillLayout()); final CCombo combo = new CCombo(buttonPane, SWT.NONE); combo.setItems(relationalOperators); combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem)); tableItem.setData(comboName, combo); tableItem.setData(comboPaneName, buttonPane); combo.addSelectionListener(dropDownSelectionListener); combo.addModifyListener(modifyListener); combo.addFocusListener(focusListener); new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems()); final TableEditor editor = new TableEditor(tableViewer.getTable()); editor.grabHorizontal = true;/* w ww . j a va2 s .com*/ editor.grabVertical = true; editor.setEditor(buttonPane, tableItem, columnIndex); editor.layout(); combo.setData(editorName, editor); return combo; }
From source file:hydrograph.ui.dataviewer.filter.FilterHelper.java
License:Apache License
/** * Gets the field name selection listener. * /*from w ww . j a v a 2 s.c om*/ * @param tableViewer * the table viewer * @param conditionsList * the conditions list * @param fieldsAndTypes * the fields and types * @param fieldNames * the field names * @param saveButton * the save button * @param displayButton * the display button * @return the field name selection listener */ public SelectionListener getFieldNameSelectionListener(final TableViewer tableViewer, final List<Condition> conditionsList, final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) { SelectionListener listener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { CCombo source = (CCombo) e.getSource(); int index = (int) source.getData(FilterConstants.ROW_INDEX); Condition filterConditions = conditionsList.get(index); String fieldName = source.getText(); filterConditions.setFieldName(fieldName); if (StringUtils.isNotBlank(fieldName)) { String fieldType = fieldsAndTypes.get(fieldName); TableItem item = tableViewer.getTable().getItem(index); CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS); String[] items = FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType); //if the current item is not in the item list, reset it if (!Arrays.asList(items).contains(conditionalCombo.getText())) { conditionalCombo.setText(""); } conditionalCombo.setItems(items); new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems()); } validateCombo(source); toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }; return listener; }
From source file:hydrograph.ui.dataviewer.filter.FilterHelper.java
License:Apache License
/** * Gets the field name modify listener./*from www.jav a 2s .c o m*/ * * @param tableViewer * the table viewer * @param conditionsList * the conditions list * @param fieldsAndTypes * the fields and types * @param fieldNames * the field names * @param saveButton * the save button * @param displayButton * the display button * @return the field name modify listener */ public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList, final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) { ModifyListener listener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { CCombo source = (CCombo) e.getSource(); int index = (int) source.getData(FilterConstants.ROW_INDEX); Condition filterConditions = conditionsList.get(index); String fieldName = source.getText(); filterConditions.setFieldName(fieldName); if (StringUtils.isNotBlank(fieldName)) { String fieldType = fieldsAndTypes.get(fieldName); TableItem item = tableViewer.getTable().getItem(index); CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS); if (conditionalCombo != null && StringUtils.isNotBlank(fieldType)) { conditionalCombo.setText(filterConditions.getConditionalOperator()); conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType)); new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems()); } } validateCombo(source); toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton); } }; return listener; }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.databasecomponents.InputAdditionalParametersDialog.java
License:Apache License
/** * Create contents of the dialog.//from ww w. j ava 2 s . co m * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); container.getShell().setText(windowLabel); int CONST_HEIGHT = 276; Shell shell = container.getShell(); shell.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle rect = shell.getBounds(); if (rect.width != CONST_HEIGHT) { shell.setBounds(rect.x, rect.y, rect.width, CONST_HEIGHT); } } }); Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); noOfPartitionsLabel = new Label(composite, SWT.NONE); GridData gd_noOfPartitionsLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_noOfPartitionsLabel.widthHint = 180; noOfPartitionsLabel.setLayoutData(gd_noOfPartitionsLabel); noOfPartitionsLabel.setText(Messages.NO_OF_PARTITIONS); noOfPartitionsTextBox = new Text(composite, SWT.BORDER); noOfPartitionControlDecoration = WidgetUtility.addDecorator(noOfPartitionsTextBox, Messages.DB_NUMERIC_PARAMETERZIATION_ERROR); noOfPartitionControlDecoration.setMarginWidth(2); noOfPartitionControlDecoration.hide(); GridData gd_noOfPartitionTextBox = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_noOfPartitionTextBox.horizontalIndent = 10; noOfPartitionsTextBox.setLayoutData(gd_noOfPartitionTextBox); partitionKeysLabel = new Label(composite, SWT.NONE); GridData gd_partitionKeysLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_partitionKeysLabel.widthHint = 180; partitionKeysLabel.setLayoutData(gd_partitionKeysLabel); partitionKeysLabel.setText(Messages.PARTITION_KEY); partitionKeyComboBox = new Combo(composite, SWT.DROP_DOWN); partitionKeyComboBox.setItems(schemaFields.toArray(new String[schemaFields.size()])); GridData gd_partitionKeyButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); partitionKeyComboBox.setVisibleItemCount(11); partitionKeyComboBox.setEnabled(false); gd_partitionKeyButton.widthHint = 90; gd_partitionKeyButton.horizontalIndent = 10; partitionKeyComboBox.setLayoutData(gd_partitionKeyButton); new AutoCompleteField(partitionKeyComboBox, new ComboContentAdapter(), schemaFields.toArray(new String[schemaFields.size()])); selectedPartitionKey = (String) additionalParameterValue.get(Constants.DB_PARTITION_KEY); if (StringUtils.isNotBlank(selectedPartitionKey)) { partitionKeyComboBox.setText(selectedPartitionKey); } else { partitionKeyComboBox.select(0); } partitionKeyLowerBoundLabel = new Label(composite, SWT.NONE); GridData gd_partitionKeyLowerBoundLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_partitionKeyLowerBoundLabel.widthHint = 180; partitionKeyLowerBoundLabel.setLayoutData(gd_partitionKeyLowerBoundLabel); partitionKeyLowerBoundLabel.setText(Messages.PARTITION_KEY_LOWER_BOUND); partitionKeyLowerBoundTextBox = new Text(composite, SWT.BORDER); partitionKeyLowerBoundControlDecoration = WidgetUtility.addDecorator(partitionKeyLowerBoundTextBox, Messages.DB_NUMERIC_PARAMETERZIATION_ERROR); partitionKeyLowerBoundControlDecoration.setMarginWidth(2); partitionKeyLowerBoundControlDecoration.hide(); GridData gd_partitionKeyLowerBoundTextBox = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_partitionKeyLowerBoundTextBox.horizontalIndent = 10; partitionKeyLowerBoundTextBox.setLayoutData(gd_partitionKeyLowerBoundTextBox); partitionKeyLowerBoundTextBox.setEnabled(false); partitionKeyUpperBoundLabel = new Label(composite, SWT.NONE); GridData gd_partitionKeyUpperBoundLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_partitionKeyUpperBoundLabel.widthHint = 180; partitionKeyUpperBoundLabel.setLayoutData(gd_partitionKeyUpperBoundLabel); partitionKeyUpperBoundLabel.setText(Messages.PARTITION_KEY_UPPER_BOUND); partitionKeyUpperBoundTextBox = new Text(composite, SWT.BORDER); partitionKeyUpperBoundControlDecoration = WidgetUtility.addDecorator(partitionKeyUpperBoundTextBox, Messages.DB_NUMERIC_PARAMETERZIATION_ERROR); partitionKeyUpperBoundControlDecoration.setMarginWidth(2); partitionKeyUpperBoundControlDecoration.hide(); GridData gd_partitionKeyUpperBoundTextBox = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_partitionKeyUpperBoundTextBox.horizontalIndent = 10; partitionKeyUpperBoundTextBox.setLayoutData(gd_partitionKeyUpperBoundTextBox); partitionKeyUpperBoundTextBox.setEnabled(false); fetchSizeLabel = new Label(composite, SWT.NONE); GridData gd_fetchSizeLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_fetchSizeLabel.widthHint = 180; fetchSizeLabel.setLayoutData(gd_fetchSizeLabel); fetchSizeLabel.setText(Messages.FETCH_SIZE); fetchSizeTextBox = new Text(composite, SWT.BORDER); fetchSizeControlDecoration = WidgetUtility.addDecorator(fetchSizeTextBox, Messages.FETCH_SIZE_ERROR_DECORATOR_MESSAGE); fetchSizeControlDecoration.setMarginWidth(2); fetchSizeControlDecoration.hide(); GridData gd_fetchSizeTextBox = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_fetchSizeTextBox.horizontalIndent = 10; fetchSizeTextBox.setLayoutData(gd_fetchSizeTextBox); fetchSizeTextBox.setText(FETCH_SIZE_VALUE); additionalDBParametersLabel = new Label(composite, SWT.NONE); GridData gd_additionalDBParametersLabel = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gd_additionalDBParametersLabel.widthHint = 180; additionalDBParametersLabel.setLayoutData(gd_additionalDBParametersLabel); additionalDBParametersLabel.setText(Messages.ADDITIONAL_DB_PARAMETERS); additionalParameterTextBox = new Text(composite, SWT.BORDER); additionalParameterControlDecoration = WidgetUtility.addDecorator(additionalParameterTextBox, Messages.ADDITIONAL_PARAMETER_ERROR_DECORATOR_MESSAGE); additionalParameterControlDecoration.setMarginWidth(2); additionalParameterControlDecoration.hide(); GridData gd_additionalParameter = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_additionalParameter.horizontalIndent = 10; additionalParameterTextBox.setLayoutData(gd_additionalParameter); addModifyListenerToNoOfPartitionTextBox(noOfPartitionsTextBox); addModifyListener(partitionKeyUpperBoundTextBox); addModifyListener(partitionKeyLowerBoundTextBox); addModifyListener(fetchSizeTextBox); addModifyListener(additionalParameterTextBox); addValidationToWidgets(noOfPartitionsTextBox, noOfPartitionControlDecoration); partitionKeyUpperBoundTextBox.addModifyListener( new ModifyListenerForDBComp(partitionKeyUpperBoundTextBox, partitionKeyLowerBoundTextBox, partitionKeyLowerBoundControlDecoration, partitionKeyUpperBoundControlDecoration)); partitionKeyLowerBoundTextBox.addModifyListener( new ModifyListenerForDBComp(partitionKeyUpperBoundTextBox, partitionKeyLowerBoundTextBox, partitionKeyLowerBoundControlDecoration, partitionKeyUpperBoundControlDecoration)); addValidationToWidgets(fetchSizeTextBox, fetchSizeControlDecoration); addValidationToAdditionalParameterWidget(additionalParameterTextBox, additionalParameterControlDecoration); addAdditionalParameterMapValues(); getShell().setMinimumSize(getInitialSize()); setPropertyHelpText(); return container; }
From source file:net.sourceforge.texlipse.properties.TexlipseProjectPropertyPage.java
License:Open Source License
/** * Create a text field for language setting. * @param parent parent component/*from w w w . j a va2 s .com*/ */ private void addLangSection(Composite parent) { Label descr = new Label(parent, SWT.LEFT | SWT.WRAP); descr.setLayoutData(new GridData()); descr.setText(TexlipsePlugin.getResourceString("propertiesLanguageDescription")); Composite composite = createDefaultComposite(parent, 2); Label label = new Label(composite, SWT.LEFT); label.setLayoutData(new GridData()); label.setText(TexlipsePlugin.getResourceString("propertiesLanguage")); languageField = new Text(composite, SWT.SINGLE | SWT.BORDER); languageField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); languageField.setTextLimit(2); new AutoCompleteField(languageField, new TextContentAdapter(), Locale.getISOLanguages()); }
From source file:net.sourceforge.texlipse.wizards.TexlipseProjectCreationWizardPage.java
License:Open Source License
/** * Create project name settings box.// w w w .j a v a2 s . c o m * @param composite the parent container */ private void createProjectNameControl(Composite composite) { Composite c = new Composite(composite, SWT.NULL); c.setLayout(new GridLayout(2, false)); GridData lgd = new GridData(GridData.FILL_HORIZONTAL); lgd.horizontalSpan = 2; c.setLayoutData(lgd); // add label Label label = new Label(c, SWT.LEFT); label.setText(TexlipsePlugin.getResourceString("projectWizardNameLabel")); label.setToolTipText(TexlipsePlugin.getResourceString("projectWizardNameTooltip")); label.setLayoutData(new GridData()); // add text field projectNameField = new Text(c, SWT.SINGLE | SWT.BORDER); projectNameField.setText(attributes.getProjectName()); projectNameField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardNameTooltip")); projectNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); projectNameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!projectNameField.isDisposed()) { validateProjectName(projectNameField.getText()); if (!projectLocationField.isEnabled()) { projectLocationField.setText(workspacePath + projectNameField.getText()); } } } }); // add language label final Label mainLabel = new Label(c, SWT.LEFT); mainLabel.setText(TexlipsePlugin.getResourceString("propertiesLanguage")); mainLabel.setToolTipText(TexlipsePlugin.getResourceString("propertiesLanguageDescription")); mainLabel.setLayoutData(new GridData()); // add text field languageField = new Text(c, SWT.SINGLE | SWT.BORDER); languageField.setText(attributes.getLanguageCode()); languageField.setToolTipText(TexlipsePlugin.getResourceString("propertiesLanguageDescription")); languageField.setLayoutData(new GridData()); new AutoCompleteField(languageField, new TextContentAdapter(), Locale.getISOLanguages()); languageField.setTextLimit(2); languageField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!languageField.isDisposed()) { String text = languageField.getText(); IStatus status = createStatus(IStatus.OK, ""); //Has it exactly two characters //Is this a valid language code if (text.length() != 2 || Arrays.binarySearch(Locale.getISOLanguages(), text) < 0) { status = createStatus(IStatus.WARNING, TexlipsePlugin.getResourceString("projectWizardLanguageCodeError")); } attributes.setLanguageCode(text); updateStatus(status, languageField); } } }); }
From source file:org.atomictagging.ui.composites.CompositeMoleculeSearch.java
License:Open Source License
private void createControl(final Composite parent) { final GridLayout layout = new GridLayout(3, false); parent.setLayout(layout);/*from ww w .j ava 2 s . co m*/ final Label lbId = createLabel(parent, "ID"); txId = createText(parent); btIdSearch = new Button(parent, SWT.PUSH); btIdSearch.setText("search"); btIdSearch.addSelectionListener(this); final Label lbTags = createLabel(parent, "Tags"); txTags = createText(parent); txTags.setEnabled(false); btTagsSearch = new Button(parent, SWT.PUSH); btTagsSearch.setText("search"); btTagsSearch.addSelectionListener(this); final Label lbAtoms = createLabel(parent, "Atoms"); txAtoms = createText(parent); txAtoms.setEnabled(false); btAtomsSearch = new Button(parent, SWT.PUSH); btAtomsSearch.setText("search"); btAtomsSearch.addSelectionListener(this); final String[] tags = tagService.getAllAsArray(); final String[] atoms = atomService.getDomainAsArray(); new AutoCompleteField(txTags, new TextsContentAdapter(), tags); new AutoCompleteField(txAtoms, new TextsContentAdapter(), atoms); }