List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:com.google.appengine.eclipse.core.properties.ui.GaeProjectPropertyPage.java
License:Open Source License
private void createDatastoreComponent(Composite parent) { Group group = SWTFactory.createGroup(parent, "Datastore", 4, 1, GridData.FILL_HORIZONTAL); group.setLayout(new GridLayout(4, false)); /*/*ww w . j a va 2 s . co m*/ * The group is organised in the form of a table with 4 columns. It looks like the following. * * |-----|--------------------------|-----------|----------------------| * | [x] | Enable local HRD support (spans 2) | Run Configurations...| * |-------------------------------------------------------------------| * | [ ] | Use Datanucleus JDO/JPA to access the datastore (spans 3) | * |-------------------------------------------------------------------| * | => Datanucleus JDO/JPA version | [version] | <empty> | * |-----|--------------------------|-----------|----------------------| */ useHrdCheckbox = new Button(group, SWT.CHECK); GridData useHrdLinkLayout = new GridData(SWT.NONE, SWT.NONE, true, false); useHrdLinkLayout.horizontalSpan = 2; useHrdLink = new Link(group, SWT.NONE); useHrdLink.setLayoutData(useHrdLinkLayout); useHrdLink.setText("Enable local <a href=\"" + APPENGINE_LOCAL_HRD_URL + "\">HRD</a> support"); useHrdLink.setToolTipText(APPENGINE_LOCAL_HRD_URL); useHrdLink.addListener(SWT.Selection, new Listener() { public void handleEvent(Event ev) { BrowserUtilities.launchBrowserAndHandleExceptions(ev.text); } }); Link hrdLink = new Link(group, SWT.NONE); hrdLink.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false, false)); hrdLink.setText("<a href=\"#\">Run Configurations...</a>"); hrdLink.setToolTipText("Runtime HRD parameters can be adjusted per run configuration, in the " + "App Engine options tab."); hrdLink.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { // Open the run configurations dialog and select the WebApp type. ILaunchConfigurationType webAppLaunchType = DebugPlugin.getDefault().getLaunchManager() .getLaunchConfigurationType(WebAppLaunchConfiguration.TYPE_ID); DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), new StructuredSelection(webAppLaunchType), RUN_GROUP_ID); } }); useDatanucleusCheckbox = new Button(group, SWT.CHECK); GridData useDatanucleusLabelLayout = new GridData(SWT.NONE, SWT.NONE, true, false); useDatanucleusLabelLayout.horizontalSpan = 3; useDatanucleusLabel = new Label(group, SWT.NONE); useDatanucleusLabel.setLayoutData(useDatanucleusLabelLayout); useDatanucleusLabel.setText("Use Datanucleus JDO/JPA to access the datastore"); useDatanucleusLabel.setToolTipText("Enabling this option imports the Datanucleus JAR files " + "into your project so that you can use them to access the datastore via JDO/JPA. It will " + "also enable the Datanucleus enhancer to be run automatically. Disable this option if " + "you are not using the datastore at all or if you are not accessing the datastore via " + "JDO/JPA."); GridData datanucleusVersionLabelLayout = new GridData(); datanucleusVersionLabelLayout.horizontalIndent = INDENT_TAB; datanucleusVersionLabelLayout.horizontalSpan = 2; datanucleusVersionLabel = new Label(group, SWT.NONE); datanucleusVersionLabel.setLayoutData(datanucleusVersionLabelLayout); datanucleusVersionLabel.setText("Datanucleus JDO/JPA version:"); datanucleusVersionCombo = new ComboViewer(group, SWT.READ_ONLY); updateDatanucleusVersionComboList(); }
From source file:com.google.devtools.depan.nodes.filters.eclipse.ui.widgets.ComposeModeControl.java
License:Apache License
public ComposeModeControl(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(CONTROL_LABEL_PROVIDER); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override/*from w w w.j a va2s. c o m*/ public String getString(Object object) { return CONTROL_LABEL_PROVIDER.getText(object); } })); viewer.setInput(ComposeMode.values()); listener = new ControlSelectionChangedListener(); viewer.addSelectionChangedListener(listener); }
From source file:com.google.devtools.depan.nodes.filters.eclipse.ui.widgets.ContextValueControl.java
License:Apache License
public ContextValueControl(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(CONTROL_LABEL_PROVIDER); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override//w w w. j a v a2 s. c o m public String getString(Object object) { return CONTROL_LABEL_PROVIDER.getText(object); } })); viewer.setInput(ContextKey.Base.values()); listener = new ControlSelectionChangedListener(); viewer.addSelectionChangedListener(listener); }
From source file:com.google.devtools.depan.platform.eclipse.ui.widgets.MapChoiceControl.java
License:Apache License
public MapChoiceControl(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT); viewer.setContentProvider(new ControlContentProvider()); viewer.setLabelProvider(CONTROL_LABEL_PROVIDER); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override//from w w w. ja v a2 s.com public String getString(Object object) { return CONTROL_LABEL_PROVIDER.getText(object); } })); listener = new ControlSelectionChangedListener(); viewer.addSelectionChangedListener(listener); }
From source file:com.google.devtools.depan.remap_doc.eclipse.ui.editors.MigrationRuleEditor.java
License:Apache License
/** * Create the main widget under the given parent. * * @param parent parent for the widget./*from w w w . j av a 2s . co m*/ * @return the top level Composite for this widget. */ private Control createControl(Composite parent) { // components Composite topLevel = new Composite(parent, SWT.NONE); Composite leftPanel = new Composite(topLevel, SWT.NONE); Label labelGroup = new Label(leftPanel, SWT.NONE); groupSelect = new ComboViewer(leftPanel, SWT.READ_ONLY | SWT.FLAT); Label labelRules = new Label(leftPanel, SWT.NONE); rules = new ListViewer(leftPanel, SWT.SINGLE | SWT.BORDER); Button addRule = new Button(leftPanel, SWT.PUSH); Button removeRule = new Button(leftPanel, SWT.PUSH); Composite rightPanel = new Composite(topLevel, SWT.NONE); Label labelEditor = new Label(rightPanel, SWT.NONE); editorChooser = new DoubleElementEditorChooser(rightPanel, SWT.NONE); // layout GridLayout layout = new GridLayout(2, true); @SuppressWarnings("unused") GridLayout topLayout = new GridLayout(2, false); GridLayout leftLayout = new GridLayout(2, false); GridLayout rightLayout = new GridLayout(3, false); topLevel.setLayout(layout); leftPanel.setLayout(leftLayout); rightPanel.setLayout(rightLayout); leftPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); rightPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); labelGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); groupSelect.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); labelRules.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); rules.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2)); addRule.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); removeRule.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); labelEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); @SuppressWarnings("unused") GridData iconData = new GridData(16, 16); // content labelEditor.setText("Rule editor"); labelGroup.setText("Group"); groupSelect.setContentProvider(new CollectionContentProvider<MigrationGroup>(task.getMigrationGroups())); groupSelect.setInput(task.getMigrationGroups()); labelRules.setText("Rules"); rulesProvider = new TableContentProvider<MigrationRule<?>>(); rulesProvider.initViewer(rules); addRule.setText("Add"); removeRule.setText("Remove"); // initialize the content of fields and images newRuleSelection(null); // actions groupSelect.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = groupSelect.getSelection(); MigrationGroup group = Selections.getFirstElement(selection, MigrationGroup.class); if (null != group) { newGroupSelection(group); } else { newGroupSelection(null); deselectRule(); } } }); rules.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = rules.getSelection(); MigrationRule<?> rule = Selections.getFirstElement(selection, MigrationRule.class); if (rule != null) { newRuleSelection(rule); } } }); return topLevel; }
From source file:com.google.gdt.eclipse.suite.preferences.ui.ErrorsWarningsPage.java
License:Open Source License
private void addProblemTypeRow(Composite categoryProblemsPanel, IGdtProblemType problemType) { GridData problemLabelLayout = new GridData(SWT.FILL, SWT.CENTER, true, false); Label problemLabel = new Label(categoryProblemsPanel, SWT.NONE); problemLabel.setLayoutData(problemLabelLayout); problemLabel.setText(problemType.getDescription()); ComboViewer severityCombo = new ComboViewer(categoryProblemsPanel, SWT.READ_ONLY); GridData severityComboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false); severityCombo.getCombo().setLayoutData(severityComboLayout); severityCombo.setContentProvider(new ArrayContentProvider()); severityCombo.setLabelProvider(severityLabelProvider); severityCombo.setSorter(severityViewerSorter); severityCombo.setInput(GdtProblemSeverity.values()); // Save the association between the problem type and this combo problemSeverityCombos.put(problemType, severityCombo); }
From source file:com.google.gwt.eclipse.core.compile.ui.GWTCompileDialog.java
License:Open Source License
private void createLogLevelControl(Composite parent) { SWTFactory.createLabel(parent, "Log level:", 1); logLevelComboViewer = new ComboViewer(parent, SWT.READ_ONLY); logLevelComboViewer.setContentProvider(new ArrayContentProvider()); logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider()); logLevelComboViewer.setInput(GWTLaunchAttributes.LOG_LEVELS); }
From source file:com.google.gwt.eclipse.core.compile.ui.GWTCompileDialog.java
License:Open Source License
private void createOutputStyleControl(Composite parent) { SWTFactory.createLabel(parent, "Output style:", 1); outputStyleComboViewer = new ComboViewer(parent, SWT.READ_ONLY); outputStyleComboViewer.setContentProvider(new ArrayContentProvider()); outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider()); outputStyleComboViewer.setInput(GWTLaunchAttributes.OUTPUT_STYLES); }
From source file:com.google.gwt.eclipse.core.launch.ui.GWTJUnitSettingsTab.java
License:Open Source License
protected void createGWTJUnitSettingsComponent(Composite parent) { Group group = SWTFactory.createGroup(parent, "GWT JUnit Settings", 2, 1, GridData.FILL_HORIZONTAL); SWTFactory.createLabel(group, "Log level:", 1); logLevelComboViewer = new ComboViewer(group, SWT.READ_ONLY); logLevelComboViewer.setContentProvider(new ArrayContentProvider()); logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider()); logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS); // logLevelComboViewer.setSelection(new StructuredSelection("DEBUG")); logLevelComboViewer.addSelectionChangedListener(settingChangedListener); SWTFactory.createLabel(group, "Output style:", 1); outputStyleComboViewer = new ComboViewer(group, SWT.READ_ONLY); outputStyleComboViewer.setContentProvider(new ArrayContentProvider()); outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider()); outputStyleComboViewer.setInput(GWTLaunchConstants.OUTPUT_STYLES); // outputStyleComboViewer.setSelection(new StructuredSelection("PRETTY")); outputStyleComboViewer.addSelectionChangedListener(settingChangedListener); notHeadlessButton = SWTFactory.createCheckButton(group, "Display the log window and browser windows (useful for debugging)", null, true, 2); notHeadlessButton.addSelectionListener(settingChangedListener); webModeButton = SWTFactory.createCheckButton(group, "Run tests in production mode", null, false, 2); webModeButton.addSelectionListener(settingChangedListener); standardsModeButton = SWTFactory.createCheckButton(group, "Use standards mode", null, false, 2); standardsModeButton.addSelectionListener(settingChangedListener); GridData standardsModeButtonData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1); standardsModeButton.setLayoutData(standardsModeButtonData); SWTFactory.createLabel(group, "Output directory:", 1); outputDirectoryField = new Text(group, SWT.BORDER); outputDirectoryField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); outputDirectoryField.addModifyListener(settingChangedListener); }
From source file:com.google.gwt.eclipse.wtp.wizards.GwtFacetWizardPage.java
License:Open Source License
/** * Predefined path | [x] | Sdks Combo | | * * Custom path | [ ] | [ path to sdk ] | [browse] | *//*from w w w. j av a 2 s . co m*/ @Override protected Composite createTopLevelComposite(Composite parent) { initializeDialogUnits(parent); Composite container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout()); Group sdkSelectionGroup = new Group(container, SWT.NONE); sdkSelectionGroup.setText("Select GWT SDK"); sdkSelectionGroup.setLayout(new GridLayout(3, false)); sdkSelectionGroup.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); Label lblSdks = new Label(sdkSelectionGroup, SWT.NONE); lblSdks.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); lblSdks.setText("Select from the defined SDKs"); new Label(sdkSelectionGroup, SWT.NONE); Button radioDefined = new Button(sdkSelectionGroup, SWT.RADIO); radioDefined.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { enablePaths(false); } }); radioDefined.setSelection(true); comboViewer = new ComboViewer(sdkSelectionGroup, SWT.NONE); comboViewer.setLabelProvider(new LabelProvider() { @Override @SuppressWarnings("unchecked") public String getText(Object element) { GWTRuntime sdk = (GWTRuntime) element; return sdk.getName(); } }); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewerCombo = comboViewer.getCombo(); comboViewerCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboViewerCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setSdkSelection(); } }); btnAddSdk = new Button(sdkSelectionGroup, SWT.NONE); btnAddSdk.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openGwtPreferencesDialog(); } }); btnAddSdk.setText("Add SDK"); Label lblBlank = new Label(sdkSelectionGroup, SWT.NONE); new Label(sdkSelectionGroup, SWT.NONE); new Label(sdkSelectionGroup, SWT.NONE); Label lblCustomPath = new Label(sdkSelectionGroup, SWT.NONE); lblCustomPath.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); lblCustomPath.setText("Select a custom SDK location"); new Label(sdkSelectionGroup, SWT.NONE); Button radioPath = new Button(sdkSelectionGroup, SWT.RADIO); radioPath.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { enablePaths(true); } }); textPath = new Text(sdkSelectionGroup, SWT.BORDER); textPath.setEditable(false); textPath.setEnabled(false); textPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnDirBrowser = new Button(sdkSelectionGroup, SWT.NONE); btnDirBrowser.setEnabled(false); btnDirBrowser.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { showDirectoryDialog(); } }); btnDirBrowser.setText("Select SDK Directory"); addSdkOptionsToCombo(); Dialog.applyDialogFont(container); synchHelper.synchAllUIWithModel(); return container; }