Java Code Examples for org.eclipse.jface.viewers.TreeViewerColumn#getColumn()
The following examples show how to use
org.eclipse.jface.viewers.TreeViewerColumn#getColumn() .
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: 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 3
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 4
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 5
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 6
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 7
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 8
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 9
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; }