List of usage examples for org.eclipse.jface.viewers ComboViewer setLabelProvider
@Override public void setLabelProvider(IBaseLabelProvider labelProvider)
Viewer
framework method ensures that the given label provider is an instance of ILabelProvider
. From source file:org.obeonetwork.dsl.spem.gen.doc.wizard.Gendoc2WizardPage.java
License:Open Source License
/** * this method make all initialization of content of the comboviewer * /*w w w . j a va 2s .com*/ * @param comboViewer */ private void manageCombo(ComboViewer comboViewer) { comboViewer.setContentProvider(new IStructuredContentProvider() { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public void dispose() { } public Object[] getElements(Object inputElement) { if (inputElement instanceof IGendoc2Runner) { IGendoc2Runner runner = (IGendoc2Runner) inputElement; return runner.getGendoc2Templates().toArray(); } return null; } }); comboViewer.setLabelProvider(new ILabelProvider() { public void removeListener(ILabelProviderListener listener) { } public boolean isLabelProperty(Object element, String property) { return true; } public void dispose() { } public void addListener(ILabelProviderListener listener) { } public Image getImage(Object element) { return null; } public String getText(Object element) { if (element instanceof IGendoc2Template) { return ((IGendoc2Template) element).getOutPutExtension(); } else { return null; } } }); IGendoc2Runner selectedRunner = getSelectedRunner(); if (selectedRunner != null) { comboViewer.setInput(getSelectedRunner()); } combo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getGWizard().refresh(); } }); if (combo.getItemCount() > 0) { combo.select(0); } }
From source file:org.objectstyle.wolips.eomodeler.editors.entity.EOEntityStoredProceduresEditorSection.java
License:Open Source License
protected ComboViewer createStoredProcedureComboViewer(Composite _parent, String _name) { getWidgetFactory().createCLabel(_parent, Messages.getString("EOEntity." + _name), SWT.NONE); Combo insertCombo = new Combo(_parent, SWT.BORDER | SWT.FLAT | SWT.READ_ONLY); ComboViewer comboViewer = new ComboViewer(insertCombo); comboViewer.setLabelProvider(new EOStoredProceduresLabelProvider()); comboViewer.setContentProvider(new EOStoredProceduresListContentProvider(true)); GridData comboLayoutData = new GridData(GridData.FILL_HORIZONTAL); insertCombo.setLayoutData(comboLayoutData); return comboViewer; }
From source file:org.ow2.petals.client.swt.dialogs.NewWsdlOperationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { getShell().setText("New WSDL Operation"); setTitle("New WSDL Operation"); setMessage("Create a custom WSDL operation."); Composite container = new Composite(parent, SWT.NONE); container.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); // Local Part Label l = new Label(container, SWT.NONE); l.setText("Operation Name:"); l.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); Text text = new Text(container, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (this.localPart != null) text.setText(this.localPart); text.addModifyListener(new ModifyListener() { @Override//w ww .j av a2 s .c o m public void modifyText(ModifyEvent e) { NewWsdlOperationDialog.this.localPart = ((Text) e.widget).getText(); validate(); } }); // Name space URI l = new Label(container, SWT.NONE); l.setText("Operation Namespace:"); l.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); text = new Text(container, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (this.namespaceUri != null) text.setText(this.namespaceUri); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { NewWsdlOperationDialog.this.namespaceUri = ((Text) e.widget).getText(); validate(); } }); // MEP l = new Label(container, SWT.NONE); l.setText("MEP:"); l.setToolTipText("Message Exchange Pattern"); l.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); final ComboViewer mepViewer = new ComboViewer(container, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN); mepViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mepViewer.setContentProvider(new ArrayContentProvider()); mepViewer.setLabelProvider(new LabelProvider()); mepViewer.setInput(Mep.values()); mepViewer.setSelection(new StructuredSelection(this.mep)); mepViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { NewWsdlOperationDialog.this.mep = (Mep) ((IStructuredSelection) mepViewer.getSelection()) .getFirstElement(); validate(); } }); return container; }
From source file:org.ow2.petals.client.swt.tabs.PreferencesTab.java
License:Open Source License
/** * Constructor./* ww w .j a v a 2s .c o m*/ * @param parent * @param clientApp */ public PreferencesTab(Composite parent, final ClientApplication clientApp) { // Root elements super(parent, SWT.NONE); GridLayoutFactory.swtDefaults().spacing(0, 0).applyTo(this); setLayoutData(new GridData(GridData.FILL_BOTH)); final ColorCacheManager colorManager = clientApp.getColorManager(); new Label(this, SWT.NONE).setText("The preferences for this client application."); // History Composite historyGroup = createSection("History", 4, false); Label l = new Label(historyGroup, SWT.NONE); l.setText("History Directory:"); l.setToolTipText("The directory in which old requests are stored"); final Text directoryText = new Text(historyGroup, SWT.BORDER | SWT.READ_ONLY); directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); directoryText.setText(PreferencesManager.INSTANCE.getHistoryDirectory().getAbsolutePath()); Button browseButton = new Button(historyGroup, SWT.PUSH); browseButton.setText("Browse..."); browseButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { DirectoryDialog dlg = new DirectoryDialog(getShell()); String dir = dlg.open(); if (dir != null) { PreferencesManager.INSTANCE.saveHistoryDirectory(new File(dir)); directoryText.setText(dir); clientApp.refreshHistory(); } } }); Button resetHistoryDirButton = new Button(historyGroup, SWT.PUSH); resetHistoryDirButton.setText("Reset Default Directory"); resetHistoryDirButton.setToolTipText("Set the history directory in the temporary files"); resetHistoryDirButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { PreferencesManager.INSTANCE.saveHistoryDirectory(null); File f = PreferencesManager.INSTANCE.getHistoryDirectory(); directoryText.setText(f.getAbsolutePath()); clientApp.refreshHistory(); } }); // Clear the history? new Label(historyGroup, SWT.NONE); Link link = new Link(historyGroup, SWT.NONE); link.setText("<A>Clear All the History</A>"); link.setToolTipText("Deletes the entire history"); GridDataFactory.swtDefaults().span(3, 1).applyTo(link); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { SwtUtils.clearHistoryWithProgressBar(getShell(), -1, clientApp); } }); new Label(historyGroup, SWT.NONE); link = new Link(historyGroup, SWT.NONE); link.setText("<A>Clear the History older than...</A>"); link.setToolTipText("Deletes the oldest part of the history"); link.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { ClearHistoryDialog dlg = new ClearHistoryDialog(getShell()); if (dlg.open() == Window.OK) { SwtUtils.clearHistoryWithProgressBar(getShell(), dlg.getDays(), clientApp); clientApp.refreshHistory(); } } }); // General Preferences Composite defaultGroup = createSection("General Preferences", 2, false); Button wrapButton = new Button(defaultGroup, SWT.CHECK); wrapButton.setText("Wrap text in XML viewers"); wrapButton.setToolTipText("Will allow XML viewers to wrap their content instead of only scrolling"); wrapButton.setSelection(PreferencesManager.INSTANCE.wrapInsteadOfScrolling()); GridDataFactory.swtDefaults().span(2, 1).applyTo(wrapButton); wrapButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { boolean wrap = ((Button) e.widget).getSelection(); PreferencesManager.INSTANCE.saveWrapInsteadOfScrolling(wrap); MessageDialog.openInformation(getShell(), "Restart", "The user interface needs to be restarted to take this preference into account.\n" + "Save your work and then go into \"File > Restart the User Interface\"."); } }); l = new Label(defaultGroup, SWT.NONE); l.setText("Default Timeout:"); l.setToolTipText("The default timeout to use when crating a new request"); Spinner timeoutSpinner = new Spinner(defaultGroup, SWT.BORDER); long value = PreferencesManager.INSTANCE.getDefaultTimeout(); timeoutSpinner.setValues((int) value, 0, Integer.MAX_VALUE, 0, 1000, 100); // Syntax highlighting Composite shGroup = createSection("Syntax Highlighting", 2, true); l = new Label(shGroup, SWT.NONE); l.setText("XML Viewers Preview"); GridDataFactory.swtDefaults().span(2, 1).applyTo(l); final Map<XmlRegionType, String> regionToLabel = new LinkedHashMap<XmlRegionType, String>(); regionToLabel.put(XmlRegionType.MARKUP, "XML Mark-ups"); regionToLabel.put(XmlRegionType.ATTRIBUTE, "XML Attributes"); regionToLabel.put(XmlRegionType.ATTRIBUTE_VALUE, "Attribute Values"); regionToLabel.put(XmlRegionType.COMMENT, "XML Comments"); regionToLabel.put(XmlRegionType.CDATA, "CDATA Sections"); regionToLabel.put(XmlRegionType.INSTRUCTION, "XML Instructions"); // Show a preview area final StyledText previewStyledText = SwtUtils.createXmlViewer(shGroup, colorManager, false); try { String previewText = Utils.loadResource("/sample.xml"); previewStyledText.setText(previewText); } catch (IOException e1) { clientApp.log("An error occurred while loading a request file.", e1, Level.INFO); } // List the customizable elements... Composite subContainer = new Composite(shGroup, SWT.NONE); GridLayoutFactory.swtDefaults().margins(10, 0).numColumns(2).applyTo(subContainer); GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.BEGINNING).grab(false, true).applyTo(subContainer); new Label(subContainer, SWT.NONE).setText("Select the style to edit:"); final ComboViewer styleViewer = new ComboViewer(subContainer, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); styleViewer.setContentProvider(new ArrayContentProvider()); styleViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return regionToLabel.get(element); }; }); GridDataFactory.swtDefaults().hint(200, SWT.DEFAULT).applyTo(styleViewer.getCombo()); styleViewer.setInput(regionToLabel.keySet()); // ... and their properties final List<Button> styleButtons = new ArrayList<Button>(); new Label(subContainer, SWT.NONE); Button b = new Button(subContainer, SWT.CHECK); b.setText("Bold"); b.setData(PreferencesManager.BOLD); styleButtons.add(b); new Label(subContainer, SWT.NONE); b = new Button(subContainer, SWT.CHECK); b.setText("Italic"); b.setData(PreferencesManager.ITALIC); styleButtons.add(b); new Label(subContainer, SWT.NONE); b = new Button(subContainer, SWT.CHECK); b.setText("Underline"); b.setData(PreferencesManager.UNDERLINE); styleButtons.add(b); new Label(subContainer, SWT.NONE); Composite colorComposite = new Composite(subContainer, SWT.NONE); GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).applyTo(colorComposite); new Label(colorComposite, SWT.NONE).setText("Foreground Color:"); final ColorSelector colorSelector = new ColorSelector(colorComposite); new Label(subContainer, SWT.NONE); b = new Button(subContainer, SWT.PUSH); b.setText("Reset All the Settings for this Style"); b.setToolTipText("Resets all the settings for the selected style"); b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); b.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { XmlRegionType xr = (XmlRegionType) ((IStructuredSelection) styleViewer.getSelection()) .getFirstElement(); PreferencesManager.INSTANCE.saveXmlRegionColor(xr, null); colorManager.updateColor(xr); PreferencesManager.INSTANCE.saveXmlRegionStyle(xr, PreferencesManager.BOLD, null); PreferencesManager.INSTANCE.saveXmlRegionStyle(xr, PreferencesManager.ITALIC, null); PreferencesManager.INSTANCE.saveXmlRegionStyle(xr, PreferencesManager.UNDERLINE, null); previewStyledText.notifyListeners(SWT.Modify, new Event()); styleViewer.getCombo().notifyListeners(SWT.Selection, new Event()); } }); // React to selection changes Listener clickListener = new Listener() { @Override public void handleEvent(Event e) { XmlRegionType xr = (XmlRegionType) ((IStructuredSelection) styleViewer.getSelection()) .getFirstElement(); Button b = (Button) e.widget; String name = (String) b.getData(); PreferencesManager.INSTANCE.saveXmlRegionStyle(xr, name, b.getSelection()); previewStyledText.notifyListeners(SWT.Modify, new Event()); } }; for (Button bb : styleButtons) bb.addListener(SWT.Selection, clickListener); styleViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e) { XmlRegionType xr = (XmlRegionType) ((IStructuredSelection) styleViewer.getSelection()) .getFirstElement(); Color c = colorManager.getColor(xr); colorSelector.setColorValue(c.getRGB()); for (Button b : styleButtons) { String name = (String) b.getData(); b.setSelection(PreferencesManager.INSTANCE.getXmlRegionStyle(xr, name)); } } }); colorSelector.addListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if (!ColorSelector.PROP_COLORCHANGE.equals(e.getProperty())) return; XmlRegionType xr = (XmlRegionType) ((IStructuredSelection) styleViewer.getSelection()) .getFirstElement(); RGB rgb = (RGB) e.getNewValue(); PreferencesManager.INSTANCE.saveXmlRegionColor(xr, rgb); colorManager.updateColor(xr); previewStyledText.notifyListeners(SWT.Modify, new Event()); } }); // Initial selection styleViewer.getCombo().select(0); styleViewer.getCombo().notifyListeners(SWT.Selection, new Event()); }
From source file:org.polarsys.reqcycle.export.pages.RequirementSourceSelectionPage.java
License:Open Source License
/** * Create contents of the wizard./*from ww w . ja v a2s . c om*/ * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(1, false)); Group grpDataSource = new Group(composite, SWT.NONE); grpDataSource.setLayout(new GridLayout(1, false)); grpDataSource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpDataSource.setText("Data Sources"); reqSourceTableViewer = CheckboxTableViewer.newCheckList(grpDataSource, SWT.BORDER | SWT.FULL_SELECTION); reqSourceTableViewer.setLabelProvider(new RequirementSourceLabelProvider()); reqSourceTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); reqSourceTableViewer.setInput(requirementSourceManager.getRequirementSources()); table = reqSourceTableViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); reqSourceTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } else { controller.removeReqProvider( new RequirementSourceReqProvider((RequirementSource) event.getElement())); } getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); Group grpScope = new Group(composite, SWT.NONE); grpScope.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); grpScope.setText("Scopes"); grpScope.setLayout(new GridLayout(2, false)); Label lblDataModel = new Label(grpScope, SWT.NONE); lblDataModel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDataModel.setText("Data Model :"); ComboViewer modelComboViewer = new ComboViewer(grpScope, SWT.READ_ONLY); Combo combo = modelComboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); modelComboViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); modelComboViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IDataModel) { return ((IDataModel) element).getName(); } return ""; } }); modelComboViewer.setInput(dataManager.getCurrentDataModels()); modelComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object firstElement = ((IStructuredSelection) selection).getFirstElement(); if (firstElement instanceof IDataModel) { IDataModel selectedDataModel = (IDataModel) firstElement; if (selectedDataModel != dataModel) { dataModel = selectedDataModel; setScopes(dataManager.getScopes(dataModel)); } } } } }); reqScopeTableViewer = CheckboxTableViewer.newCheckList(grpScope, SWT.BORDER | SWT.FULL_SELECTION); reqScopeTableViewer.setContentProvider(ProviderUtils.getArrayContentProvider()); reqScopeTableViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof Scope) { return ((Scope) element).getName(); } return "a"; } }); reqScopeTableViewer.setInput(scopes); reqScopeTableViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { controller.addReqProvider(new ScopeReqProvider((Scope) event.getElement())); } else { controller.removeReqProvider(new ScopeReqProvider((Scope) event.getElement())); } getWizard().getContainer().updateButtons(); getWizard().getContainer().updateMessage(); } }); table_1 = reqScopeTableViewer.getTable(); table_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); for (RequirementSource s : selectedSources) { reqSourceTableViewer.setChecked(s, true); } doCreateGroup(composite); }
From source file:org.polarsys.reqcycle.repository.data.util.EntryUtil.java
License:Open Source License
public static ComboViewer createComboViewer(Composite composite, String attributeName, Object input) { composite.setLayout(new GridLayout(3, false)); Label label = new Label(composite, SWT.None); label.setText(attributeName);//from ww w . j a va 2 s .c om final ComboViewer comboViewer = new ComboViewer(composite); Combo combo = comboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); final LabelProvider labelProvider = new LabelProvider() { @Override public String getText(Object element) { if (Platform.getAdapterManager().hasAdapter(element, String.class.getName())) { Object adapter = Platform.getAdapterManager().getAdapter(element, String.class); if (adapter instanceof String) { return ((String) adapter); } } return super.getText(element); } }; comboViewer.setLabelProvider(labelProvider); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setInput(input); comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object firstElement = ((IStructuredSelection) selection).getFirstElement(); if (firstElement instanceof IDataModel || firstElement instanceof IRequirementType || firstElement instanceof Scope) { comboViewer.setData(AN_ENTRY, labelProvider.getText(firstElement)); } else { comboViewer.setData(AN_ENTRY, null); } } } }); Button clearCombo = new Button(composite, SWT.PUSH); clearCombo.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false)); clearCombo.setImage(Activator.getImageDescriptor(CLEAR_IMG_PATH).createImage()); clearCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (comboViewer != null) { comboViewer.setSelection(StructuredSelection.EMPTY); } } }); return comboViewer; }
From source file:org.python.pydev.refactoring.ui.pages.ConstructorFieldPage.java
License:Open Source License
private ComboViewer createComboViewer(Composite comboComp) { ComboViewer v = new ComboViewer(comboComp); v.setContentProvider(this.strategyProvider); v.setLabelProvider(new LabelProvider()); v.setInput(""); return v;//from w w w. j a v a2 s . com }
From source file:org.raspinloop.pi4j.io.components.SimulatedStepperMotorPropertiesPage.java
License:Open Source License
public void createControl(Composite p) { // create a composite with standard margins and spacing Composite composite = new Composite(p, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/* www . j av a2s . c o m*/ composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); addLabel(composite, "Stepper Motor Name"); fHWName = addText(composite); addLabel(composite, "Step by Rotation"); fHWStepsPerRotation = new Spinner(composite, SWT.NONE); fHWStepsPerRotation.setDigits(0); fHWStepsPerRotation.setMinimum(0); fHWStepsPerRotation.setMaximum(400); fHWStepsPerRotation.setIncrement(1); fHWStepsPerRotation.setSelection(200); addLabel(composite, "Initial Position ()"); fHWInitialPosition = new Spinner(composite, SWT.NONE); fHWInitialPosition.setDigits(1); fHWInitialPosition.setMinimum(0); fHWInitialPosition.setMaximum(3600); fHWInitialPosition.setIncrement(1); fHWInitialPosition.setSelection(72); addLabel(composite, "Holding Torque (N.m)"); fHWHoldingTorque = new Spinner(composite, SWT.NONE); fHWHoldingTorque.setDigits(2); fHWHoldingTorque.setMinimum(0); fHWHoldingTorque.setMaximum(10000); fHWHoldingTorque.setIncrement(1); fHWHoldingTorque.setSelection(44); addLabel(composite, "ON state"); fHWOnState = new Combo(composite, SWT.READ_ONLY); fHWOnState.setItems(new String[] { PinState.HIGH.toString(), PinState.LOW.toString() }); addLabel(composite, "Connected Pin"); ArrayList<Pin> usablePins = new ArrayList<Pin>(fHW.getParentComponent().getUnUsedPins()); usablePins.addAll(fHW.getUsedPins()); Composite pinBlockComposite = new Composite(composite, SWT.NONE); GridLayout pinBlockLayout = new GridLayout(); pinBlockLayout.numColumns = 4; pinBlockLayout.marginLeft = 0; pinBlockComposite.setLayout(pinBlockLayout); pinBlockComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); AvaillablePinProvider availablePinProvider = new AvaillablePinProvider(); PinLabelProvider pinLableProvider = new PinLabelProvider(); for (int i = 0; i < fHWPins.length; i++) { ComboViewer hWPin = new ComboViewer(pinBlockComposite, SWT.READ_ONLY); hWPin.setContentProvider(availablePinProvider); hWPin.setLabelProvider(pinLableProvider); hWPin.setInput(usablePins); fHWPins[i] = hWPin; } // add the listeners now to prevent them from monkeying with initialized // settings fHWName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { nameChanged(fHWName.getText()); } }); Dialog.applyDialogFont(composite); setControl(composite); initializeFields(); }
From source file:org.salever.swtjface.demo.cv.ComboViewerDlg.java
License:Open Source License
/** * Create contents of the dialog./*from ww w .j a v a2 s . com*/ * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); ComboViewer comboViewer = new ComboViewer(container, SWT.NONE); Combo combo = comboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboViewer.setContentProvider(new ContentProvider()); comboViewer.setLabelProvider(new ViewerLabelProvider()); return container; }
From source file:org.svenk.redmine.ui.wizard.querypage.RedmineQueryPage.java
License:Open Source License
private void createTextGroup(final Composite parent) { LabelProvider labelProvider = new RedmineLabelProvider(); Collection<SearchField> searchFields = new ArrayList<SearchField>(); for (SearchField searchField : SearchField.values()) { if (searchField.isListType() || searchField.isGeneric()) { continue; }//from ww w .j a v a 2 s . c o m searchFields.add(searchField); Text text = new Text(parent, SWT.BORDER); text.setEnabled(false); txtSearchValues.put(searchField, text); ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN); String defaultValue = searchField.isRequired() ? null : OPERATOR_TITLE; combo.setContentProvider(new RedmineContentProvider(defaultValue)); combo.setLabelProvider(labelProvider); searchOperators.put(searchField, combo); combo.setInput(searchField.getCompareOperators()); combo.setSelection(new StructuredSelection(combo.getElementAt(0))); combo.addSelectionChangedListener( new RedmineCompareOperatorSelectionListener(txtSearchValues.get(searchField))); } RedmineGuiHelper.placeTextElements(parent, searchFields, txtSearchValues, searchOperators); }