List of usage examples for org.eclipse.jface.layout TreeColumnLayout TreeColumnLayout
public TreeColumnLayout()
From source file:bndtools.release.ui.BundleTree.java
License:Open Source License
private void createInfoViewer(Composite container) { infoViewerComposite = new Composite(container, SWT.NONE); infoViewerComposite.setLayoutData(createFillGridData()); TreeColumnLayout layout = new TreeColumnLayout(); infoViewerComposite.setLayout(layout); infoViewer = new TreeViewer(infoViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); infoViewer.setUseHashlookup(true);/*from w w w.j a v a2 s . co m*/ infoViewer.getTree().setHeaderVisible(true); TreeViewerColumn treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE); TreeColumn treeColumn = treeViewerColumn.getColumn(); layout.setColumnData(treeColumn, new ColumnWeightData(450, 180, true)); treeColumn.setText(Messages.bundleAndPackageName); treeViewerColumn.setLabelProvider(new InfoLabelProvider()); treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE); treeColumn = treeViewerColumn.getColumn(); layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true)); treeColumn.setText(Messages.version2); treeViewerColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { if (element instanceof Baseline) { return ((Baseline) element).getOlderVersion().getWithoutQualifier().toString(); } if (element instanceof Info) { return ((Info) element).olderVersion.toString(); } return ""; //$NON-NLS-1$ } }); treeViewerColumn = new TreeViewerColumn(infoViewer, SWT.NONE); treeColumn = treeViewerColumn.getColumn(); layout.setColumnData(treeColumn, new ColumnWeightData(80, 80, true)); treeColumn.setText(Messages.newVersion); treeViewerColumn.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { if (element instanceof Baseline) { return ((Baseline) element).getSuggestedVersion().toString(); } if (element instanceof Info) { return ((Info) element).suggestedVersion != null ? ((Info) element).suggestedVersion.toString() : ""; //$NON-NLS-1$ } return ""; //$NON-NLS-1$ } }); treeViewerColumn.setEditingSupport(new InlineComboEditingSupport(infoViewer)); infoViewer.setContentProvider(infoTreeViewerProvider); infoViewer.setAutoExpandLevel(2); }
From source file:bndtools.release.ui.BundleTree.java
License:Open Source License
private void createBundleTreeViewer(Composite container) { bundleTreeViewerComposite = new Composite(container, SWT.NONE); bundleTreeViewerComposite.setLayoutData(createFillGridData()); TreeColumnLayout layout = new TreeColumnLayout(); bundleTreeViewerComposite.setLayout(layout); bundleTreeViewer = new TreeViewer(bundleTreeViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); bundleTreeViewer.setUseHashlookup(true); bundleTreeViewer.getTree().setHeaderVisible(true); TreeViewerColumn treeViewerColumn = new TreeViewerColumn(bundleTreeViewer, SWT.NONE); TreeColumn treeColumn = treeViewerColumn.getColumn(); layout.setColumnData(treeColumn, new ColumnWeightData(100, 340, true)); treeColumn.setText(Messages.symbNameResources); treeViewerColumn.setLabelProvider(new TreeLabelProvider()); bundleTreeViewer.setContentProvider(bundleTreeViewerProvider); bundleTreeViewer.setAutoExpandLevel(3); }
From source file:com.amazonaws.eclipse.codedeploy.explorer.editor.table.DeploymentsTableView.java
License:Apache License
private TreeViewer createControls(FormToolkit toolkit) { GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginWidth = 0;//from w w w . ja va 2 s . co m gridLayout.marginHeight = 0; setLayout(gridLayout); Composite sectionComp = toolkit.createComposite(this, SWT.None); sectionComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sectionComp.setLayout(new GridLayout(1, false)); Composite headingComp = toolkit.createComposite(sectionComp, SWT.None); headingComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); headingComp.setLayout(new GridLayout()); tableTitleLabel = toolkit.createLabel(headingComp, "Deployments"); tableTitleLabel.setFont(JFaceResources.getHeaderFont()); tableTitleLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite tableHolder = toolkit.createComposite(sectionComp, SWT.None); tableHolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); FillLayout layout = new FillLayout(); layout.marginHeight = 0; layout.marginWidth = 10; layout.type = SWT.VERTICAL; tableHolder.setLayout(layout); Composite tableComp = toolkit.createComposite(tableHolder, SWT.None); final TreeColumnLayout tableColumnLayout = new TreeColumnLayout(); tableComp.setLayout(tableColumnLayout); final TreeViewer viewer = new TreeViewer(tableComp, SWT.BORDER | SWT.VIRTUAL | SWT.MULTI | SWT.H_SCROLL); viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(true); viewer.setUseHashlookup(true); viewer.setLabelProvider(new DeploymentsTableViewLabelProvider()); viewer.setContentProvider(new DeploymentsTableViewContentProvider(this.viewer, this.contentCache)); Tree tree = viewer.getTree(); createColumns(tableColumnLayout, tree); viewer.setInput(loadingContentProvider); updateRefreshProgress(0, false); // Async load top-level data new Thread(new Runnable() { public void run() { Display.getDefault().syncExec(new Runnable() { public void run() { // Preserve the current column widths int[] colWidth = new int[viewer.getTree().getColumns().length]; int i = 0; for (TreeColumn col : viewer.getTree().getColumns()) { colWidth[i++] = col.getWidth(); } i = 0; for (TreeColumn col : viewer.getTree().getColumns()) { tableColumnLayout.setColumnData(col, new ColumnPixelData(colWidth[i])); } } }); // Cache the children of all the top-level elements before // updating the tree view loadAllTopLevelElements(); Display.getDefault().syncExec(new Runnable() { public void run() { viewer.setInput(contentCache); } }); } }).start(); return viewer; }
From source file:com.amazonaws.eclipse.dynamodb.testtool.TestToolVersionTable.java
License:Apache License
/** * Create the actual table view displaying the list of selectable test * tool versions.//from w w w. jav a2 s . c o m */ private void createViewer() { // Grab any leftover space in the middle. Composite wrapper = new Composite(this, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.heightHint = 200; wrapper.setLayoutData(data); TreeColumnLayout layout = new TreeColumnLayout(); wrapper.setLayout(layout); viewer = new TreeViewer(wrapper, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE); TestToolVersionProvider provider = new TestToolVersionProvider(); viewer.setContentProvider(provider); viewer.setLabelProvider(provider); viewer.setComparator(new VersionComparator()); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { onSelectionChanged(); } }); Tree tree = viewer.getTree(); tree.setHeaderVisible(true); TreeColumn versionColumn = new TreeColumn(tree, SWT.LEFT); versionColumn.setText("Version"); layout.setColumnData(versionColumn, new ColumnWeightData(75)); TreeColumn installColumn = new TreeColumn(tree, SWT.CENTER); installColumn.setText("Installed?"); layout.setColumnData(installColumn, new ColumnWeightData(25)); }
From source file:com.amazonaws.eclipse.ec2.ui.SelectionTable.java
License:Apache License
/** * Creates and configures the actual tree control. *///from w w w. j a va 2 s . com protected void createControl() { TreeColumnLayout treeColumnLayout = new TreeColumnLayout(); setLayout(treeColumnLayout); int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER; if (allowMultipleSelections) { style |= SWT.MULTI; } else { style |= SWT.SINGLE; } if (virtualTable) { style |= SWT.VIRTUAL; } viewer = new TreeViewer(this, style); if (virtualTable) viewer.setUseHashlookup(true); Tree tree = viewer.getTree(); tree.setLinesVisible(true); tree.setHeaderVisible(true); createColumns(); makeActions(); hookContextMenu(); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.configEditor.EventLogEditorSection.java
License:Open Source License
protected TreeColumn newColumn(String columnText, int weight) { Tree table = viewer.getTree();//from w w w . j a v a 2s. c o m TreeColumn column = new TreeColumn(table, SWT.NONE); column.setText(columnText); TreeColumnLayout tableColumnLayout = (TreeColumnLayout) viewer.getTree().getParent().getLayout(); if (tableColumnLayout == null) tableColumnLayout = new TreeColumnLayout(); tableColumnLayout.setColumnData(column, new ColumnWeightData(weight)); return column; }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.configEditor.EventLogEditorSection.java
License:Open Source License
private void createEventsTable(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); TreeColumnLayout treeColumnLayout = new TreeColumnLayout(); composite.setLayout(treeColumnLayout); int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI; viewer = new TreeViewer(composite, style); viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(true); addContextMenu();//from www . j a v a 2s. c om newColumn("Message", 75); newColumn("Version", 10); newColumn("Date", 15); viewer.setContentProvider(new ITreeContentProvider() { private List<EventDescription> events; @SuppressWarnings("unchecked") public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput == null) events = new ArrayList<EventDescription>(); else events = (List<EventDescription>) newInput; } public void dispose() { } public Object[] getElements(Object inputElement) { return events.toArray(); } public Object[] getChildren(Object parentElement) { return new Object[0]; } public Object getParent(Object element) { return null; } public boolean hasChildren(Object element) { return false; } }); viewer.setLabelProvider(new ITableLabelProvider() { public void removeListener(ILabelProviderListener listener) { } public boolean isLabelProperty(Object element, String property) { return false; } public void dispose() { } public void addListener(ILabelProviderListener listener) { } public String getColumnText(Object element, int columnIndex) { EventDescription event = (EventDescription) element; switch (columnIndex) { case 0: return event.getMessage(); case 1: return event.getVersionLabel(); case 2: return event.getEventDate().toString(); default: return ""; } } public Image getColumnImage(Object element, int columnIndex) { if (element == null) return null; if (columnIndex != 0) return null; EventSeverity eventSeverity = null; try { EventDescription event = (EventDescription) element; eventSeverity = EventSeverity.fromValue(event.getSeverity()); } catch (IllegalArgumentException e) { return null; } switch (eventSeverity) { case ERROR: case FATAL: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); case WARN: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); case INFO: case DEBUG: case TRACE: return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); } return null; } }); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.ImportEnvironmentsWizard.java
License:Apache License
protected TreeColumn newColumn(String columnText, int weight) { Tree table = viewer.getTree();// ww w . jav a 2 s. c o m TreeColumn column = new TreeColumn(table, SWT.NONE); column.setText(columnText); TreeColumnLayout tableColumnLayout = (TreeColumnLayout) viewer.getTree().getParent().getLayout(); if (tableColumnLayout == null) tableColumnLayout = new TreeColumnLayout(); tableColumnLayout.setColumnData(column, new ColumnWeightData(weight)); viewer.getTree().getParent().setLayout(tableColumnLayout); return column; }
From source file:com.amazonaws.eclipse.explorer.cloudformation.StackEventsTable.java
License:Apache License
public StackEventsTable(Composite parent, FormToolkit toolkit, StackEditorInput stackEditorInput) { super(parent, SWT.NONE); this.stackEditorInput = stackEditorInput; this.setLayout(new GridLayout()); Composite composite = toolkit.createComposite(this); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); TreeColumnLayout tableColumnLayout = new TreeColumnLayout(); composite.setLayout(tableColumnLayout); StackEventsContentProvider contentProvider = new StackEventsContentProvider(); StackEventsLabelProvider labelProvider = new StackEventsLabelProvider(); viewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI); viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(true); viewer.setLabelProvider(labelProvider); viewer.setContentProvider(contentProvider); createColumns(tableColumnLayout, viewer.getTree()); refresh();// w w w .j av a 2 s . c o m }
From source file:com.amazonaws.eclipse.explorer.cloudformation.StackOutputsTable.java
License:Apache License
public StackOutputsTable(Composite parent, FormToolkit toolkit) { super(parent, SWT.NONE); this.setLayout(new GridLayout()); Composite composite = toolkit.createComposite(this); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); TreeColumnLayout tableColumnLayout = new TreeColumnLayout(); composite.setLayout(tableColumnLayout); StackOutputsContentProvider contentProvider = new StackOutputsContentProvider(); StackOutputsLabelProvider labelProvider = new StackOutputsLabelProvider(); viewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI); viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(true); viewer.setLabelProvider(labelProvider); viewer.setContentProvider(contentProvider); createColumns(tableColumnLayout, viewer.getTree()); }