@Override protected Control createDialogArea(Composite parentShell) { Composite parent = (Composite) super.createDialogArea(parentShell); Composite c = new Composite(parent, SWT.NONE); c.setLayout(new GridLayout(2, false)); Label l = new Label(c, SWT.NONE); l.setText("Select device: "); final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY); combo.setItems(mDeviceNames); int defaultSelection = sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0; combo.select(defaultSelection); sSelectedDeviceIndex = defaultSelection; combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { sSelectedDeviceIndex = combo.getSelectionIndex(); } }); return parent; }
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType ) { this.toolkit.createLabel ( parent, label + ":" ); final Combo combo = new Combo ( parent, SWT.DROP_DOWN ); combo.setItems ( items ); this.toolkit.adapt ( combo ); final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true ); gd.horizontalSpan = 2; combo.setLayoutData ( gd ); final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType ); this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value ); }
private Combo createAssertionCombo () { final Combo c = new Combo ( this, SWT.NONE ); for ( final Assertion assertion : Assertion.values () ) { c.add ( assertion.toString () ); } c.select ( 0 ); c.addSelectionListener ( new SelectionAdapter () { @Override public void widgetSelected ( final SelectionEvent e ) { AssertionComposite.this.orCondition.updateFilter (); } } ); final RowData rowData = new RowData (); rowData.width = 75; c.setLayoutData ( rowData ); return c; }
/** * This method initializes combo * */ private void createCombo() { GridData gridData1 = new GridData(); gridData1.grabExcessHorizontalSpace = false; gridData1.verticalAlignment = GridData.CENTER; gridData1.horizontalAlignment = GridData.BEGINNING; combo = new Combo(this, SWT.NONE); combo.setLayoutData(gridData1); combo.add("*"); combo.add("Screen class"); combo.add("Criteria"); combo.add("Extraction rule"); combo.add("Sheet"); combo.add("Transaction"); combo.add("Statement"); combo.add("Sequence"); combo.add("Step"); }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout gridLayout = new GridLayout(); container.setLayout(gridLayout); skip(container); Label explanation = new Label(container, SWT.NONE); explanation.setText(MessageUtil.getString("choose_the_execution_context_you_want_to_extend")); skip(container); ComboViewer comboViewer = new ComboViewer(container, SWT.NONE); Combo combo = comboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); loadAncestor(model); setupAncestor(comboViewer); setControl(container); }
private void addDragSupport(final List sourcePackageList, final Combo comboJarList) { DragSource dragSource = ExpressionEditorUtil.INSTANCE.getDragSource(sourcePackageList); dragSource.addDragListener(new DragSourceAdapter() { public void dragSetData(DragSourceEvent event) { event.data = formatDataToTransfer(sourcePackageList.getSelection()); } private Object formatDataToTransfer(String[] selection) { StringBuffer buffer = new StringBuffer(); for (String field : selection) { buffer.append(field + Constants.DOT + Constants.ASTERISK + SWT.SPACE + Constants.DASH + SWT.SPACE + comboJarList.getItem(comboJarList.getSelectionIndex()) + Constants.FIELD_SEPRATOR_FOR_DRAG_DROP); } return buffer.toString(); } }); }
@Override public void attachWidget(Composite container) { defaultELTcom = new Combo(container, SWT.READ_ONLY); defaultELTcom.setItems(defaultTextMessage); // defaultELTcom.setItems(new String[] {"True","false"}); // defaultELTcom.setItem(0, ""); GridData gd_defaultELTTextBox = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); if (OSValidator.isMac()) { gd_defaultELTTextBox.horizontalIndent=-1; gd_defaultELTTextBox.widthHint = textboxWidth+50; } else{ gd_defaultELTTextBox.horizontalIndent=1; gd_defaultELTTextBox.widthHint = textboxWidth; } defaultELTcom.setLayoutData(gd_defaultELTTextBox); widget = defaultELTcom; }
/** * @param isParam * @param isWholeOperationParameter */ private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam, boolean isWholeOperationParameter) { if (isWholeOperationParameter) { Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR); Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR); Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES); Button button =(Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON1); button.setEnabled(false); textAccumulator.setEnabled(false); isParamAccumulator.setEnabled(false); comboDataTypes.setEnabled(false); super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter); } }
private void addModifyListenerToComboDataTypes(Combo combo,final AbstractExpressionComposite expressionComposite,MappingSheetRow mappingSheetRow) { combo.addModifyListener(new ModifyListener(){ @Override public void modifyText(ModifyEvent e) { Combo accumulatorDataType =(Combo)e.widget; mappingSheetRow.setComboDataType( accumulatorDataType.getText()); boolean isValidValue = validate(expressionComposite.getTextAccumulator().getText(),accumulatorDataType.getText()); if(!isValidValue){ expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,000)); }else{ expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255)); } showHideValidationMessage(); } }); }
@Override public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) { final Widget[] widgetList = widgets; if (helper != null) { txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION); } Listener listener = new Listener() { @Override public void handleEvent(Event event) { if (((Combo) widgetList[0]).getText().equals("Parameter") || ((Combo) widgetList[0]).getText().equals("Others")) { ((Text) widgetList[1]).setVisible(true); ((Text) widgetList[1]).setFocus(); txtDecorator.hide(); } else { ((Text) widgetList[1]).setVisible(false); txtDecorator.hide(); } propertyDialogButtonBar.enableApplyButton(true); } }; return listener; }
@Override public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) { final Widget[] widgetList = widgets; if (helpers != null) { widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG); } Listener listener=new Listener() { @Override public void handleEvent(Event event) { String comboValue = ((Combo) widgetList[0]).getText(); if (comboValue.equals(Messages.CUSTOM)) { FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig); if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog) { OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL); operationClassDialog.getShell().setFocus(); } propertyDialogButtonBar.enableApplyButton(true); } } }; return listener; }
@Override public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) { final Widget[] widgetList = widgets; Listener listener = new Listener() { @Override public void handleEvent(Event event) { if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION | SWT.OK); messageBox.setText(INFORMATION); messageBox.setMessage("All files at given location will be overwritten."); messageBox.open(); } } }; return listener; }
private void addVersionSection(Composite parent) { Composite composite = createDefaultComposite(parent); // Label for owner field Label ownerLabel = new Label(composite, SWT.NONE); ownerLabel.setText(LEGACY_VERSION_TITLE); // Owner text field legacyVersionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); GridData gd = new GridData(); gd.widthHint = convertWidthInCharsToPixels(COMBO_FIELD_WIDTH); legacyVersionCombo.setLayoutData(gd); // Populate owner text field LegacyVersion legacyVersion = LegacyManager.getInstance().getVersion(getProject()); legacyVersionCombo.setItems(LegacyVersion.names()); legacyVersionCombo.setText(legacyVersion.name()); }
public IntListParameter(Composite composite, final String name, int defaultValue, final String labels[], final int values[]) { super(name); this.name = name; this.values = values; if(labels.length != values.length) return; int value = COConfigurationManager.getIntParameter(name,defaultValue); int index = findIndex(value,values); list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY); for(int i = 0 ; i < labels.length ;i++) { list.add(labels[i]); } setIndex(index); list.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { setIndex(list.getSelectionIndex()); } }); }
protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); RowLayout layout = new RowLayout(SWT.HORIZONTAL); container.setLayout(layout); // container.setLayoutData(new GridData(GridData.FILL_BOTH)); // TitleArea中的Title setTitle("属性文件更新"); // TitleArea中的Message setMessage("输入正确的url地址,以更新文件。\n可提示的属性数量会根据当前项目存在的jar包,对已有属性增加或者删除!"); Label label = new Label(container, SWT.NONE); label.setText("项目URL: "); combo = new Combo(container, SWT.DROP_DOWN); String[] items = new String[getUrlMap().size()]; getUrlMap().values().toArray(items); combo.setItems(items); String url = getPreferedUrl(projectName); combo.setText(url); combo.setLayoutData(new RowData(400, 30)); return area; }
private void addRefCombovalues(Combo combo, String paramType) { if(!PrimitiveType.isPrimitiveSig(paramType)) { combo.add("null"); IType owner = (IType) method.getParent(); try { IField[] fields = owner.getFields(); for(IField f : fields) if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType)) combo.add(f.getElementName()); } catch (JavaModelException e1) { e1.printStackTrace(); } } }
private void addCacheValues(Combo[] combos) { String key = getMethodKey(method); List<List<String>> list = cache.get(key); if(list != null) { assert list.size() == combos.length; for(int i = 0; i < combos.length; i++) { List<String> values = list.get(i); for(String v : values) if(!containsItem(combos[i], v)) combos[i].add(v); if(values.size() > 0) combos[i].select(combos[i].getItemCount()-1); else if(combos[i].getItemCount() > 0) combos[i].select(0); } } else { for(Combo combo : combos) { int n = combo.getItemCount(); if(n > 0) combo.select(n-1); } } }
private boolean validValue(String val, String pType, Combo combo) { try { if(pType.equals(String.class.getSimpleName())) return val.matches("(\"(.)*\")|null"); else if(pType.equals(char.class.getName())) return val.matches("'.'"); else if(pType.equals(boolean.class.getName())) return val.matches("true|false"); else if(pType.equals(byte.class.getName())) Byte.parseByte(val); else if(pType.equals(short.class.getName())) Short.parseShort(val); else if(pType.equals(int.class.getName())) Integer.parseInt(val); else if(pType.equals(long.class.getName())) Long.parseLong(val); else if(pType.equals(float.class.getName())) Float.parseFloat(val); else if(pType.equals(double.class.getName())) Double.parseDouble(val); else if(pType.equals(int.class.getName() + "[]")) return val.matches(regexIntArray); else if(pType.equals(double.class.getName() + "[]")) return val.matches(regexDoubleArray); else if(pType.equals(boolean.class.getName() + "[]")) return val.matches(regexBooleanArray); else if(pType.equals(char.class.getName() + "[]")) return val.matches(regexCharArray); // else if(pType.equals(int.class.getName() + "[][]")) return val.matches(regexIntMatrix); else return false; } catch(RuntimeException e) { return false; } return true; }
private void addCombovalues(Combo combo, String paramType) { if(!PrimitiveType.isPrimitiveSig(paramType)) { String sel = combo.getText(); combo.removeAll(); combo.add("null"); IType owner = (IType) method.getParent(); try { IField[] fields = owner.getFields(); for(IField f : fields) if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType)) combo.add(f.getElementName()); } catch (JavaModelException e1) { e1.printStackTrace(); } if(sel.isEmpty()) combo.select(0); else combo.setText(sel); } }
private void createNgCommandComponent(Composite parent) { Group group = new Group(parent, SWT.NONE); String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_command; group.setText(groupName); GridLayout layout = new GridLayout(); layout.numColumns = 1; GridData gridData = new GridData(GridData.FILL_HORIZONTAL); group.setLayout(layout); group.setLayoutData(gridData); commandsCommbo = new Combo(group, SWT.BORDER | SWT.H_SCROLL); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; commandsCommbo.setLayoutData(data); String[] items = new String[NgCommand.values().length]; for (int i = 0; i < items.length; i++) { items[i] = NgCommand.values()[i].getAliases()[0]; } commandsCommbo.setItems(items); commandsCommbo.addModifyListener(fListener); }
@SuppressWarnings("unchecked") private void reloadChannelCombo(Combo combo, List<Integer> channels, int selected, String valueKey){ if(!(combo.getData() instanceof List) || isDifferentList(channels, (List<Integer>) combo.getData())){ combo.removeAll(); combo.setData(channels); for( int i = 0 ; i < channels.size() ; i ++ ){ combo.add(TuxGuitar.getProperty(valueKey, new String[]{channels.get(i).toString()})); } } for( int i = 0 ; i < channels.size() ; i ++ ){ Integer channel = (Integer)channels.get(i); if( channel.intValue() == selected ){ combo.select( i ); } } }
private Composite createTreeOptionsComposite() { final Composite composite = new Composite(optionsComposite, SWT.NONE); SWTUtil.gridLayout(composite, 2, false, 0, 8); final Label label2 = new Label(composite, SWT.DROP_DOWN); label2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); label2.setText(Messages.getString("QueryEditorControl.TreeTypeLabelText")); //$NON-NLS-1$ final Combo combo = new Combo(composite, SWT.NONE); combo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1)); AutomationIDHelper.setWidgetID(combo, TYPEOFTREE_COMBO_ID); populateTreeOptionsCombo(combo, query.getTreeQueryLinkType()); return composite; }
/** * Populates the combo with the specified values. The specified initial * value is set as the initial selection it it appears in the array of * values, otherwise the first value is selected. * * @param combo * The combo to populate. * * @param values * The values for the combo drop down. * * @param initialValue * The value which should be the initial selected value. * * @return The index of the selected item. */ public static int populateCombo(final Combo combo, final String[] values, final String initialValue) { Check.notNull(combo, "combo"); //$NON-NLS-1$ Check.notNull(values, "values"); //$NON-NLS-1$ if (values.length == 0) { return -1; } int selectedIndex = 0; for (int i = 0; i < values.length; i++) { final String value = values[i]; if (value.equals(initialValue)) { selectedIndex = i; } combo.add(value); } combo.select(selectedIndex); setVisibleItemCount(combo); return selectedIndex; }
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); } }
public static void addSelectionListener(Widget w, SelectionListener l) { if (w instanceof MenuItem) addSelectionListener((MenuItem) w, l); else if (w instanceof ToolItem) addSelectionListener((ToolItem) w, l); else if (w instanceof Button) addSelectionListener((Button) w, l); else if (w instanceof DropDownToolItem) { addSelectionListener((DropDownToolItem) w, l); } else if (w instanceof CTabFolder) { addSelectionListener((CTabFolder) w, l); } else if (w instanceof Combo){ addSelectionListener((Combo) w, l); } else throw new RuntimeException("Widget type not supported for selection events: " + w); }
@Override public void runWithEvent(Event event) { Shell shell = getActiveWorkbenchShell(); if (shell != null) { String sel = null; if (event.widget instanceof Combo) { Combo combo = (Combo) event.widget; sel = combo.getText(); Point selection = combo.getSelection(); sel = sel.substring(selection.x, selection.y); } else if (event.widget instanceof Text) { Text text = (Text) event.widget; sel = text.getSelectionText(); } if (sel != null) { if (sel.length() > 0) { copyToClipboard(sel, shell); } return; } } run(); }
public ComboBox(Composite composite, String message, String [] options, String[] commentTemplates) { fMessage= message; fComments= options; fCommentTemplates = commentTemplates; fCombo = new Combo(composite, SWT.READ_ONLY); fCombo.setLayoutData(SWTUtils.createHFillGridData()); fCombo.setVisibleItemCount(20); // populate the previous comment list populateList(); // We don't want to have an initial selection // (see bug 32078: http://bugs.eclipse.org/bugs/show_bug.cgi?id=32078) fCombo.addFocusListener(this); fCombo.addSelectionListener(this); }
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); }
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)); } }); }
/** * Creates the additional controls of the page. * @param parent parent component */ private void addInverseChooser(Composite parent) { Label label = new Label(parent, SWT.LEFT); label.setText(TexlipsePlugin.getResourceString("preferenceViewerInverseLabel")); label.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip")); label.setLayoutData(new GridData()); String[] list = new String[] { TexlipsePlugin.getResourceString("preferenceViewerInverseSearchNo"), TexlipsePlugin.getResourceString("preferenceViewerInverseSearchRun"), TexlipsePlugin.getResourceString("preferenceViewerInverseSearchStd") }; // find out which option to choose by default int index = inverseSearchValues.length - 1; for (; index > 0 && !inverseSearchValues[index].equals(registry.getInverse()); index--) {} inverseChooser = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); inverseChooser.setLayoutData(new GridData()); inverseChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip")); inverseChooser.setItems(list); inverseChooser.select(index); }
@Override protected void createWidgets(String text, String toolTip, String initialValue) { lbl = new Label(this, SWT.NONE); lbl.setText(text.concat(":")); lbl.setToolTipText(toolTip); comboBox = new Combo(this, SWT.READ_ONLY); comboBox.setToolTipText(toolTip); errorIcon = new Label(this, SWT.NONE); errorIcon.setImage(Icon.getImage(Icon.EXCLAMATION_RED)); errorIcon.setVisible(false); comboBox.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String value = comboBox.getText(); if (value != getValue()) { setValue(comboBox.getText(), true); } } }); }
void init() { // this.setLayout(new GridLayout(2, false)); this.setLayout(new FillLayout()); day = new Combo(this, SWT.READ_ONLY); for (int i=1; i<=31; ++i) day.add(""+i); day.select(0); day.pack(); // day.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); month = new Combo(this, SWT.READ_ONLY); for (int i=1; i<=12; ++i) month.add(""+i); month.select(0); month.pack(); // month.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); year = new StyledText(this, SWT.SINGLE | SWT.CENTER | SWT.LEFT | SWT.BORDER); year.setText("2000"); // year.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.pack(); addListener(); }
@SuppressWarnings("unchecked") private void reloadChannelCombo(Combo combo, List<Integer> channels, int selected, String valueKey){ if(!(combo.getData() instanceof List) || isDifferentList(channels, (List<Integer>)combo.getData())){ combo.removeAll(); combo.setData(channels); for( int i = 0 ; i < channels.size() ; i ++ ){ combo.add(TuxGuitar.getProperty(valueKey, new String[]{channels.get(i).toString()})); } } for( int i = 0 ; i < channels.size() ; i ++ ){ Integer channel = (Integer)channels.get(i); if( channel.intValue() == selected ){ combo.select( i ); } } }
/** * Create the export destination specification widgets */ protected void createDestinationGroup(Composite parent) { Font font = parent.getFont(); // destination specification group Composite destinationSelectionGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; destinationSelectionGroup.setLayout(layout); destinationSelectionGroup.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); destinationSelectionGroup.setFont(font); Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE); destinationLabel.setText(getTargetLabel()); destinationLabel.setFont(font); // destination name entry field destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER); destinationNameField.addListener(SWT.Modify, this); destinationNameField.addListener(SWT.Selection, this); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; destinationNameField.setLayoutData(data); destinationNameField.setFont(font); // destination browse button destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH); destinationBrowseButton.setText(N4ExportMessages.DataTransfer_browse); destinationBrowseButton.addListener(SWT.Selection, this); destinationBrowseButton.setFont(font); setButtonLayoutData(destinationBrowseButton); // new Label(parent, SWT.NONE); // vertical spacer }
@Override protected void createOptionsGroupButtons(Group optionsGroup) { npmGoalSelection = new Combo(optionsGroup, SWT.SINGLE | SWT.BORDER); npmGoalSelection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); npmGoalSelection.addListener(SWT.Modify, this); npmGoalSelection.addListener(SWT.Selection, this); }
private void addSecondSection(Composite parent, Preferences prefs) { Composite composite = createDefaultComposite(parent); // Label for owner field Label ownerLabel = new Label(composite, SWT.NONE); ownerLabel.setText(MINIFIER_TITLE); // Create a single-selection list selection = new Combo(composite, SWT.READ_ONLY); // Add the items, one by one for (int i = 0; i < options()[0].length; i++) { selection.add(options()[1][i]); } selection.setText(options()[1][0]); // Set current selection String minifier = prefs.get(preferenceKey(MinifyBuilder.MINIFIER), MinifyBuilder.DONT_MINIFY); if (!minifier.equals(MinifyBuilder.DONT_MINIFY)) { for (int i = 0; i < options()[0].length; i++) { if (minifier.equals(options()[0][i])) { selection.setText(options()[1][i]); break; } } } }
/*** * Create the Field where user enters the language used to execute * * @param parent container composite * @param font used font * @return the created composite containing the fields */ public Composite createLanguageLayout(Composite parent, Font font) { // Language createTextLabelLayout(parent, "Melange languages"); _languageCombo = new Combo(parent, SWT.NONE); _languageCombo.setLayoutData(createStandardLayout()); List<String> languagesNames = MelangeHelper.getAllLanguages(); String[] empty = {}; _languageCombo.setItems(languagesNames.toArray(empty)); _languageCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //String selection = _languageCombo.getText(); //List<String> modelTypeNames = MelangeHelper.getModelTypes(selection); updateLaunchConfigurationDialog(); } }); createTextLabelLayout(parent, ""); createTextLabelLayout(parent, "Melange resource adapter query"); _melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER); _melangeQueryText.setLayoutData(createStandardLayout()); _melangeQueryText.setFont(font); _melangeQueryText.setEditable(false); createTextLabelLayout(parent, ""); return parent; }
private Combo createAttributeCombo () { final Combo c = new Combo ( this, SWT.NONE ); c.add ( "sourceTimestamp" ); //$NON-NLS-1$ c.add ( "entryTimestamp" ); //$NON-NLS-1$ for ( final Event.Fields field : Event.Fields.values () ) { c.add ( field.getName () ); } c.add ( Messages.custom_field ); c.select ( 0 ); return c; }
private Combo createTypeCombo () { final Combo c = new Combo ( this, SWT.NONE ); for ( final Type type : Type.values () ) { c.add ( type.name () ); } c.select ( 0 ); return c; }
/** * This method initializes type_trigger_combo * */ private void createType_trigger_combo() { GridData gridData2 = new GridData(); gridData2.horizontalAlignment = GridData.FILL; gridData2.verticalAlignment = GridData.CENTER; gridData2.grabExcessHorizontalSpace = true; type_trigger_combo = new Combo(commun_trigger, SWT.READ_ONLY); type_trigger_combo.setItems(customTriggers); type_trigger_combo .addModifyListener(new org.eclipse.swt.events.ModifyListener() { public void modifyText(org.eclipse.swt.events.ModifyEvent e) { int index = type_trigger_combo.getSelectionIndex(); if (index == -1) { type_trigger_combo.select(0); } else if (index != last_index && custom_triggers != null) { help_label.setText(custom_triggers[index].getHelp()); stackLayout.topControl = custom_triggers[index]; custom_trigger.layout(); last_index = index; if (index == 5) { // NoWait case timeout_label.setVisible(false); timeout_spin.setVisible(false); } else { timeout_label.setVisible(true); timeout_spin.setVisible(true); } } } }); type_trigger_combo.setLayoutData(gridData2); }