List of usage examples for org.eclipse.jface.viewers ComboViewer getCombo
public Combo getCombo()
From source file:com.mmkarton.mx7.reportgenerator.wizards.BIRTSQLWizardPage.java
License:Open Source License
private void setFilterComboContents(ComboViewer filterComboViewer, boolean supportsProcedure) { if (filterComboViewer == null) { return;//w ww . j a va2s. c o m } List<FilterConfig.Type> types = new ArrayList<FilterConfig.Type>(); // Populate the Types of Data bases objects which can be retrieved types.add(Type.ALL); types.add(Type.TABLE); types.add(Type.VIEW); if (supportsProcedure) { types.add(Type.PROCEDURE); } filterComboViewer.setContentProvider(new IStructuredContentProvider() { @SuppressWarnings("unchecked") public Object[] getElements(Object inputElement) { return ((List) inputElement).toArray(); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }); filterComboViewer.setLabelProvider(new LabelProvider() { public String getText(Object inputElement) { FilterConfig.Type type = (FilterConfig.Type) inputElement; return FilterConfig.getTypeDisplayText(type); } }); filterComboViewer.setInput(types); // Set the Default selection to the First Item , which is "All" filterComboViewer.getCombo().select(0); filterComboViewer.getCombo().addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Type type = getSelectedFilterType(); /*if ( type == Type.ALL || type == Type.TABLE ) { showSystemTableCheckBox.setEnabled( true ); } else { showSystemTableCheckBox.setEnabled( false ); }*/ } }); }
From source file:com.netxforge.netxstudio.screens.nf3.Retention.java
License:Open Source License
private void addUIRule(final Composite cmpRules, final MetricRetentionRule rule, EMFDataBindingContext context, IEMFValueProperty retentionPeriodProperty, IValueProperty cmbSelectionProperty) { final Label lblMonthlyValues = toolkit.createLabel(cmpRules, rule.getName(), SWT.NONE); lblMonthlyValues.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); final ComboViewer cmbViewerTarget = new ComboViewer(cmpRules, SWT.NONE); Combo cmbMonthly = cmbViewerTarget.getCombo(); GridData gd_cmbMonthly = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_cmbMonthly.widthHint = 150;/*from ww w.j a v a2 s. c om*/ cmbMonthly.setLayoutData(gd_cmbMonthly); toolkit.paintBordersFor(cmbMonthly); cmbMonthly.setFocus(); final ImageHyperlink mghprlnkEditRetentionExpression = toolkit.createImageHyperlink(cmpRules, SWT.NONE); mghprlnkEditRetentionExpression.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); mghprlnkEditRetentionExpression.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { launchExpressionScreen(rule); } }); toolkit.paintBordersFor(mghprlnkEditRetentionExpression); mghprlnkEditRetentionExpression.setText("Edit retention expression"); cmbViewerTarget.setContentProvider(new ArrayContentProvider()); cmbViewerTarget.setLabelProvider(new LabelProvider()); cmbViewerTarget.setInput(MetricRetentionPeriod.values()); context.bindValue(cmbSelectionProperty.observe(cmbViewerTarget), retentionPeriodProperty.observe(rule)); }
From source file:com.netxforge.netxstudio.screens.nf3.Retention.java
License:Open Source License
private void addCustomUIRule(final Composite cmpRules, final MetricRetentionRule rule, EMFDataBindingContext context, IEMFValueProperty retentionPeriodProperty, IValueProperty cmbSelectionProperty) { // Edit the name of the rule. final Text nameText = toolkit.createText(cmpRules, ""); GridData textLayoutData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); textLayoutData.widthHint = 100;//from w w w . j a v a 2 s . c om nameText.setLayoutData(textLayoutData); nameText.setFocus(); final ISWTObservableValue observeTextName = SWTObservables.observeDelayedValue(400, SWTObservables.observeText(nameText, SWT.Modify)); final IEMFEditValueProperty nameProperty = EMFEditProperties.value(editingService.getEditingDomain(), MetricsPackage.Literals.METRIC_RETENTION_RULE__NAME); context.bindValue(observeTextName, nameProperty.observe(rule)); // Edit the interval. final Text intervalText = toolkit.createText(cmpRules, ""); final GridData intervalGridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); intervalText.setLayoutData(intervalGridData); final ISWTObservableValue observeTextInterval = SWTObservables.observeDelayedValue(400, SWTObservables.observeText(intervalText, SWT.Modify)); final IEMFEditValueProperty intervalModelProperty = EMFEditProperties.value( editingService.getEditingDomain(), MetricsPackage.Literals.METRIC_RETENTION_RULE__INTERVAL_HINT); context.bindValue(observeTextInterval, intervalModelProperty.observe(rule)); // Edit the retention period. final ComboViewer cmbViewerTarget = new ComboViewer(cmpRules, SWT.NONE); final Combo cmbRetentionPeriod = cmbViewerTarget.getCombo(); final GridData gridDataRetentionPeriod = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gridDataRetentionPeriod.widthHint = 150; cmbRetentionPeriod.setLayoutData(gridDataRetentionPeriod); toolkit.paintBordersFor(cmbRetentionPeriod); final ImageHyperlink mghprlnkEditRetentionExpression = toolkit.createImageHyperlink(cmpRules, SWT.NONE); mghprlnkEditRetentionExpression.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); mghprlnkEditRetentionExpression.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { launchExpressionScreen(rule); } }); toolkit.paintBordersFor(mghprlnkEditRetentionExpression); mghprlnkEditRetentionExpression.setText("Edit retention expression"); final ImageHyperlink removeObjectHyperLink = toolkit.createImageHyperlink(cmpRules, SWT.NONE); removeObjectHyperLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { final CompoundCommand cc = new CompoundCommand(); if (rule.eIsSet(MetricsPackage.Literals.METRIC_RETENTION_RULE__RETENTION_EXPRESSION)) { final Expression retentionExpression = rule.getRetentionExpression(); final Command deleteExpressionCommand = DeleteCommand.create(editingService.getEditingDomain(), retentionExpression); cc.append(deleteExpressionCommand); } final Command deleteRuleCommand = DeleteCommand.create(editingService.getEditingDomain(), rule); cc.append(deleteRuleCommand); editingService.getEditingDomain().getCommandStack().execute(cc); } }); final GridData removeObjectGridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); removeObjectGridData.widthHint = 18; removeObjectHyperLink.setLayoutData(removeObjectGridData); removeObjectHyperLink .setImage(ResourceManager.getPluginImage("org.eclipse.ui", "/icons/full/etool16/delete.gif")); toolkit.paintBordersFor(removeObjectHyperLink); removeObjectHyperLink.setText(""); cmbViewerTarget.setContentProvider(new ArrayContentProvider()); cmbViewerTarget.setLabelProvider(new LabelProvider()); cmbViewerTarget.setInput(MetricRetentionPeriod.values()); context.bindValue(cmbSelectionProperty.observe(cmbViewerTarget), retentionPeriodProperty.observe(rule)); }
From source file:com.nokia.carbide.trk.support.connection.SerialConnectionFactory.java
License:Open Source License
private void createComboForSettings(Composite composite, String labelStr, final String key, String[] input) { Label label = new Label(composite, SWT.NONE); label.setText(labelStr);/* ww w .j a v a2s . c o m*/ final ComboViewer viewer = new ComboViewer(composite, SWT.READ_ONLY); viewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { int index = SerialConnectionSettings.toIndex(key, element.toString()); return SerialConnectionSettings.toDisplayString(key, index); } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { int index = viewer.getCombo().getSelectionIndex(); settings.setByIndex(key, index); } }); viewer.setInput(input); viewer.getControl().setData(".uid", "SerialConnectionFactory." + key); //$NON-NLS-1$ //$NON-NLS-2$ viewers.put(key, viewer); }
From source file:com.photon.phresco.ui.internal.controls.PhrescoConfigControl.java
License:Apache License
public PhrescoConfigControl(Composite parent, int style, IPath configFilePath, String projectCode) { super(parent, style); GridLayout layout = new GridLayout(1, false); setLayout(layout);/*from w ww . j a v a 2 s . c o m*/ GridData data = new GridData(GridData.FILL_BOTH); setLayoutData(data); Composite envComposite = new Composite(this, SWT.NONE); envComposite.setLayout(new GridLayout(3, false)); envComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblEnviroments = new Label(envComposite, SWT.NONE); lblEnviroments.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblEnviroments.setText("Enviroments"); configPath = configFilePath; ComboViewer comboViewer = new ComboViewer(envComposite, SWT.NONE | SWT.READ_ONLY); Combo combo = comboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.DEFAULT, SWT.CENTER, false, false, 1, 1)); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setLabelProvider(new LabelProvider()); comboViewer.setInput(new String[] { configPath.toOSString(), "production" }); Button envManageBtn = new Button(envComposite, SWT.PUSH); envManageBtn.setText("Manage Environments"); envManageBtn.setLayoutData(new GridData(SWT.DEFAULT, SWT.CENTER, false, false, 1, 1)); final ManageEnvironmentsDialog environmentsDialog = new ManageEnvironmentsDialog(null, projectCode); envManageBtn.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { environmentsDialog.create(); environmentsDialog.open(); } }); Button addConfigBtn = new Button(envComposite, SWT.PUSH); addConfigBtn.setText("Add..."); final Composite ConfigComposite = new Composite(this, SWT.NONE); ConfigComposite.setLayout(new GridLayout(1, false)); ConfigComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); final CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(ConfigComposite, SWT.BORDER | SWT.FULL_SELECTION); table = checkboxTableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableColumn tblNameColumn = new TableColumn(table, SWT.NONE); tblNameColumn.setWidth(100); tblNameColumn.setText("Name"); TableColumn tblValueColumn = new TableColumn(table, SWT.NONE); tblValueColumn.setWidth(100); tblValueColumn.setText("Description"); TableColumn tblDescColumn = new TableColumn(table, SWT.NONE); tblDescColumn.setWidth(200); tblDescColumn.setText("Environment"); TableColumn tblStatusColumn = new TableColumn(table, SWT.NONE); tblStatusColumn.setWidth(100); tblStatusColumn.setText("Status"); settingsInfoList = getConfigValues(projectCode); checkboxTableViewer.setContentProvider(new ArrayContentProvider()); checkboxTableViewer.setLabelProvider(new ITableLabelProvider() { @Override public void removeListener(ILabelProviderListener listener) { // TODO Auto-generated method stub } @Override public boolean isLabelProperty(Object element, String property) { // TODO Auto-generated method stub return false; } @Override public void dispose() { // TODO Auto-generated method stub } @Override public void addListener(ILabelProviderListener listener) { // TODO Auto-generated method stub } @Override public String getColumnText(Object element, int columnIndex) { SettingsInfo settingsInfo = (SettingsInfo) element; switch (columnIndex) { case 0: return settingsInfo.getName(); case 1: return settingsInfo.getDescription(); case 2: return settingsInfo.getType() + " [" + settingsInfo.getEnvName() + "]"; } return ""; } @Override public Image getColumnImage(Object element, int columnIndex) { return null; } }); checkboxTableViewer.setInput(settingsInfoList); final ConfigDialog dialog = new ConfigDialog(null, projectCode); addConfigBtn.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { dialog.create(); if (dialog.open() == Window.OK) { // dialog.addSave(); checkboxTableViewer.add(dialog.getSettingsInfo()); } } }); }
From source file:com.rinke.solutions.pinball.ui.UsbConfig.java
/** * Create contents of the dialog.// w w w. j a va 2 s .c om */ private void createContents() { shell = new Shell(getParent(), getStyle()); shell.setSize(480, 277); shell.setText("Config Device"); shell.setLayout(new GridLayout(3, false)); Label lblDeviceMode = new Label(shell, SWT.NONE); lblDeviceMode.setText("Device Mode:"); Combo deviceModeCombo = new Combo(shell, SWT.NONE); GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_combo.widthHint = 165; deviceModeCombo.setLayoutData(gd_combo); for (DeviceMode mode : DeviceMode.values()) { deviceModeCombo.add(mode.name(), mode.ordinal()); } Button btnSetDeviceMode = new Button(shell, SWT.NONE); btnSetDeviceMode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnSetDeviceMode.setText("Set Device Mode"); btnSetDeviceMode.addListener(SWT.Selection, e -> connector.switchToMode(deviceModeCombo.getSelectionIndex(), null)); Label lblPalette = new Label(shell, SWT.NONE); lblPalette.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblPalette.setText("Palette:"); ComboViewer comboViewerDefaultPalette = new ComboViewer(shell, SWT.NONE); Combo comboDefaultPalette = comboViewerDefaultPalette.getCombo(); GridData gd_comboDefaultPalette = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gd_comboDefaultPalette.widthHint = 161; comboDefaultPalette.setLayoutData(gd_comboDefaultPalette); comboViewerDefaultPalette.setContentProvider(ArrayContentProvider.getInstance()); comboViewerDefaultPalette.setInput(DefaultPalette.values()); comboDefaultPalette.select(0); Button btnSetPalette = new Button(shell, SWT.NONE); btnSetPalette.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnSetPalette.setText("Set Palette"); btnSetPalette.addListener(SWT.Selection, e -> connector.switchToPal(comboDefaultPalette.getSelectionIndex(), null)); Label lblNewLabel = new Label(shell, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); lblNewLabel.setText("Brightness:"); Composite grpTiming = new Composite(shell, SWT.NONE); grpTiming.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 3)); //grpTiming.setText("Timing"); grpTiming.setLayout(new GridLayout(1, false)); Scale scale = new Scale(grpTiming, SWT.NONE); GridData gd_scale = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1); gd_scale.widthHint = 177; scale.setLayoutData(gd_scale); Scale scale_1 = new Scale(grpTiming, SWT.NONE); scale_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Scale scale_2 = new Scale(grpTiming, SWT.NONE); scale_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Scale scale_3 = new Scale(grpTiming, SWT.NONE); scale_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Scale scale_4 = new Scale(grpTiming, SWT.NONE); scale_4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Button btnResetDevice = new Button(shell, SWT.NONE); btnResetDevice.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnResetDevice.setText("Reset Device"); btnResetDevice.addListener(SWT.Selection, e -> connector.sendCmd(UsbCmd.RESET)); new Label(shell, SWT.NONE); Button btnRemoveLicenseFrom = new Button(shell, SWT.NONE); btnRemoveLicenseFrom.setText("Remove License from device"); btnRemoveLicenseFrom.addListener(SWT.Selection, e -> removeLicenses()); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); new Label(shell, SWT.NONE); Button btnOk = new Button(shell, SWT.NONE); btnOk.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnOk.setText("Ok"); btnOk.addListener(SWT.Selection, e -> shell.close()); }
From source file:com.testify.ecfeed.ui.dialogs.GeneratorSetupDialog.java
License:Open Source License
private void createTestSuiteComposite(Composite container) { Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label testSuiteLabel = new Label(composite, SWT.NONE); testSuiteLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); testSuiteLabel.setText("Test suite"); ComboViewer testSuiteViewer = new ComboViewer(composite, SWT.NONE); fTestSuiteCombo = testSuiteViewer.getCombo(); fTestSuiteCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); fTestSuiteCombo.setItems(fMethod.getTestSuites().toArray(new String[] {})); fTestSuiteCombo.addModifyListener(new ModifyListener() { @Override/*w w w. ja v a2 s . c om*/ public void modifyText(ModifyEvent e) { updateOkButton(); } }); fTestSuiteCombo.setText(Constants.DEFAULT_NEW_TEST_SUITE_NAME); }
From source file:com.testify.ecfeed.ui.dialogs.GeneratorSetupDialog.java
License:Open Source License
private void createGeneratorViewer(final Composite parent) { final GeneratorFactory<ChoiceNode> generatorFactory = new GeneratorFactory<>(); ComboViewer generatorViewer = new ComboViewer(parent, SWT.READ_ONLY); fGeneratorCombo = generatorViewer.getCombo(); fGeneratorCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); fGeneratorCombo.addModifyListener(new ModifyListener() { @Override//from ww w . j a va 2 s .co m public void modifyText(ModifyEvent e) { try { fSelectedGenerator = generatorFactory.getGenerator(fGeneratorCombo.getText()); createParametersComposite(parent, fSelectedGenerator.parameters()); fMainContainer.layout(); } catch (GeneratorException exception) { exception.printStackTrace(); fGeneratorCombo.setText(""); } } }); if (fGeneratorFactory.availableGenerators().size() > 0) { String[] availableGenerators = generatorFactory.availableGenerators().toArray(new String[] {}); for (String generator : availableGenerators) { fGeneratorCombo.add(generator); } fGeneratorCombo.select(0); setOkButton(true); } }
From source file:de.bht.fpa.mail.s000000.common.filter.operator.DefaultFilterOperatorComposite.java
License:Open Source License
public DefaultFilterOperatorComposite(Composite parent) { super(parent, SWT.NONE); setLayout(new GridLayout(2, false)); ComboViewer comboViewer = new ComboViewer(this, SWT.READ_ONLY); Combo combo = comboViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboViewer.setContentProvider(ArrayContentProvider.getInstance()); comboViewer.setLabelProvider(new LabelProvider() { @Override/*from ww w.ja v a2s. c o m*/ public String getText(Object element) { if (!(element instanceof FilterOperator)) { throw new IllegalArgumentException(); } return ((FilterOperator) element).value(); } }); comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { operator = SelectionHelper.handleStructuredSelectionEvent(event, FilterOperator.class); } }); comboViewer.setInput(FilterOperator.values()); // default comboViewer.setSelection(new StructuredSelection(FilterOperator.CONTAINS)); text = new Text(this, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); }
From source file:de.fkoeberle.autocommit.message.ui.AdvancedPage.java
License:Open Source License
/** * Create contents of the editor part.//from ww w.j a v a 2 s . c om * * @param parent */ @Override public void createFormContent(IManagedForm managedForm) { super.createFormContent(managedForm); FormToolkit toolkit = managedForm.getToolkit(); ScrolledForm scrolledForm = managedForm.getForm(); Composite body = scrolledForm.getBody(); toolkit.decorateFormHeading(scrolledForm.getForm()); toolkit.paintBordersFor(body); scrolledForm.setText("Advanced"); Composite parent = scrolledForm.getBody(); parent.setLayout(new FillLayout(SWT.HORIZONTAL)); Composite container = toolkit.createComposite(parent); container.setLayout(new GridLayout(1, false)); Composite header = toolkit.createComposite(container); header.setLayout(new GridLayout(2, false)); Label generateLabel = toolkit.createLabel(header, "Generate:"); generateLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); final ComboViewer comboViewer = new ComboViewer(header, SWT.READ_ONLY); final Combo combo = comboViewer.getCombo(); toolkit.adapt(combo, true, true); GridData comboLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); comboLayoutData.widthHint = 315; combo.setLayoutData(comboLayoutData); comboViewer.addSelectionChangedListener(new ComboSelectionListener(combo, comboViewer)); comboViewer.setContentProvider(new ObservableListContentProvider()); comboViewer.setLabelProvider(new DefaultProfileLabelProvider()); comboViewer.setInput(model.getProfiles()); ProfileComboBoxUpdater profileComboBoxUpdater = new ProfileComboBoxUpdater(comboViewer); model.addCurrentProfileListener(new ProfileComboBoxUpdater(comboViewer)); profileComboBoxUpdater.currentProfileChanged(); SashForm sashForm = new SashForm(container, SWT.NONE); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); toolkit.adapt(sashForm, false, false); Section leftSection = managedForm.getToolkit().createSection(sashForm, Section.TWISTIE | Section.TITLE_BAR); managedForm.getToolkit().paintBordersFor(leftSection); leftSection.setText("Used commit message factories:"); Composite leftComposite = managedForm.getToolkit().createComposite(leftSection, SWT.NONE); managedForm.getToolkit().paintBordersFor(leftComposite); leftSection.setClient(leftComposite); leftComposite.setLayout(new GridLayout(1, false)); final TableViewer usedFactoriesTableViewer = new TableViewer(leftComposite, SWT.BORDER | SWT.MULTI); usedFactoriesTable = usedFactoriesTableViewer.getTable(); usedFactoriesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); usedFactoriesTableViewer.setContentProvider(new ObservableListContentProvider()); usedFactoriesTableViewer.setLabelProvider(new FactoryLabelProvider()); usedFactoriesTableViewer.setInput(model.getFactoryDescriptions()); Section middleSection = managedForm.getToolkit().createSection(sashForm, Section.TWISTIE | Section.TITLE_BAR); managedForm.getToolkit().paintBordersFor(middleSection); middleSection.setText("Unused commit message factories:"); Composite middleComposite = managedForm.getToolkit().createComposite(middleSection, SWT.NONE); managedForm.getToolkit().paintBordersFor(middleComposite); middleSection.setClient(middleComposite); middleComposite.setLayout(new GridLayout(1, false)); TableViewer unusedFactoriesTableViewer = new TableViewer(middleComposite, SWT.BORDER | SWT.MULTI); unusedFactoriesTable = unusedFactoriesTableViewer.getTable(); unusedFactoriesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); unusedFactoriesTableViewer.setContentProvider(new ObservableListContentProvider()); unusedFactoriesTableViewer.setLabelProvider(new FactoryLabelProvider()); unusedFactoriesTableViewer.setInput(model.getUnusedFactoryDescriptions()); addDragAndDropSupport(usedFactoriesTableViewer, unusedFactoriesTableViewer); usedFactoriesTableViewer.addSelectionChangedListener(new FactoriesSelectionListener(CMFList.USED, usedFactoriesTableViewer, unusedFactoriesTableViewer, toolkit)); unusedFactoriesTableViewer.addSelectionChangedListener(new FactoriesSelectionListener(CMFList.UNUSED, unusedFactoriesTableViewer, usedFactoriesTableViewer, toolkit)); Section rightSection = managedForm.getToolkit().createSection(sashForm, Section.TWISTIE | Section.TITLE_BAR); managedForm.getToolkit().paintBordersFor(rightSection); rightSection.setText("Selected commit message factories:"); Composite rightComposite = managedForm.getToolkit().createComposite(rightSection, SWT.NONE); managedForm.getToolkit().paintBordersFor(rightComposite); rightSection.setClient(rightComposite); rightComposite.setLayout(new GridLayout(1, false)); final ScrolledComposite scrolledComposite = new ScrolledComposite(rightComposite, SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); toolkit.adapt(scrolledComposite); factoriesComposite = new Composite(scrolledComposite, SWT.NONE); scrolledComposite.setContent(factoriesComposite); toolkit.adapt(factoriesComposite); GridLayout layout = new GridLayout(); layout.numColumns = 1; factoriesComposite.setLayout(layout); scrolledComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = scrolledComposite.getClientArea(); factoriesComposite.setSize(factoriesComposite.computeSize(r.width, SWT.DEFAULT)); factoriesComposite.layout(); } }); scrolledComposite.setAlwaysShowScrollBars(true); sashForm.setWeights(new int[] { 180, 180, 350 }); /* * Expand after generating it's content so that content gets properly * shown: */ leftSection.setExpanded(true); middleSection.setExpanded(true); rightSection.setExpanded(true); }