Java Code Examples for org.eclipse.jface.viewers.TableViewer#addSelectionChangedListener()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#addSelectionChangedListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FaelleComposite.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public FaelleComposite(Composite parent, int style){ super(parent, style); setLayout(new GridLayout(1, false)); tableViewerFaelle = new TableViewer(this, SWT.None); tableViewerFaelle.getTable().setBackground(UiDesk.getColor(UiDesk.COL_WHITE)); tableViewerFaelle.getTable().setLayoutData( new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tableViewerFaelle.setLabelProvider(new FaelleLabelProvider()); tableViewerFaelle.setContentProvider(new FaelleContentProvider()); MenuManager menuManager = new MenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); tableViewerFaelle.getTable().setMenu( menuManager.createContextMenu(tableViewerFaelle.getTable())); menuManager.add(GlobalActions.openFallaction); menuManager.add(GlobalActions.makeBillAction); menuManager.add(GlobalActions.delFallAction); menuManager.add(GlobalActions.reopenFallAction); tableViewerFaelle.addSelectionChangedListener(new FallSelectionChangedToEventDispatcher()); }
Example 2
Source File: ConnectionSelectionPage.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.horizontalSpacing = 5; layout.verticalSpacing = 7; composite.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL); composite.setLayoutData(data); connViewer = new TableViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); connViewer.setContentProvider(ArrayContentProvider.getInstance()); connViewer.setLabelProvider(new ConnLabelProvider()); connViewer.setInput(connections); connViewer.getTable().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); connViewer.addSelectionChangedListener((SelectionChangedEvent event) -> { connection = (CodewindConnection)connViewer.getStructuredSelection().getFirstElement(); validate(); }); // Add Context Sensitive Help PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, CodewindUIPlugin.MAIN_CONTEXTID); setControl(composite); }
Example 3
Source File: ValidateableConstantSectionPart.java From tlaplus with MIT License | 6 votes |
/** * create the viewer */ @Override protected TableViewer createTableViewer(Table table) { // create TableViewer tableViewer = new TableViewer(table); // represent formulas in the view tableViewer.setContentProvider(new AssignmentContentProvider()); // on changed selection change button enablement tableViewer.addSelectionChangedListener(fSelectionChangedListener); // edit on double-click tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { doEdit(); } }); return tableViewer; }
Example 4
Source File: OrderElementControl.java From statecharts with Eclipse Public License 1.0 | 6 votes |
private void init() { this.setLayout(new GridLayout(2, false)); viewer = new TableViewer(this, SWT.SINGLE | SWT.BORDER); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new AdapterFactoryLabelProvider(new SGraphItemProviderAdapterFactory())); Composite buttonComposite = getToolkit().createComposite(this); buttonComposite.setLayout(new FillLayout(SWT.VERTICAL)); btnUp = getToolkit().createButton(buttonComposite, "up", SWT.PUSH); btnDown = getToolkit().createButton(buttonComposite, "down", SWT.PUSH); viewer.addSelectionChangedListener(enableButtonListener); viewer.addSelectionChangedListener(editPartSelectionListener); btnUp.addSelectionListener(upButtonListener); btnDown.addSelectionListener(downButtonListener); GridDataFactory.fillDefaults().applyTo(viewer.getControl()); GridDataFactory.fillDefaults().applyTo(buttonComposite); GridDataFactory.fillDefaults().grab(true, false).applyTo(viewer.getControl()); GridDataFactory.fillDefaults().grab(true, false).applyTo(this); }
Example 5
Source File: CListTable.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void createTable(Composite parent) { tableViewer = new TableViewer(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); tableViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); tableViewer.setLabelProvider(new LabelProvider()); tableViewer.setComparator(new ViewerComparator()); tableViewer.setInput(items); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateStates(); } }); updateStates(); }
Example 6
Source File: ManageJarDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createTree(final Composite composite) { tableViewer = new TableViewer(composite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); tableViewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).create()); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.addFilter(searchFilter); tableViewer.setLabelProvider(new FileStoreLabelProvider()); tableViewer.setInput(libStore.getChildren()); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent arg0) { if(removeButton != null){ removeButton.setEnabled(!tableViewer.getSelection().isEmpty()); } } }); }
Example 7
Source File: ValidationViewPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createTableComposite(final Composite mainComposite) { final Composite tableComposite = new Composite(mainComposite, SWT.NONE); tableComposite.setLayout(GridLayoutFactory.fillDefaults().create()); tableComposite.setLayoutData(GridDataFactory.fillDefaults() .grab(true, true).create()); tableViewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); final Table table = tableViewer.getTable(); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, SWT.DEFAULT).create()); table.setHeaderVisible(true); table.setLinesVisible(true); addSeverityDescriptionColumn(); addElementNameColumn(); addErrorDescriptionColumn(); final TableColumnLayout tcLayout = new TableColumnLayout(); tcLayout.setColumnData(table.getColumn(0), new ColumnWeightData(1)); tcLayout.setColumnData(table.getColumn(1), new ColumnWeightData(5)); tcLayout.setColumnData(table.getColumn(2), new ColumnWeightData(11)); table.getParent().setLayout(tcLayout); tableViewer.setContentProvider(new ValidationMarkerContentProvider()); final IEditorPart activeEditor = getSite().getPage().getActiveEditor(); tableViewer.setInput(activeEditor); tableViewer.addSelectionChangedListener(this); }
Example 8
Source File: ConfigurationWizardDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createPageChooserComposite(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(GridDataFactory.fillDefaults().span(1, 2).create()); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 10).create()); pageChooserViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION); pageChooserViewer.getTable().setLayoutData( GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).create()); pageChooserViewer.setContentProvider(new WizardPageContentProvider()); ILabelDecorator decorator = new WizardPageDecorator(this); pageChooserViewer.setLabelProvider(new DecoratingLabelProvider(new WizardPageLabelProvider(this), decorator)); pageChooserViewer.setInput(getWizard().getPages()); pageChooserViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { IProcessConfigurationWizardPage page = (IProcessConfigurationWizardPage) element; if (!isSimpleMode) { return true; } return page.isDefault() || page.isConfigurationPageValid(getConfiguration()) != null; } }); pageChooserViewer.addSelectionChangedListener(this); pageChooserViewer.getTable().setEnabled(false); addPageChangedListener(this); }
Example 9
Source File: ConnectorSection.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createConnectorComposite(final Composite parent) { final Composite buttonsComposite = getWidgetFactory() .createComposite(parent); buttonsComposite.setLayoutData(GridDataFactory.fillDefaults() .grab(false, true).create()); buttonsComposite.setLayout(GridLayoutFactory.fillDefaults() .numColumns(1).margins(5, 0).spacing(0, 3).create()); createAddConnectorButton(buttonsComposite); updateConnectorButton = createUpdateConnectorButton(buttonsComposite); removeConnectorButton = createRemoveConnectorButton(buttonsComposite); upConnectorButton = createUpConnectorButton(buttonsComposite); downConnectorButton = createDownConnectorButton(buttonsComposite); moveButton = createMoveConnectorButton(buttonsComposite); tableViewer = new TableViewer(parent, GTKStyleHandler.removeBorderFlag(SWT.BORDER | SWT.MULTI | SWT.NO_FOCUS)); getWidgetFactory().adapt(tableViewer.getTable(), false, false); tableViewer.getTable().setLayoutData( GridDataFactory.fillDefaults().grab(true, true) .hint(SWT.DEFAULT, 120).create()); tableViewer.addDoubleClickListener(this); tableViewer.addSelectionChangedListener(this); tableViewer.getTable().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { e.doit = false; removeSelectedConnectors(); } } }); tableViewer.setContentProvider(new EMFListFeatureTreeContentProvider( getConnectorFeature())); tableViewer.setLabelProvider(new StyledConnectorLabelProvider()); tableViewer.addFilter(getViewerFilter()); }
Example 10
Source File: SamplePart.java From codeexamples-eclipse with Eclipse Public License 1.0 | 5 votes |
@PostConstruct public void createComposite(Composite parent) { parent.setLayout(new GridLayout(1, false)); txtInput = new Text(parent, SWT.BORDER); txtInput.setMessage("Enter text to mark part as dirty"); txtInput.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { dirty.setDirty(true); } }); txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tableViewer = new TableViewer(parent); tableViewer.add("Sample item 1"); tableViewer.add("Sample item 2"); tableViewer.add("Sample item 3"); tableViewer.add("Sample item 4"); tableViewer.add("Sample item 5"); tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { selectionService.setSelection("Hello"); } }); }
Example 11
Source File: ImportFileWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected Composite doCreateControls(Composite parent, DataBindingContext dbc) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).extendedMargins(10, 10, 10, 0).create()); final Group transfoGroup = new Group(mainComposite, SWT.NONE); transfoGroup.setText(Messages.fileFormat); transfoGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(3, 1).create()); transfoGroup.setLayout(new GridLayout(2, true)); final TableViewer importList = new TableViewer(transfoGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); importList.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); importList.setContentProvider(ArrayContentProvider.getInstance()); importList.setComparator(new ImporterPriorityDisplayComparator()); importList.setLabelProvider(new LabelProvider() { @Override public String getText(Object item) { return ((ImporterFactory) item).getName(); } }); final List<ImporterFactory> allAvailableImports = ImporterRegistry.getInstance().getAllAvailableImports(); importList.setInput(allAvailableImports); final IObservableValue importerFactoryObservable = PojoObservables.observeValue(importFileData, "importerFactory"); importerFactoryObservable.setValue(importList.getElementAt(0)); dbc.bindValue(ViewersObservables.observeSingleSelection(importList), importerFactoryObservable, updateValueStrategy().withValidator(mandatoryValidator(Messages.fileFormat)).create(), updateValueStrategy().create()); final Composite descComposite = new Composite(transfoGroup, SWT.NONE); descComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 3).create()); descComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create()); final Label importDescriptionLabel = new Label(descComposite, SWT.NONE); importDescriptionLabel.setText(Messages.importDescriptionLabel); final Label descriptionImage = new Label(descComposite, SWT.NONE); descriptionImage.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.FILL).create()); final Label separator = new Label(descComposite, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final Label descriptionLabel = new Label(descComposite, SWT.WRAP); descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().hint(230, SWT.DEFAULT).grab(false, true).create()); updatePanel(importFileData.getImporterFactory(), descriptionImage, descriptionLabel); doCreateAdditionalControls(mainComposite, dbc); final Label fileLabel = new Label(mainComposite, SWT.NONE); fileLabel.setText(Messages.selectFileToImport); final Text text = new Text(mainComposite, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); final IObservableValue filePathObservable = PojoObservables.observeValue(importFileData, "filePath"); dbc.bindValue(SWTObservables.observeText(text, SWT.Modify), filePathObservable, updateValueStrategy().withValidator(pathValidator(Messages.selectFileToImport).overrideMessage(Messages.invalidFilePath)).create(), updateValueStrategy().create()); final Button browseButton = new Button(mainComposite, SWT.PUSH); browseButton.setText(Messages.browseButton_label); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final String file = openFileDialog(); if (file != null) { text.setText(file); if (new File(file).exists()) { savePath(new File(file).getParentFile().getAbsolutePath()); } } } }); importList.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { updatePanel((ImporterFactory) importerFactoryObservable.getValue(), descriptionImage, descriptionLabel); } }); importList.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent arg0) { updatePanel((ImporterFactory) importerFactoryObservable.getValue(), descriptionImage, descriptionLabel); browseButton.notifyListeners(SWT.Selection, null); } }); return mainComposite; }
Example 12
Source File: MedicationHistoryTableComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public MedicationHistoryTableComposite(Composite parent, int style){ super(parent, style); setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); layout = new TableColumnLayout(); setLayout(layout); viewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); viewer.getTable().setHeaderVisible(true); ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent e){ IStructuredSelection is = (IStructuredSelection) viewer.getSelection(); MedicationTableViewerItem presc = (MedicationTableViewerItem) is.getFirstElement(); // set last disposition information Identifiable identifiable = (presc != null) ? presc.getLastDisposed() : null; medicationComposite.setLastDisposal(identifiable); // set writable databinding value medicationComposite.setSelectedMedication(presc); if (presc != null) { IPrescription selectedObj = presc.getPrescription(); ContextServiceHolder.get().getRootContext().setTyped(selectedObj); } else { ContextServiceHolder.get().getRootContext().removeTyped(IPrescription.class); } } }); MedicationViewerHelper.createTypeColumn(viewer, layout, 0); MedicationViewerHelper.createArticleColumn(viewer, layout, 1); MedicationViewerHelper.createDosageColumn(viewer, layout, 2); MedicationViewerHelper.createBeginColumn(viewer, layout, 3); MedicationViewerHelper.createIntakeCommentColumn(viewer, layout, 4); MedicationViewerHelper.createStopColumn(viewer, layout, 5); MedicationViewerHelper.createStopReasonColumn(viewer, layout, 6); MedicationViewerHelper.createMandantColumn(viewer, layout, 7); viewer.setContentProvider(new MedicationTableViewerContentProvider(viewer)); }
Example 13
Source File: CrosstabFilterConditionBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void createMemberValuesGroup( Composite content ) { group = new Group( content, SWT.NONE ); group.setText( Messages.getString( "CrosstabFilterConditionBuilder.Label.SelColumnMemberValue" ) ); //$NON-NLS-1$ group.setLayout( new GridLayout( ) ); memberValueTable = new Table( group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION ); memberValueTable.setLinesVisible( true ); memberValueTable.setHeaderVisible( true ); memberValueTable.setLayoutData( new GridData( GridData.FILL_BOTH ) ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 150; gd.horizontalSpan = 3; group.setLayoutData( gd ); dynamicViewer = new TableViewer( memberValueTable ); TableColumn column = new TableColumn( memberValueTable, SWT.LEFT ); column.setText( columns[0] ); column.setWidth( 15 ); TableColumn column1 = new TableColumn( memberValueTable, SWT.LEFT ); column1.setResizable( columns[1] != null ); if ( columns[1] != null ) { column1.setText( columns[1] ); } column1.setWidth( 200 ); TableColumn column2 = new TableColumn( memberValueTable, SWT.LEFT ); column2.setResizable( columns[2] != null ); if ( columns[2] != null ) { column2.setText( columns[2] ); } column2.setWidth( 200 ); dynamicViewer.setColumnProperties( columns ); editor = new ExpressionValueCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); TextCellEditor textEditor2 = new TextCellEditor( dynamicViewer.getTable( ), SWT.READ_ONLY ); CellEditor[] cellEditors = new CellEditor[]{ textEditor, textEditor2, editor }; if ( designHandle != null ) { editor.setExpressionProvider( getCrosstabExpressionProvider( ) ); editor.setReportElement( (ExtendedItemHandle) designHandle ); } dynamicViewer.setCellEditors( cellEditors ); dynamicViewer.setContentProvider( contentProvider ); dynamicViewer.setLabelProvider( labelProvider ); dynamicViewer.setCellModifier( cellModifier ); dynamicViewer.addSelectionChangedListener( selectionChangeListener ); }
Example 14
Source File: ExpressionBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
private void initTable( TableViewer tableViewer, boolean leafOnly ) { final Table table = tableViewer.getTable( ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 150; table.setLayoutData( gd ); table.setToolTipText( null ); final TableColumn column = new TableColumn( table, SWT.NONE ); column.setWidth( 200 ); table.getShell( ).addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { Display.getCurrent( ).asyncExec( new Runnable( ) { public void run( ) { if ( column != null && !column.isDisposed( ) ) { column.setWidth( table.getSize( ).x > 204 ? table.getSize( ).x - 4 : 200 ); } } } ); } } ); table.addMouseTrackListener( new MouseTrackAdapter( ) { public void mouseHover( MouseEvent event ) { Widget widget = event.widget; if ( widget == table ) { Point pt = new Point( event.x, event.y ); TableItem item = table.getItem( pt ); if ( item == null ) { table.setToolTipText( null ); } else { table.setToolTipText( provider.getTooltipText( item.getData( ) ) ); } } } } ); tableViewer.setLabelProvider( new ExpressionLabelProvider( ) ); tableViewer.setContentProvider( new TableContentProvider( tableViewer, leafOnly ) ); tableViewer.addSelectionChangedListener( selectionListener ); tableViewer.addDoubleClickListener( doubleClickListener ); }
Example 15
Source File: ValidationPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private Control createValidators(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 0).create()); Composite labelComp = new Composite(main, SWT.NONE); labelComp.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).numColumns(2) .spacing(2, SWT.DEFAULT).create()); labelComp.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create()); Label label = new Label(labelComp, SWT.NONE); label.setText(Messages.ValidationPreferencePage_LBL_Validators); Label helpImage = new Label(labelComp, SWT.NONE); helpImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP)); helpImage.setToolTipText(Messages.ValidationPreferencePage_EnablingValidatorWarning); Group group = new Group(main, SWT.NONE); group.setLayout(GridLayoutFactory.swtDefaults().margins(4, 4).create()); group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Table table = new Table(group, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setLayoutData(GridDataFactory.fillDefaults().hint(300, 100).grab(true, false).create()); table.setLinesVisible(true); table.setHeaderVisible(true); // set up columns // Name column TableColumn name = new TableColumn(table, SWT.LEFT); name.setWidth(250); name.setText(Messages.ValidationPreferencePage_NameColumn); name.setToolTipText(Messages.ValidationPreferencePage_NameColumn); // Build column TableColumn build = new TableColumn(table, SWT.CENTER); build.setWidth(40); build.setText(Messages.ValidationPreferencePage_BuildColumn); build.setToolTipText(Messages.ValidationPreferencePage_BuildColumn); // Reconcile column TableColumn reconcile = new TableColumn(table, SWT.CENTER); reconcile.setWidth(75); reconcile.setText(Messages.ValidationPreferencePage_ReconcileColumn); reconcile.setToolTipText(Messages.ValidationPreferencePage_ReconcileColumn); // Now set up table viewer! validatorsViewer = new TableViewer(table); // validatorsViewer.setUseHashlookup(true); validatorsViewer.setColumnProperties(new String[] { NAME, BUILD, RECONCILE }); // Assign the cell editors to the viewer validatorsViewer.setCellEditors(new CellEditor[] { null, new CheckboxCellEditor(table), new CheckboxCellEditor(table) }); // Set the cell modifier for the viewer validatorsViewer.setCellModifier(new ParticipantCellModifier(validatorsViewer)); // Now set up content/label providers validatorsViewer.setContentProvider(ArrayContentProvider.getInstance()); validatorsViewer.setLabelProvider(new ParticipantLabelProvider()); // Hide required participants validatorsViewer.addFilter(new RequiredParticipantFilter()); // check the selected build participant, show it's filters validatorsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateFilterExpressions(); } }); // Now set input validatorsViewer.setInput(this.participants); return main; }
Example 16
Source File: SelectConnectorImplementationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.None); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 10, 10, 0).create()); table = new TableViewer(composite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 200).create()); table.setContentProvider(contentProvider); table.setLabelProvider(labelProvider); table.addSelectionChangedListener(this); table.addDoubleClickListener(this); table.setInput(new Object()); context = new EMFDataBindingContext(); IValidator selectionValidator = value -> { if (value == null) { return ValidationStatus.error(Messages.selectAImplWarning); } return Status.OK_STATUS; }; UpdateValueStrategy selectionStrategy = new UpdateValueStrategy(); selectionStrategy.setBeforeSetValidator(selectionValidator); context.bindValue(ViewersObservables.observeSingleSelection(table), PojoProperties.value(SelectConnectorImplementationWizardPage.class, "selectedImplementation").observe(this), selectionStrategy, null); removeButton = new Button(composite, SWT.PUSH); removeButton.setText(Messages.remove); removeButton.setLayoutData(GridDataFactory.swtDefaults().hint(85, SWT.DEFAULT).create()); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (selectedImplementation != null) { String fileName = URI.decode(selectedImplementation.eResource().getURI().lastSegment()); IRepositoryFileStore file = implStore.getChild(fileName, true); file.delete(); refresh(); } } }); removeButton.setEnabled(false); pageSupport = WizardPageSupport.create(this, context); setControl(composite); }
Example 17
Source File: MakrosComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
/** * Create the composite. * * @param parent * @param style */ public MakrosComposite(Composite parent, int style){ super(parent, style); setLayout(new GridLayout(1, false)); CLabel lblHeader = new CLabel(this, SWT.NONE); lblHeader.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); lblHeader.setText("Makros des Anwender " + CoreHub.getLoggedInContact().getLabel()); SashForm sash = new SashForm(this, SWT.HORIZONTAL); sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite selectionComposite = new Composite(sash, SWT.NONE); selectionComposite.setLayout(new GridLayout(1, true)); ToolBarManager toolbar = new ToolBarManager(); ToolBar toolbarControl = toolbar.createControl(selectionComposite); toolbarControl.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); viewer = new TableViewer(selectionComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new DefaultLabelProvider()); viewer.setInput(getUserMakros(CoreHub.getLoggedInContact())); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event){ StructuredSelection selection = (StructuredSelection) viewer.getSelection(); if (selection != null && !selection.isEmpty()) { detailComposite.setMakro((MakroDTO) selection.getFirstElement()); } else { detailComposite.setMakro(null); } } }); viewer.setComparator(new ViewerComparator()); MenuManager menuManager = new MenuManager(); menuManager.add(new RemoveMakroAction(viewer)); MenuManager subMenu = new MenuManager("Marko zu Anwender kopieren"); subMenu.setRemoveAllWhenShown(true); subMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager){ addCopyToUserActions(manager); } }); menuManager.add(subMenu); Menu menu = menuManager.createContextMenu(viewer.getTable()); viewer.getTable().setMenu(menu); toolbar.add(new AddMakroAction(viewer)); toolbar.add(new RemoveMakroAction(viewer)); toolbar.add(new RefreshMakrosAction(viewer)); toolbar.update(true); detailComposite = new MakroDetailComposite(sash, SWT.NONE); // can only be set after child components are available sash.setWeights(new int[] { 1, 4 }); }
Example 18
Source File: DBConnectorsPreferencePage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createDBConnectorsList(Composite parent) { final Composite connectorListComposite = new Composite(parent, SWT.NONE); connectorListComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()); connectorListComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Text searchField = new Text(connectorListComposite, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL); searchField.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); searchField.setMessage(Messages.search); viewer = new TableViewer(connectorListComposite, SWT.BORDER | SWT.FULL_SELECTION); viewer.getTable().setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(200, SWT.DEFAULT).create()); viewer.setLabelProvider(new DabaBaseConnectorDefinitionLabelProvider()); viewer.setContentProvider(new DatabaseConnectorDefinitionContentProvider()); viewer.setInput(getCategory()); connectorFilter = new DbConnectorsPreferenceFilter(); viewer.addFilter(connectorFilter); searchField.addKeyListener(new KeyAdapter() { /* * (non-Javadoc) * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent) */ @Override public void keyReleased(KeyEvent e) { connectorFilter.setSearchText(searchField.getText()); viewer.refresh(); } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final ConnectorDefinition def = getSelectedConnector(); if (def != null) { final String defId = def.getId(); automaticallyAddDriver.setSelection(getAutoAddDriverProperty(defId)); driversLabelProvider.setDefaultDriver(getDefaultDriver(defId)); driverManagerViewer.setInput(defId); } } }); }
Example 19
Source File: SdkEnvironmentControl.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
/** * Create the composite. * @param parent * @param style * @param editedSdk */ public SdkEnvironmentControl(Composite parent, int style, final Sdk editedSdk) { super(parent, style); this.editedSdk = editedSdk; selectedVar = null; setLayoutData(new GridData(GridData.FILL_BOTH)); setLayout(SwtUtils.removeMargins(new GridLayout(2, false))); Composite tableComposite = new Composite(this, SWT.NONE); tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); tableComposite.setLayout(new GridLayout(1, false)); tableComposite.setBackground(new Color(Display.getDefault(), 255,0,0)); tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION); table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); columnName = new TableViewerColumn(tableViewer, SWT.NONE); tblclmnName = columnName.getColumn(); tableColumnLayout.setColumnData(tblclmnName, new ColumnPixelData(150, true, true)); tblclmnName.setText(Messages.SdkEnvironmentControl_Variable); columnLocation = new TableViewerColumn(tableViewer, SWT.NONE); tblclmnLocation = columnLocation.getColumn(); tableColumnLayout.setColumnData(tblclmnLocation, new ColumnPixelData(150, true, true)); tblclmnLocation.setText(Messages.SdkEnvironmentControl_Value); tableViewer.setContentProvider(new SdkEnvContentProvider()); tableViewer.setLabelProvider(new SdkEnvLabelProvider()); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { TableItem[] selectedItems = table.getSelection(); boolean isEnabled = selectedItems.length > 0; btnEdit.setEnabled(isEnabled); btnDelete.setEnabled(isEnabled); selectedVar = isEnabled ? (String)selectedItems[0].getData() : null; } }); Composite buttonsComposite = new Composite(this, SWT.NONE); buttonsComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); buttonsComposite.setLayout(SwtUtils.removeMargins(new GridLayout(1, false))); btnNew = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_New, null); btnNew.addSelectionListener(new AddVarButtonHandler()); btnEdit = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_Edit, null); btnEdit.addSelectionListener(new EditValueButtonHandler()); btnEdit.setEnabled(false); btnDelete = SWTFactory.createPushButton(buttonsComposite, Messages.SdkEnvironmentControl_Delete, null); btnDelete.setEnabled(false); btnDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (selectedVar != null) { editedSdk.removeEnvironmentVariable(selectedVar); tableViewer.setInput(editedSdk); } } }); tableViewer.setInput(editedSdk); }
Example 20
Source File: NewProjectWizardTemplateSelectionPage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); main.setLayout(new GridLayout(1, false)); Label availableTemplatesLabel = new Label(main, SWT.NONE); availableTemplatesLabel.setText(Messages.NewProjectWizardTemplateSelectionPage_available_templates); availableTemplatesLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false)); SashForm sash = new SashForm(main, SWT.HORIZONTAL); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.widthHint = 400; sash.setLayoutData(data); TableViewer templateTable = new TableViewer(sash, SWT.BORDER); templateTable.setContentProvider(new ArrayContentProvider()); templateTable.setLabelProvider(labelProvider); AbstractProjectTemplate[] templates = loadTemplatesFromExtensionPoint(); templateTable.setInput(templates); FormText text = new FormText(sash, SWT.BORDER); text.setText("", false, false); //$NON-NLS-1$ text.setBackground(templateTable.getTable().getBackground()); // register images for (AbstractProjectTemplate template : templates) { for (Pair<String, Image> image : template.getImages()) { text.setImage(image.getKey(), image.getValue()); } } templateTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element instanceof AbstractProjectTemplate) { selectedTemplate = (AbstractProjectTemplate) element; setPageComplete(true); String content = "<form>" + selectedTemplate.getDescription() + "</form>"; //$NON-NLS-1$ //$NON-NLS-2$ try { text.setText(content, true, true); } catch (Exception e) { text.setText(e.getMessage(), false, false); } } else { selectedTemplate = null; text.setText("", false, false); //$NON-NLS-1$ setPageComplete(false); } } else { selectedTemplate = null; text.setText("", false, false); //$NON-NLS-1$ setPageComplete(false); } } }); templateTable.setSelection(new StructuredSelection(templateTable.getElementAt(0))); setControl(main); }