Java Code Examples for org.eclipse.jface.viewers.TreeViewerColumn#setEditingSupport()
The following examples show how to use
org.eclipse.jface.viewers.TreeViewerColumn#setEditingSupport() .
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: SmartImportBdmPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createActionColumn() { TreeViewerColumn actionColumn = new TreeViewerColumn(viewer, SWT.NONE); actionColumn.getColumn().setText(Messages.importAction); actionColumn.setLabelProvider(new LabelProviderBuilder<SmartImportableUnit>() .withStyledStringProvider(this::getActionStyledString) .createStyledCellLabelProvider()); actionColumn.setEditingSupport( new ComboBoxEditingSupportBuilder<SmartImportableUnit, ImportAction>(actionColumn.getViewer()) .withCanEditProvider( element -> importBdmModelObservable.getValue() instanceof OverwriteImportBdmModel ? false : element instanceof SmartImportPackageModel && isConflicting(element)) .withValueProvider(SmartImportableUnit::getImportAction) .withValueUpdater((element, value) -> { element.setImportAction(value); importBdmModelObservable.getValue() .updateSmartImportPackageModel((SmartImportPackageModel) element); viewer.refresh(element); }) .withInput(new ImportAction[] { ImportAction.OVERWRITE, ImportAction.KEEP }) .withData(IMPORT_ACTION_COMBO_EDITOR_ID) .create()); }
Example 2
Source File: BusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void addEditingSupport(TreeViewer viewer, AbstractBdmFormPage formPage, TreeViewerColumn column) { column.setEditingSupport(new EditingSupportBuilder<>(viewer) .withId(SWTBotConstants.SWTBOT_ID_BO_NAME_TEXTEDITOR) .withValueProvider(this::getName) .withValueUpdater((elt, name) -> { if (!Objects.equals(getName(elt), name)) { updateName(elt, (String) name, formPage); formPage.getEditorContribution().refreshBusinessObjectList(); formPage.getEditorContribution().refreshConstraintList(); formPage.getEditorContribution().refreshIndexList(); formPage.getEditorContribution().refreshQueryViewers(); formPage.refactorAccessControl(); } }) .create()); }
Example 3
Source File: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createInputNameColumn() { final TreeViewerColumn nameColumnViewer = createColumnViewer(Messages.name + " *", SWT.FILL); nameColumnViewer.setLabelProvider(new InputNameCellLabelProvider(propertySourceProvider, knownElements())); final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(this, messageManager, emfDataBindingContext, new ContractInputRefactorOperationFactory(), progressService); editingSupport.setControlId(SWTBotConstants.SWTBOT_ID_INPUT_NAME_TEXTEDITOR); nameColumnViewer.setEditingSupport(editingSupport); }
Example 4
Source File: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createInputDescriptionColumn() { final TreeViewerColumn descriptionColumnViewer = createColumnViewer(Messages.description, SWT.FILL); final TreeColumn column = descriptionColumnViewer.getColumn(); column.setToolTipText(Messages.contractInputDescriptionTooltip); column.setImage(sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK)); descriptionColumnViewer.setLabelProvider(new DescriptionCellLabelProvider(propertySourceProvider, knownElements())); final DescriptionObservableEditingSupport editingSupport = new DescriptionObservableEditingSupport(this, messageManager, emfDataBindingContext); editingSupport.setControlId(SWTBotConstants.SWTBOT_ID_INPUT_DESCRIPTION_TEXTEDITOR); descriptionColumnViewer.setEditingSupport(editingSupport); }
Example 5
Source File: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createInputTypeColumn() { final TreeViewerColumn typeColumnViewer = createColumnViewer(Messages.type, SWT.FILL); typeColumnViewer.setLabelProvider(new ContractInputTypeCellLabelProvider()); typeColumnViewer .setEditingSupport(new ContractInputTypeEditingSupport(this, propertySourceProvider, inputController, new ContractInputRefactorOperationFactory(), progressService, TransactionalEditingDomain.Factory.INSTANCE)); }
Example 6
Source File: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createMultipleColumn() { final TreeViewerColumn multipleColumnViewer = createColumnViewer(Messages.multiple, SWT.CENTER); multipleColumnViewer .setLabelProvider(new MultipleInputCheckboxLabelProvider(multipleColumnViewer.getViewer(), knownElements())); multipleColumnViewer.setEditingSupport(new CheckboxPropertyEditingSupport(propertySourceProvider, this, ProcessPackage.Literals.CONTRACT_INPUT__MULTIPLE.getName())); }
Example 7
Source File: GenerericTreeViewer.java From offspring with MIT License | 4 votes |
private void createColumns() { GC gc = new GC(getTree().getParent()); List<Integer> widths = new ArrayList<Integer>(); for (final IGenericTableColumn c : table.getColumns()) { TreeViewerColumn viewerColumn = new TreeViewerColumn(this, SWT.NONE); viewerColumn.setLabelProvider(new GenericLabelProvider(c .getDataProvider())); if (c.getEditable()) { viewerColumn.setEditingSupport(c.getEditingSupport(this)); } TreeColumn column = viewerColumn.getColumn(); if (c.getSortable() && comparator != null) { column.addSelectionListener(getSelectionAdapter(column, c)); } column.setText(c.getLabel()); column.setAlignment(c.getAlignMent()); int width; if (c.getWidth() != -1) { width = c.getWidth(); } else if (c.getTextExtent() != null && c.getLabel().length() < c.getTextExtent().length()) { width = gc.textExtent(c.getTextExtent()).x + 2; } else { width = gc.textExtent(c.getLabel()).x + 2; } widths.add(width); column.setWidth(width); column.setResizable(c.getResizable()); } gc.dispose(); // /* All columns have their prefered width set now calculate percentages */ // TreeColumnLayout layout = new TreeColumnLayout(); // for (int i = 0; i < widths.size(); i++) { // layout.setColumnData(getTree().getColumns()[i], new ColumnWeightData( // widths.get(i), widths.get(i), true)); // } // getTree().getParent().setLayout(layout); }
Example 8
Source File: PromptParameterDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
private void createParameterGroup( Composite composite ) { final Group group2 = new Group( composite, SWT.NONE ); group2.setLayout( new GridLayout( ) ); group2.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 8 ) );// GridData.FILL_BOTH)); group2.setText( Messages.getString( "PromptParameterDialog.parameterGroup.title" ) ); Label label1 = new Label( group2, SWT.NONE ); label1.setText( Messages.getString( "PromptParameterDialog.parameterGroup.label" ) ); TreeViewer viewer2 = new TreeViewer( group2, SWT.FULL_SELECTION ); Tree tableTree2 = viewer2.getTree( ); GridData gd = new GridData( GridData.FILL_BOTH ); tableTree2.setLayoutData( gd ); tableTree2.setHeaderVisible( true ); tableTree2.setLinesVisible( true ); TreeViewerColumn tvc21 = new TreeViewerColumn( viewer2, SWT.NONE ); tvc21.getColumn( ) .setText( Messages.getString( "PromptParameterDialog.parameterGroup.nameColumn" ) ); //$NON-NLS-1$ tvc21.getColumn( ).setWidth( 200 ); tvc21.setLabelProvider( new NameLabelProvider( selectedStatusMap ) ); tvc21.setEditingSupport( new ParameterEditingSupport( viewer2, selectedStatusMap ) ); TreeViewerColumn tvc22 = new TreeViewerColumn( viewer2, SWT.NONE ); tvc22.getColumn( ) .setText( Messages.getString( "PromptParameterDialog.parameterGroup.previousValue" ) ); //$NON-NLS-1$ tvc22.getColumn( ).setWidth( 200 ); tvc22.setLabelProvider( new PreviousValueLabelProvider( ) ); TreeViewerColumn tvc23 = new TreeViewerColumn( viewer2, SWT.NONE ); tvc23.getColumn( ) .setText( Messages.getString( "PromptParameterDialog.parameterGroup.revisedValue" ) ); //$NON-NLS-1$ tvc23.getColumn( ).setWidth( 200 ); tvc23.setLabelProvider( new RevisedValueLabelProvider( ) ); viewer2.setContentProvider( new ParameterContentProvider( ) ); viewer2.setInput( ( (IAmbiguousOption) input ).getAmbiguousParameters( ) ); viewer2.expandAll( ); }
Example 9
Source File: ImportBosArchiveControlSupplier.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private Composite createTree(Composite parent) { final Composite fileTreeGroup = new Composite(parent, SWT.NONE); fileTreeGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 5).create()); fileTreeGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewer = new TreeViewer(fileTreeGroup, SWT.VIRTUAL | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); viewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(600, SWT.DEFAULT).create()); provider = new ArchiveTreeContentProvider(viewer); viewer.setContentProvider(provider); viewer.setUseHashlookup(true); // important for lazy behavior! viewer.getTree().setHeaderVisible(true); viewer.getTree().setLinesVisible(true); final TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(6, true)); layout.addColumnData(new ColumnWeightData(2, true)); viewer.getTree().setLayout(layout); ColumnViewerToolTipSupport.enableFor(viewer); final TreeViewerColumn archiveColumn = new TreeViewerColumn(viewer, SWT.NONE); archiveColumn.getColumn().setText(Messages.archiveColumn); archiveColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new ImportModelLabelProvider( new ImportModelStyler()))); final TreeViewerColumn actionColumn = new TreeViewerColumn(viewer, SWT.NONE); actionColumn.getColumn().setText(Messages.actionColumn); actionColumn.setLabelProvider(new LabelProviderBuilder<>() .withTextProvider(this::getActionText) .createColumnLabelProvider()); actionColumn.setEditingSupport(new ImportActionEditingSupport(viewer)); final Composite buttonsComposite = new Composite(fileTreeGroup, SWT.NONE); buttonsComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(5, 2).create()); buttonsComposite.setLayoutData( GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).create()); importActionSelector = new ImportActionSelector(viewer); overwriteButton = new ButtonWidget.Builder() .withLabel(Messages.overwriteAll) .alignLeft() .fill() .grabHorizontalSpace() .minimumWidth(BUTTON_WIDTH) .onClick(importActionSelector::selectOverwriteAll) .createIn(buttonsComposite); overwriteButton.disable(); keepAllButton = new ButtonWidget.Builder() .withLabel(Messages.keepAll) .alignLeft() .fill() .minimumWidth(BUTTON_WIDTH) .grabHorizontalSpace() .onClick(importActionSelector::selectKeepAll) .createIn(buttonsComposite); keepAllButton.disable(); return fileTreeGroup; }
Example 10
Source File: CreateContractInputFromBusinessObjectWizardPage.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createProcessDataMappingTreeViewer(Composite composite, EMFDataBindingContext dbc) { final Composite viewerComposite = new Composite(composite, SWT.NONE); viewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); viewerComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 15).create()); createButtonComposite(viewerComposite); treeViewer = new CheckboxTreeViewer(viewerComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); treeViewer.getTree() .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 200).create()); treeViewer.getTree().setHeaderVisible(true); treeViewer.addFilter(hidePersistenceIdMapping()); final FieldToContractInputMappingViewerCheckStateManager manager = new FieldToContractInputMappingViewerCheckStateManager(); treeViewer.addCheckStateListener(manager); treeViewer.setCheckStateProvider(manager); final ObservableListTreeContentProvider provider = new ObservableListTreeContentProvider( new FieldToContractInputMappingObservableFactory(), new FieldToContractInputMappingTreeStructureAdvisor()); treeViewer.setContentProvider(provider); final TreeViewerColumn nameTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL); nameTreeViewerColumn.getColumn().setText(Messages.attributeName); nameTreeViewerColumn.getColumn().setWidth(250); lazyFieldStatusProvider = new UnselectLazyReferencesInMultipleContainer(); nameTreeViewerColumn.setLabelProvider(new FieldNameColumnLabelProvider(lazyFieldStatusProvider)); final TreeViewerColumn typeTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL); typeTreeViewerColumn.getColumn().setText(Messages.attributetype); typeTreeViewerColumn.getColumn().setWidth(150); typeTreeViewerColumn.setLabelProvider(new FieldTypeColumnLabelProvider()); final TreeViewerColumn inputTypeTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL); inputTypeTreeViewerColumn.getColumn().setText(Messages.inputType); inputTypeTreeViewerColumn.getColumn().setWidth(150); inputTypeTreeViewerColumn.setLabelProvider(new InputTypeColumnLabelProvider(contract)); inputTypeTreeViewerColumn.setEditingSupport(new ContractInputTypeEditingSupport(treeViewer, contract)); final TreeViewerColumn mandatoryTreeViewerColumn = new TreeViewerColumn(treeViewer, SWT.FILL); mandatoryTreeViewerColumn.getColumn().setText(Messages.mandatory); mandatoryTreeViewerColumn.getColumn().setWidth(80); mandatoryTreeViewerColumn.setLabelProvider(new MandatoryColumnLabelProvider()); IViewerObservableSet checkedElements = ViewersObservables.observeCheckedElements(treeViewer, FieldToContractInputMapping.class); final IObservableValue<FieldToContractInputMapping> observeInput = ViewersObservables.observeInput(treeViewer); dbc.bindValue(observeInput, selectedDataObservable, null, UpdateStrategyFactory.updateValueStrategy().withConverter(selectedDataToFieldMappings()).create()); generationOptions.getEditModeObservable().addValueChangeListener(event -> { if (selectedDataObservable.getValue() instanceof BusinessObjectData) { createMapping(selectedDataObservable.getValue()); treeViewer.setInput(mappings); } }); createButtonListeners(checkedElements); multiValidator = new EmptySelectionMultivalidator(selectedDataObservable, checkedElements, mappings, contract.eContainer(), generationOptions.getEditModeObservable()); dbc.addValidationStatusProvider(multiValidator); new Label(viewerComposite, SWT.NONE); //FILLER Link formGenerationDocLink = new Link(viewerComposite, SWT.NONE); formGenerationDocLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); formGenerationDocLink.setText(Messages.moreInfoFormGenerationLink); formGenerationDocLink.addListener(SWT.Selection, event -> openBrowser(FORM_GENERATION_REDIRECT_ID)); ColumnViewerToolTipSupport.enableFor(treeViewer); }