List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer newCheckList
public static CheckboxTableViewer newCheckList(Composite parent, int style)
From source file:org.eclipse.egit.ui.internal.clone.GitShareProjectsPage.java
License:Open Source License
public void createControl(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(new GridLayout(1, false)); tv = CheckboxTableViewer.newCheckList(main, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(tv.getTable()); TableColumn name = new TableColumn(tv.getTable(), SWT.NONE); name.setWidth(200);//from w ww .j av a 2 s . c o m name.setText(UIText.GitShareProjectsPage_ProjectNameLabel); TableColumn repo = new TableColumn(tv.getTable(), SWT.NONE); repo.setWidth(400); repo.setText(UIText.GitShareProjectsPage_RepositoryLabel); tv.getTable().setHeaderVisible(true); tv.setContentProvider(ArrayContentProvider.getInstance()); tv.setLabelProvider(new ITableLabelProvider() { public void removeListener(ILabelProviderListener listener) { // ignore } public boolean isLabelProperty(Object element, String property) { return false; } public void dispose() { // nothing } public void addListener(ILabelProviderListener listener) { // ignore } public String getColumnText(Object element, int columnIndex) { switch (columnIndex) { case 0: return ((IProject) element).getName(); case 1: String actRepo = getRepository((IProject) element); if (actRepo == null) return UIText.GitShareProjectsPage_NoRepoFoundMessage; return actRepo; default: return null; } } public Image getColumnImage(Object element, int columnIndex) { return null; } }); tv.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { checkPage(); } }); Dialog.applyDialogFont(main); setControl(main); }
From source file:org.eclipse.egit.ui.internal.repository.ConfigureKeysDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); final CheckboxTableViewer tv = CheckboxTableViewer.newCheckList(main, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(tv.getTable()); ToolBar tb = new ToolBar(main, SWT.HORIZONTAL); final ToolItem del = new ToolItem(tb, SWT.PUSH); del.setEnabled(false);/*from w w w. j av a 2s . co m*/ del.setText(UIText.ConfigureKeysDialog_DeleteButton); del.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (Object ob : tv.getCheckedElements()) { activeKeys.remove(ob); tv.setInput(activeKeys); } } }); final ToolItem addStandard = new ToolItem(tb, SWT.PUSH); addStandard.setText(UIText.ConfigureKeysDialog_AddStandardButton); addStandard.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { for (String key : standardKeys) { if (!activeKeys.contains(key)) { activeKeys.add(key); } tv.setInput(activeKeys); } Collections.sort(activeKeys); } }); ToolItem add = new ToolItem(tb, SWT.PUSH); add.setText(UIText.ConfigureKeysDialog_NewButton); add.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IInputValidator validator = new IInputValidator() { public String isValid(String newText) { if (activeKeys.contains(newText)) return NLS.bind(UIText.ConfigureKeysDialog_AlreadyThere_Message, newText); return null; } }; InputDialog id = new InputDialog(getShell(), UIText.ConfigureKeysDialog_NewKeyLabel, UIText.ConfigureKeysDialog_NewKeyLabel, null, validator); if (id.open() == Window.OK) { activeKeys.add(id.getValue()); Collections.sort(activeKeys); tv.setInput(activeKeys); } } }); tv.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { boolean anyChecked = tv.getCheckedElements().length > 0; del.setEnabled(anyChecked); } }); tv.setLabelProvider(new LabelProvider()); tv.setContentProvider(new ContentProvider()); tv.setInput(this.activeKeys); applyDialogFont(main); return main; }
From source file:org.eclipse.egit.ui.internal.search.CommitSearchPage.java
License:Open Source License
private void addRepositoryControl(Composite parent) { repositoryGroup = new Group(parent, SWT.NONE); repositoryGroup.setBackgroundMode(SWT.INHERIT_DEFAULT); GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(repositoryGroup); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(repositoryGroup); this.repositoryViewer = CheckboxTableViewer.newCheckList(repositoryGroup, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); this.repositoryViewer .setLabelProvider(new DelegatingStyledCellLabelProvider(new RepositoriesViewLabelProvider())); this.repositoryViewer.setContentProvider(new RepositoriesViewContentProvider()); this.repositoryViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); this.repositoryViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { updateOKStatus();/*from w w w. ja v a2 s . com*/ repositoryGroup.setText(getRepositoryText()); } }); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 40) .applyTo(this.repositoryViewer.getControl()); ToolBar checkBar = new ToolBar(repositoryGroup, SWT.FLAT | SWT.VERTICAL); GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).grab(false, true).applyTo(checkBar); ToolItem checkItem = new ToolItem(checkBar, SWT.PUSH); checkItem.setToolTipText(UIText.CommitSearchPage_CheckAll); Image checkImage = UIIcons.CHECK_ALL.createImage(); UIUtils.hookDisposal(checkItem, checkImage); checkItem.setImage(checkImage); checkItem.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { repositoryViewer.setAllChecked(true); repositoryGroup.setText(getRepositoryText()); updateOKStatus(); } }); ToolItem uncheckItem = new ToolItem(checkBar, SWT.PUSH); uncheckItem.setToolTipText(UIText.CommitSearchPage_UncheckAll); Image uncheckImage = UIIcons.UNCHECK_ALL.createImage(); UIUtils.hookDisposal(uncheckItem, uncheckImage); uncheckItem.setImage(uncheckImage); uncheckItem.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { repositoryViewer.setAllChecked(false); repositoryGroup.setText(getRepositoryText()); updateOKStatus(); } }); this.searchAllBranchesButton = new Button(repositoryGroup, SWT.CHECK); this.searchAllBranchesButton.setText(UIText.CommitSearchPage_SearchAllBranches); GridDataFactory.swtDefaults().grab(true, false).span(2, 1).applyTo(this.searchAllBranchesButton); repositoryGroup.setText(getRepositoryText()); }
From source file:org.eclipse.emf.cdo.internal.ui.dialogs.SelectPackageDialog.java
License:Open Source License
@Override protected void createUI(Composite parent) { CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.SINGLE | SWT.BORDER); viewer.getTable().setLayoutData(UIUtil.createGridData()); viewer.setContentProvider(new PackageContentProvider()); viewer.setLabelProvider(new PackageLabelProvider()); viewer.setInput(CDOPackageTypeRegistry.INSTANCE); String[] uris = OM.PREF_HISTORY_SELECT_PACKAGES.getValue(); if (uris != null) { viewer.setCheckedElements(uris); }//from ww w . ja v a2s . c o m setCurrentViewer(viewer); }
From source file:org.eclipse.emf.compare.rcp.ui.internal.preferences.AdapterFactoriesPreferencePage.java
License:Open Source License
private void createViewer(Composite containerComposite) { Group interactiveGroup = new Group(containerComposite, SWT.BORDER); interactiveGroup// www .j a va 2 s . c o m .setText(EMFCompareRCPUIMessages.getString("AdapterFactoryPreferencePage.itemProviderGroup.text")); //$NON-NLS-1$ interactiveGroup.setLayout(new GridLayout(1, false)); interactiveGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); adapterFactoryDescriptorViewer = CheckboxTableViewer.newCheckList(interactiveGroup, SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION); adapterFactoryDescriptorViewer.setContentProvider(ArrayContentProvider.getInstance()); adapterFactoryDescriptorViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof RankedAdapterFactoryDescriptor) { return ((RankedAdapterFactoryDescriptor) element).getLabel(); } return super.getText(element); } }); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); adapterFactoryDescriptorViewer.getControl().setLayoutData(gd); // Prevents unselecting non optional providers adapterFactoryDescriptorViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { Object element = event.getElement(); if (element instanceof RankedAdapterFactoryDescriptor) { RankedAdapterFactoryDescriptor provider = (RankedAdapterFactoryDescriptor) element; if (!provider.isOptional()) { event.getCheckable().setChecked(element, true); } } } }); }
From source file:org.eclipse.emf.ecp.emf2web.wizard.pages.EClassPage.java
License:Open Source License
/** * Create contents of the wizard./*from ww w . jav a2 s.c om*/ * * @param parent */ @Override public void createControl(Composite parent) { final Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new FillLayout(SWT.HORIZONTAL)); eClassTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER | SWT.FULL_SELECTION); eClassTableViewer.addCheckStateListener(new EClassTableViewerICheckStateListener()); eClassTableViewer.setContentProvider(new ArrayContentProvider()); final ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); final AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(composedAdapterFactory); eClassTableViewer.setLabelProvider(labelProvider); setPageComplete(false); }
From source file:org.eclipse.emf.ecp.internal.ui.composites.CheckedEStructuralFeatureCompositeImpl.java
License:Open Source License
/** * //from w w w .j a v a 2 s . c o m * {@inheritDoc} * * @see org.eclipse.emf.ecp.internal.ui.composites.SelectModelElementCompositeImpl#createViewer(org.eclipse.swt.widgets.Composite) */ @Override protected CheckboxTableViewer createViewer(Composite composite) { final CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); tableViewer.setLabelProvider(getLabelProvider()); provider = new FilteredViewerContentProvider(tableViewer); tableViewer.setContentProvider(provider); tableViewer.setCheckStateProvider(provider); tableViewer.setInput(getInput()); return tableViewer; }
From source file:org.eclipse.emf.ecp.view.editor.handler.SelectAttributesDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); ((GridLayout) composite.getLayout()).numColumns = 2; final Label labelDatasegment = new Label(composite, SWT.NONE); labelDatasegment.setText("Select Datasegment"); final ComboViewer cvDatasegment = new ComboViewer(composite, SWT.READ_ONLY); composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); labelProvider = new AdapterFactoryLabelProvider(composedAdapterFactory); cvDatasegment.setLabelProvider(labelProvider); cvDatasegment.setContentProvider(ArrayContentProvider.getInstance()); final Button bUnreferenced = new Button(composite, SWT.CHECK); bUnreferenced.setText("Show only unreferenced Attributes?"); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(bUnreferenced);/*from w ww .ja v a 2 s. c om*/ final Label labelAttributes = new Label(composite, SWT.NONE); labelAttributes.setText("Select Attributes"); final CheckboxTableViewer tvAttributes = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); tvAttributes.setLabelProvider(labelProvider); tvAttributes.setContentProvider(ArrayContentProvider.getInstance()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(SWT.DEFAULT, 200) .applyTo(tvAttributes.getControl()); tvAttributes.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { final EStructuralFeature object = (EStructuralFeature) event.getElement(); if (event.getChecked()) { selectedFeatures.add(object); } else { selectedFeatures.remove(object); } } }); cvDatasegment.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { dataSegment = (EClass) ((IStructuredSelection) event.getSelection()).getFirstElement(); List<EStructuralFeature> attributes = null; if (!bUnreferenced.getSelection()) { attributes = dataSegment.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(dataSegment); } tvAttributes.setInput(attributes); } }); bUnreferenced.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final EClass dataSegment = (EClass) ((IStructuredSelection) cvDatasegment.getSelection()) .getFirstElement(); List<EStructuralFeature> attributes = null; if (!bUnreferenced.getSelection()) { attributes = dataSegment.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(dataSegment); } tvAttributes.setInput(attributes); } }); final Composite compositeButtons = new Composite(composite, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(compositeButtons); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(compositeButtons); final Button bSelectAll = new Button(compositeButtons, SWT.PUSH); bSelectAll.setText("Select All"); bSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(true); selectedFeatures.addAll(segments); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bSelectAll); final Button bDeSelectAll = new Button(compositeButtons, SWT.PUSH); bDeSelectAll.setText("Deselect All"); bDeSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(false); selectedFeatures.removeAll(segments); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bDeSelectAll); final Set<EClass> datasegments = Helper.getDatasegmentSubclasses(rootClass); cvDatasegment.setInput(datasegments); if (datasegments.size() > 0) { cvDatasegment.setSelection(new StructuredSelection(datasegments.iterator().next())); } return composite; }
From source file:org.eclipse.emf.ecp.view.internal.editor.handler.SelectAttributesWizardPage.java
License:Open Source License
/** * {@inheritDoc}/*from w ww. j a v a 2 s . co m*/ * * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ @Override public void createControl(Composite parent) { this.parent = parent; composite = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); composite.setLayout(layout); setControl(composite); composedAdapterFactory = new ComposedAdapterFactory( new AdapterFactory[] { new ReflectiveItemProviderAdapterFactory(), new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) }); labelProvider = new AdapterFactoryLabelProvider(composedAdapterFactory); bUnreferenced = new Button(composite, SWT.CHECK); bUnreferenced.setText("Show only unreferenced Attributes?"); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(bUnreferenced); final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setShowFocusedControl(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setExpandHorizontal(true); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(scrolledComposite); GridLayoutFactory.fillDefaults().applyTo(scrolledComposite); final Composite tableComposite = new Composite(scrolledComposite, SWT.FILL); tableComposite.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableComposite); tableComposite.setBackground(scrolledComposite.getBackground()); tvAttributes = CheckboxTableViewer.newCheckList(tableComposite, SWT.NONE); tvAttributes.setLabelProvider(labelProvider); tvAttributes.setContentProvider(ArrayContentProvider.getInstance()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(SWT.DEFAULT, 200) .applyTo(tvAttributes.getControl()); scrolledComposite.setContent(tableComposite); final Point point = tableComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(point); tvAttributes.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { final EStructuralFeature object = (EStructuralFeature) event.getElement(); if (event.getChecked()) { selectedFeatures.add(object); } else { selectedFeatures.remove(object); } setPageComplete(!selectedFeatures.isEmpty()); } }); List<EStructuralFeature> attributes = null; if (rootClass != null) { if (!bUnreferenced.getSelection()) { attributes = rootClass.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(rootClass); } } tvAttributes.setInput(attributes); bUnreferenced.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<EStructuralFeature> attributes = null; if (rootClass != null) { if (!bUnreferenced.getSelection()) { attributes = rootClass.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(rootClass); } } tvAttributes.setInput(attributes); } }); final Composite compositeButtons = new Composite(composite, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(compositeButtons); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(compositeButtons); final Button bSelectAll = new Button(compositeButtons, SWT.PUSH); bSelectAll.setText("Select All"); //$NON-NLS-1$ bSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @SuppressWarnings("unchecked") final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(true); selectedFeatures.addAll(segments); setPageComplete(!selectedFeatures.isEmpty()); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bSelectAll); final Button bDeSelectAll = new Button(compositeButtons, SWT.PUSH); bDeSelectAll.setText("Deselect All"); //$NON-NLS-1$ bDeSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @SuppressWarnings("unchecked") final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(false); selectedFeatures.removeAll(segments); setPageComplete(!selectedFeatures.isEmpty()); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bDeSelectAll); parent.layout(true); scrolledComposite.layout(true); }
From source file:org.eclipse.emf.ecp.view.internal.editor.handler.SelectAttributesWizardPage.java
License:Open Source License
public void onEnterPage() { /* if (isCurrentPage()) */ { // clear composite clear();/*from ww w .j a v a 2 s . c o m*/ composite = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); composite.setLayout(layout); layout.numColumns = 2; setControl(composite); composedAdapterFactory = new ComposedAdapterFactory( new AdapterFactory[] { new ReflectiveItemProviderAdapterFactory(), new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) }); labelProvider = new AdapterFactoryLabelProvider(composedAdapterFactory); final Button bUnreferenced = new Button(composite, SWT.CHECK); bUnreferenced.setText("Show only unreferenced Attributes?"); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(bUnreferenced); final Label labelAttributes = new Label(composite, SWT.NONE); labelAttributes.setText("Select Attributes"); //$NON-NLS-1$ final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setShowFocusedControl(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setExpandHorizontal(true); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(scrolledComposite); GridLayoutFactory.fillDefaults().applyTo(scrolledComposite); final Composite tableComposite = new Composite(scrolledComposite, SWT.FILL); tableComposite.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableComposite); tableComposite.setBackground(scrolledComposite.getBackground()); final CheckboxTableViewer tvAttributes = CheckboxTableViewer.newCheckList(tableComposite, SWT.NONE); tvAttributes.setLabelProvider(labelProvider); tvAttributes.setContentProvider(ArrayContentProvider.getInstance()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(SWT.DEFAULT, 200) .applyTo(tvAttributes.getControl()); scrolledComposite.setContent(tableComposite); final Point point = tableComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(point); tvAttributes.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { final EStructuralFeature object = (EStructuralFeature) event.getElement(); if (event.getChecked()) { selectedFeatures.add(object); } else { selectedFeatures.remove(object); } setPageComplete(!selectedFeatures.isEmpty()); } }); List<EStructuralFeature> attributes = null; if (!bUnreferenced.getSelection()) { attributes = rootClass.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(rootClass); } tvAttributes.setInput(attributes); bUnreferenced.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<EStructuralFeature> attributes = null; if (!bUnreferenced.getSelection()) { attributes = rootClass.getEAllStructuralFeatures(); } else { attributes = getUnreferencedSegmentAttributes(rootClass); } tvAttributes.setInput(attributes); } }); final Composite compositeButtons = new Composite(composite, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(compositeButtons); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).span(2, 1) .applyTo(compositeButtons); final Button bSelectAll = new Button(compositeButtons, SWT.PUSH); bSelectAll.setText("Select All"); //$NON-NLS-1$ bSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @SuppressWarnings("unchecked") final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(true); selectedFeatures.addAll(segments); setPageComplete(!selectedFeatures.isEmpty()); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bSelectAll); final Button bDeSelectAll = new Button(compositeButtons, SWT.PUSH); bDeSelectAll.setText("Deselect All"); //$NON-NLS-1$ bDeSelectAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @SuppressWarnings("unchecked") final List<EStructuralFeature> segments = (List<EStructuralFeature>) tvAttributes.getInput(); tvAttributes.setAllChecked(false); selectedFeatures.removeAll(segments); setPageComplete(!selectedFeatures.isEmpty()); } }); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).applyTo(bDeSelectAll); parent.layout(true); scrolledComposite.layout(true); } }