org.eclipse.jface.viewers.TreeViewerColumn Java Examples
The following examples show how to use
org.eclipse.jface.viewers.TreeViewerColumn.
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: TreeViewerBuilder.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override protected TreeViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout, final int style) { final TreeViewer viewer = new TreeViewer(parent, virual ? (style | VIRTUAL) : style); final Tree tree = viewer.getTree(); tree.setLinesVisible(linesVisible); tree.setHeaderVisible(headerVisible); int columnIndex = 0; for (final String columnLabel : columnLabels) { final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, NONE); final TreeColumn column = viewerColumn.getColumn(); columnLayout.setColumnData(column, createColumnLayoutData(columnIndex)); column.setText(columnLabel); column.setMoveable(moveable); columnIndex++; } return viewer; }
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: TableViewerFontSize.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
@PostConstruct public void postConstruct(Composite parent) { ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent); TreeViewer viewer = new TreeViewer(parent); viewer.setContentProvider(new TreeContentProvider()); viewer.getTree().setHeaderVisible(true); viewer.getTree().setLinesVisible(true); viewer.getTree().setFont(resourceManager.createFont(FontDescriptor.createFrom("Arial", 32, SWT.ITALIC))); TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE); viewerColumn.getColumn().setWidth(300); viewerColumn.getColumn().setText("Names"); viewerColumn.setLabelProvider(new ColumnLabelProvider()); viewer.setInput(new String[] { "Simon Scholz", "Lars Vogel", "Dirk Fauth", "Wim Jongman", "Tom Schindl" }); GridLayoutFactory.fillDefaults().generateLayout(parent); }
Example #4
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 #5
Source File: BusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createBusinessObjectColumn(TreeViewer viewer, AbstractBdmFormPage formPage) { TreeViewerColumn column = new TreeViewerColumn(viewer, SWT.NONE); column.setLabelProvider(new LabelProviderBuilder<>() .withTextProvider(this::getName) .withImageProvider(this::getIcon) .withStatusProvider( businessObjectStatusProvider(new BusinessObjectListValidator(formPage.observeWorkingCopy()))) .shouldRefreshAllLabels(viewer) .createColumnLabelProvider()); addEditingSupport(viewer, formPage, column); }
Example #6
Source File: LaborResultsComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private List<LabResult> getSelectedResults(ViewerCell cell){ if (cell != null && cell.getColumnIndex() > 2) { TreeViewerColumn column = resultColumns.get(cell.getColumnIndex() - 3); TimeTool time = (TimeTool) column.getColumn().getData(COLUMN_DATE_KEY); if ((time != null) && (cell.getElement() instanceof LaborItemResults)) { LaborItemResults results = (LaborItemResults) cell.getElement(); return results.getResult(time.toString(TimeTool.DATE_COMPACT)); } } return null; }
Example #7
Source File: LabResultEditingSupport.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public LabResultEditingSupport(LaborResultsComposite laborResultsComposite, TreeViewer viewer, TreeViewerColumn column){ super(viewer); this.column = column; this.composite = laborResultsComposite; setUpCellEditor(viewer); addValidator(); }
Example #8
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 #9
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 #10
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 #11
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 #12
Source File: ModelSortPageableTreeExample.java From nebula with Eclipse Public License 2.0 | 5 votes |
private static TreeViewerColumn createTreeViewerColumn(TreeViewer viewer, String title, int bound) { final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE); final TreeColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); return viewerColumn; }
Example #13
Source File: SmartImportBdmPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createModelColumn() { TreeViewerColumn modelColumn = new TreeViewerColumn(viewer, SWT.NONE); modelColumn.getColumn().setText(Messages.businessDataModelPreview); modelColumn.setLabelProvider(new LabelProviderBuilder<SmartImportableUnit>() .withStyledStringProvider(this::styledStringProvider) .withTooltipProvider(SmartImportableUnit::getToolTipText) .createStyledCellLabelProvider()); }
Example #14
Source File: AbapGitDialogObjLog.java From ADT_Frontend with MIT License | 5 votes |
private TreeViewerColumn createTableViewerColumn(String title, int bound) { TreeViewerColumn viewerColumn = new TreeViewerColumn(this.abapObjTable, SWT.NONE); TreeColumn column = viewerColumn.getColumn(); column.setText(title); column.setWidth(bound); column.setResizable(true); column.setMoveable(true); //-> still present for proper search if (column.getText().equals("Type")) { //$NON-NLS-1$ column.setWidth(0); column.setResizable(false); } return viewerColumn; }
Example #15
Source File: OffsetDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private TreeViewerColumn createTreeViewerColumn(String title, int style) { final TreeViewerColumn viewerColumn = new TreeViewerColumn(fViewer.getViewer(), style); final TreeColumn column = viewerColumn.getColumn(); column.setText(title); column.setResizable(true); return viewerColumn; }
Example #16
Source File: ErrorTraceTreeViewer.java From tlaplus with MIT License | 5 votes |
void setColumnForIndex(final TreeViewerColumn column, final int index) { columns[index] = column.getColumn(); if (index == 0) { // I [N.B. no idea who "I" is] need to add a listener for size changes to column[0] to // detect when the user has tried to resize the individual columns. The following might work, // if I can figure out the real event type to use. columns[0].addListener(SWT.Resize, this); } }
Example #17
Source File: ErrorTraceTreeViewer.java From tlaplus with MIT License | 4 votes |
ErrorTraceTreeViewer(final Tree parent, final ModelEditor associatedModelEditor) { treeViewer = new TreeViewer(parent); treeViewer.setUseHashlookup(true); treeViewer.setContentProvider(new StateContentProvider()); ColumnViewerToolTipSupport.enableFor(treeViewer); final TraceDisplayResizer resizer = new TraceDisplayResizer(parent); final StateLabelProvider labelProvider = new StateLabelProvider(); for (int i = 0; i < COLUMN_TEXTS.length; i++) { final TreeViewerColumn column = new TreeViewerColumn(treeViewer, i); column.getColumn().setText(COLUMN_TEXTS[i]); column.getColumn().setWidth(COLUMN_WIDTH[i]); column.setLabelProvider(labelProvider); resizer.setColumnForIndex(column, i); column.getColumn().addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { // reverse the current trace final TLCError error = (TLCError) treeViewer.getInput(); error.reverseTrace(); // Reset the viewer's selection to the empty selection. With empty // selection, the subsequent refresh call does *not* invalidate the // StateContentProvider's lazy policy. // We know that the user clicked on the tree's column header // and the real selection is of little importance. treeViewer.setSelection(new ISelection() { public boolean isEmpty() { return true; } }); treeViewer.refresh(false); // remember the order for next trace shown final IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); dialogSettings.put(TLCModelLaunchDataProvider.STATESORTORDER, !dialogSettings.getBoolean(TLCModelLaunchDataProvider.STATESORTORDER)); } }); } parent.addControlListener(resizer); errorTraceFontChangeListener = (event) -> { if ((event == null) || event.getProperty().equals(ITLCPreferenceConstants.I_TLC_ERROR_TRACE_FONT)) { final Font f = JFaceResources.getFont(ITLCPreferenceConstants.I_TLC_ERROR_TRACE_FONT); JFaceResources.getFontRegistry().put(TLCErrorView.JFACE_ERROR_TRACE_ID, f.getFontData()); if (treeViewer != null) { treeViewer.refresh(true); } } }; errorTraceFontChangeListener.propertyChange(null); JFaceResources.getFontRegistry().addListener(errorTraceFontChangeListener); createContextMenu(); setModelEditor(associatedModelEditor); }
Example #18
Source File: ChangeNewDateSelection.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public ChangeNewDateSelection(TreeViewerColumn column, LaborResultsComposite laborResultsComposite){ this.column = column; this.composite = laborResultsComposite; }
Example #19
Source File: FlagsDetailsPart.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void createPart ( final Composite parent ) { super.createPart ( parent ); this.viewer = new TreeViewer ( parent ); final IObservableFactory factory = new IObservableFactory () { @Override public IObservable createObservable ( final Object target ) { if ( target instanceof IObservable ) { return (IObservable)target; } else if ( target instanceof GroupEntry ) { return ( (GroupEntry)target ).getEntries (); } return null; } }; final ObservableSetTreeContentProvider contentProvider = new ObservableSetTreeContentProvider ( factory, null ); this.viewer.setContentProvider ( contentProvider ); final TableLayout tableLayout = new TableLayout (); this.col1 = new TreeViewerColumn ( this.viewer, SWT.NONE ); this.col1.getColumn ().setText ( Messages.FlagsDetailsPart_ColFlagLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 100 ) ); this.col1.setLabelProvider ( new ColumnLabelLabelProvider ( contentProvider.getRealizedElements () ) ); this.col2 = new TreeViewerColumn ( this.viewer, SWT.NONE ); this.col2.getColumn ().setText ( Messages.FlagsDetailsPart_ColStateLabel ); tableLayout.addColumnData ( new ColumnWeightData ( 100 ) ); this.col2.setLabelProvider ( new ColumnLabelStateProvider ( contentProvider.getRealizedElements () ) ); this.viewer.getTree ().setHeaderVisible ( true ); this.viewer.getTree ().setLayout ( tableLayout ); this.viewer.setUseHashlookup ( true ); this.viewer.setInput ( this.groupSet ); this.groupSet.add ( new GroupEntry ( "error", Messages.FlagsDetailsPart_GroupErrorLabel ) ); //$NON-NLS-1$ this.groupSet.add ( new GroupEntry ( "alarm", Messages.FlagsDetailsPart_GroupAlarmLabel ) ); //$NON-NLS-1$ this.groupSet.add ( new GroupEntry ( "warning", Messages.FlagsDetailsPart_GroupWarningLabel ) ); //$NON-NLS-1$ this.groupSet.add ( new GroupEntry ( "blocked", Messages.FlagsDetailsPart_GroupBlockingLabel ) ); //$NON-NLS-1$ this.groupSet.add ( new GroupEntry ( "ackRequired", Messages.FlagsDetailsPart_GroupAknLabel ) ); //$NON-NLS-1$ this.groupSet.add ( new GroupEntry ( "manual", Messages.FlagsDetailsPart_ManualLabel ) ); //$NON-NLS-1$ }
Example #20
Source File: LaborResultsLabelProvider.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public LaborResultsLabelProvider(TreeViewerColumn column){ this.column = column; }
Example #21
Source File: ChangeResultsDateSelection.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public ChangeResultsDateSelection(TreeViewerColumn column, LaborResultsComposite laborResultsComposite){ this.column = column; this.composite = laborResultsComposite; }
Example #22
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); }
Example #23
Source File: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected TreeViewerColumn createColumnViewer(final String text, final int style) { final TreeViewerColumn columnViewer = new TreeViewerColumn(this, style); final TreeColumn column = columnViewer.getColumn(); column.setText(text); return columnViewer; }
Example #24
Source File: CodeRecommendationResultsView.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * Create the composite. * * @param parent * @param style */ public CodeRecommendationResultsView() { super(SWT.NONE); setBackgroundMode(SWT.INHERIT_FORCE); setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); setLayout(new FillLayout(SWT.HORIZONTAL)); treeViewer = new TreeViewer(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); treeViewer.setAutoExpandLevel(3); Tree tree = treeViewer.getTree(); tree.setHeaderVisible(true); TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE); TreeColumn trclmnCodeRecommendations = treeViewerColumn.getColumn(); trclmnCodeRecommendations.setResizable(false); trclmnCodeRecommendations.setText("Code recommendations"); treeViewer.setContentProvider(contentProvider = new TreeContentProvider()); treeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider = new TreeLabelProvider())); tree.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeItem item = (TreeItem) e.item; Object data = item.getData(); if (data instanceof ICodeRecommendationElement) { ICodeRecommendationElement element = (ICodeRecommendationElement) data; eventManager.invoke(l -> l.onCodeRecommendationSelected(element)); } } }); treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { TreeViewer viewer = (TreeViewer) event.getViewer(); IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection(); Object selectedNode = thisSelection.getFirstElement(); if (selectedNode instanceof CodeRecommendationTarget) { CodeRecommendationTarget target = (CodeRecommendationTarget) selectedNode; eventManager.invoke(l -> l.onTargetDoubleClicked(target)); } } }); createContextMenu(treeViewer); }
Example #25
Source File: AdvancePropertyDescriptor.java From birt with Eclipse Public License 1.0 | 4 votes |
public Control createControl( Composite parent ) { container = new Composite( parent, SWT.NONE ); GridLayout layout = UIUtil.createGridLayoutWithoutMargin( 1, false ); layout.marginTop = 2; layout.marginWidth = layout.marginBottom = 1; container.setLayout( layout ); container.setLayoutData( new GridData( GridData.FILL_BOTH ) ); initSortingType( ); viewer = new CustomTreeViewer( container, SWT.FULL_SELECTION ); tableTree = viewer.getTree( ); GridData gd = new GridData( GridData.FILL_BOTH ); tableTree.setLayoutData( gd ); tableTree.setHeaderVisible( true ); tableTree.setLinesVisible( true ); viewer.setContentProvider( provider.getContentProvier( ) ); TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE ); tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY ); tvc1.getColumn( ).setWidth( 300 ); tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getNameLabelProvier( ) ) ); TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE ); tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE ); tvc2.getColumn( ).setWidth( 400 ); tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getValueLabelProvier( ) ) ); AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( ); sorter.setAscending( true ); viewer.setSorter( sorter ); hookControl( ); // create a new table tree editor tableTreeEditor = new TreeEditor( tableTree ); // create the editor listener createEditorListener( ); MementoBuilder builder = new MementoBuilder( ); if ( ( propertySheetMemento = builder.getRootMemento( ) .getChild( IPageLayout.ID_PROP_SHEET ) ) == null ) { propertySheetMemento = builder.getRootMemento( ) .createChild( IPageLayout.ID_PROP_SHEET, MementoElement.Type_View ); } if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null ) { viewerMemento = propertySheetMemento.createChild( propertyViewerID, MementoElement.Type_Viewer ); } return container; }
Example #26
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 #27
Source File: ReadOnlyBusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected void addEditingSupport(TreeViewer viewer, AbstractBdmFormPage formPage, TreeViewerColumn column) { // Nothing }
Example #28
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 #29
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 #30
Source File: ReportPropertySheetPage.java From birt with Eclipse Public License 1.0 | 4 votes |
public void createControl( Composite parent ) { container = new Composite( parent, SWT.NONE ); GridLayout layout = new GridLayout( ); layout.marginWidth = layout.marginHeight = 0; container.setLayout( layout ); title = new TabbedPropertyTitle( container, FormWidgetFactory.getInstance( ) ); title.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); title.setActions( new Action[]{ new GroupSortingAction( ), new AlphabeticSortingAction( ), new LocalModelAction( ) } ); Composite viewerContainer = new Composite( container, SWT.NONE ); layout = new GridLayout( ); layout.marginWidth = 10; layout.marginHeight = 3; viewerContainer.setLayout( layout ); viewerContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) ); viewer = new CustomTreeViewer( viewerContainer, SWT.FULL_SELECTION ); tableTree = viewer.getTree( ); tableTree.setLayoutData( new GridData( GridData.FILL_BOTH ) ); tableTree.setHeaderVisible( true ); tableTree.setLinesVisible( true ); viewer.setContentProvider( provider ); TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE ); tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY ); tvc1.getColumn( ).setWidth( 300 ); tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetNameLabelProvider( ) ) ); TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE ); tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE ); tvc2.getColumn( ).setWidth( 400 ); tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetValueLabelProvider( ) ) ); AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( ); sorter.setAscending( true ); viewer.setSorter( sorter ); hookControl( ); // create a new table tree editor tableTreeEditor = new TreeEditor( tableTree ); // create the editor listener createEditorListener( ); handleGlobalAction( ); // suport the mediator SessionHandleAdapter.getInstance( ) .getMediator( moduleHandle ) .addColleague( this ); FormWidgetFactory.getInstance( ).paintFormStyle( parent ); FormWidgetFactory.getInstance( ).adapt( parent ); IWorkbenchPage page = getSite( ).getPage( ); MementoBuilder builder = new MementoBuilder( ); if ( ( propertySheetMemento = builder.getRootMemento( ) .getChild( IPageLayout.ID_PROP_SHEET ) ) == null ) { propertySheetMemento = builder.getRootMemento( ) .createChild( IPageLayout.ID_PROP_SHEET, MementoElement.Type_View ); } if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null ) { viewerMemento = propertySheetMemento.createChild( propertyViewerID, MementoElement.Type_Viewer ); } page.addSelectionListener( this ); // handleSelectionChanged( page.getSelection( ) ); }