Java Code Examples for org.eclipse.swt.widgets.TreeColumn#getWidth()
The following examples show how to use
org.eclipse.swt.widgets.TreeColumn#getWidth() .
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: XViewer.java From nebula with Eclipse Public License 2.0 | 6 votes |
public Integer getColumnNumberUnderMouseClick(Point point) { int[] columnOrder = getTree().getColumnOrder(); int sum = 0; int columnCount = 0; for (int column : columnOrder) { TreeColumn col = getTree().getColumn(column); sum = sum + col.getWidth(); if (sum > point.x) { break; } columnCount++; } if (columnCount > columnOrder.length - 1) { return null; } return columnOrder[columnCount]; }
Example 2
Source File: XViewer.java From nebula with Eclipse Public License 2.0 | 5 votes |
public int getCurrentColumnWidth(XViewerColumn xCol) { for (TreeColumn col : getTree().getColumns()) { if (col.getText().equals(xCol.getName())) { return col.getWidth(); } } return 0; }
Example 3
Source File: TreeConflictsView.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public void createPartControl(Composite parent) { GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.numColumns = 1; parent.setLayout(layout); treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION); treeViewer.setLabelProvider(new ConflictsLabelProvider()); treeViewer.setContentProvider(new ConflictsContentProvider()); treeViewer.setUseHashlookup(true); GridData layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; layoutData.horizontalAlignment = GridData.FILL; layoutData.verticalAlignment = GridData.FILL; treeViewer.getControl().setLayoutData(layoutData); TableLayout tableLayout = new TableLayout(); treeViewer.getTree().setLayout(tableLayout); DisposeListener disposeListener = new DisposeListener() { public void widgetDisposed(DisposeEvent e) { TreeColumn col = (TreeColumn)e.getSource(); if (col.getWidth() > 0) settings.put("TreeConflictsView.col." + col.getText(), col.getWidth()); //$NON-NLS-1$ } }; for (int i = 0; i < columnHeaders.length; i++) { TreeColumn tc = new TreeColumn(treeViewer.getTree(), SWT.NONE,i); tc.setResizable(columnLayouts[i].resizable); tc.setText(columnHeaders[i]); setColumnWidth(tableLayout, disposeListener, tc, i); } treeViewer.getTree().setHeaderVisible(true); treeViewer.getTree().setLinesVisible(false); treeViewer.setInput(this); treeViewer.addOpenListener(new IOpenListener() { public void open(OpenEvent evt) { openAction.run(); } }); createMenus(); createToolbar(); String path = settings.get("TreeConflictsView.resource"); //$NON-NLS-1$ if (path != null) { boolean container = settings.getBoolean("TreeConflictsView.container"); //$NON-NLS-1$ if (container) resource = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(path)); else resource = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path)); } if (resource == null) setContentDescription(Policy.bind("TreeConflictsView.noResource")); //$NON-NLS-1$ else setContentDescription(resource.getFullPath().toString()); }