Search in sources :

Example 11 with TreeColumn

use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.

the class NotificationFilteredTree method configureTree.

/**
     * Configure the tree adding columns.
     */
private void configureTree() {
    Tree tree = getViewer().getTree();
    for (TreeColumn column : tree.getColumns()) {
        column.dispose();
    }
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    for (Entry<String, Boolean> entry : columns.entrySet()) {
        NotificationColumn column = NotificationColumn.getColumn(entry.getKey());
        if (!columns.get(column.label)) {
            continue;
        }
        TreeColumn treeColumn = new TreeColumn(getViewer().getTree(), SWT.NONE);
        treeColumn.setText(column.label);
        treeColumn.setWidth(column.defalutWidth);
        treeColumn.setAlignment(column.initialAlignment);
        treeColumn.setToolTipText(column.toolTip);
        treeColumn.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (e.widget instanceof TreeColumn) {
                    sortColumn((TreeColumn) e.widget);
                }
            }
        });
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) Tree(org.eclipse.swt.widgets.Tree)

Example 12 with TreeColumn

use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.

the class HotSpotsFilteredTree method configureTree.

/*
     * @see AbstractFilteredTree#configureTree()
     */
@Override
protected void configureTree() {
    for (TreeColumn column : getViewer().getTree().getColumns()) {
        column.dispose();
    }
    getViewer().getTree().setLinesVisible(true);
    getViewer().getTree().setHeaderVisible(true);
    for (Entry<String, Boolean> entry : columns.entrySet()) {
        HotSpotsColumn column = getColumn(entry.getKey());
        String label = (column == HotSpotsColumn.HOT_SPOT) ? getMethodColumnName() : column.label;
        String toolTip = (column == HotSpotsColumn.HOT_SPOT) ? getMethodColumnToolTip() : column.toolTip;
        if (!columns.get(label)) {
            continue;
        }
        TreeColumn treeColumn = new TreeColumn(getViewer().getTree(), SWT.NONE);
        treeColumn.setText(label);
        treeColumn.setWidth(column.defalutWidth);
        treeColumn.setAlignment(column.alignment);
        treeColumn.setToolTipText(toolTip);
        treeColumn.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (e.widget instanceof TreeColumn) {
                    sortColumn((TreeColumn) e.widget);
                }
            }
        });
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 13 with TreeColumn

use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.

the class HeapHistogramPage method configureTree.

/**
     * Configure the tree adding columns.
     */
private void configureTree() {
    Tree tree = heapViewer.getTree();
    if (tree.isDisposed()) {
        return;
    }
    for (TreeColumn column : tree.getColumns()) {
        column.dispose();
    }
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    for (Entry<String, Boolean> entry : columns.entrySet()) {
        HeapColumn column = HeapColumn.getColumn(entry.getKey());
        if (!columns.get(column.label)) {
            continue;
        }
        TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);
        treeColumn.setText(column.label);
        treeColumn.setWidth(column.defalutWidth);
        treeColumn.setAlignment(column.alignment);
        treeColumn.setToolTipText(column.toolTip);
        treeColumn.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (e.widget instanceof TreeColumn) {
                    sortColumn((TreeColumn) e.widget);
                }
            }
        });
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Tree(org.eclipse.swt.widgets.Tree)

Example 14 with TreeColumn

use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.

the class UIManager method changeSchemasDetailView.

public void changeSchemasDetailView(final TreeViewer schemaDetailsViewer, boolean model) {
    if (schemaDetailsViewer == null || schemaDetailsViewer.getTree().isDisposed()) {
        return;
    }
    final Tree tree = schemaDetailsViewer.getTree();
    // removed all columns
    final TreeColumn[] columns = tree.getColumns();
    for (TreeColumn col : columns) {
        col.dispose();
    }
    if (columnTreeEditor != null) {
        columnTreeEditor.dispose();
        final Control editor = columnTreeEditor.getEditor();
        if (editor != null && !editor.isDisposed()) {
            editor.setVisible(false);
            editor.dispose();
        }
        columnTreeEditor = null;
    }
    if (columnMouseListener != null) {
        tree.removeMouseListener(columnMouseListener);
        columnMouseListener = null;
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) TreeColumn(org.eclipse.swt.widgets.TreeColumn) Tree(org.eclipse.swt.widgets.Tree)

Example 15 with TreeColumn

use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.

the class UpdateDetectionDialog method createColumns.

/**
     * create table columns.
     */
private void createColumns(final Tree tree) {
    TreeColumn column = new TreeColumn(tree, SWT.NONE);
    column.setText(ITEMS);
    column.setWidth(SIZING_COLUMN_WIDTH * 10);
    tree.setSortColumn(column);
    if (isOnlySimpleShow()) {
        column.setWidth(SIZING_COLUMN_WIDTH * 20);
    } else {
        column = new TreeColumn(tree, SWT.NONE);
        column.setText(OPERATIONS);
        column.setWidth(SIZING_COLUMN_WIDTH * 7);
        column = new TreeColumn(tree, SWT.NONE);
        column.setText(REMARKS);
        column.setWidth(SIZING_COLUMN_WIDTH * 6);
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn)

Aggregations

TreeColumn (org.eclipse.swt.widgets.TreeColumn)59 Tree (org.eclipse.swt.widgets.Tree)27 TreeViewer (org.eclipse.jface.viewers.TreeViewer)20 GridData (org.eclipse.swt.layout.GridData)18 TreeItem (org.eclipse.swt.widgets.TreeItem)18 Composite (org.eclipse.swt.widgets.Composite)16 GridLayout (org.eclipse.swt.layout.GridLayout)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Point (org.eclipse.swt.graphics.Point)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 FillLayout (org.eclipse.swt.layout.FillLayout)7 Menu (org.eclipse.swt.widgets.Menu)7 CellEditor (org.eclipse.jface.viewers.CellEditor)6 Button (org.eclipse.swt.widgets.Button)6 ArrayList (java.util.ArrayList)5 IMenuListener (org.eclipse.jface.action.IMenuListener)5 IMenuManager (org.eclipse.jface.action.IMenuManager)5 ICellModifier (org.eclipse.jface.viewers.ICellModifier)5 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)5 AUndertaking (edu.cmu.cs.hcii.cogtool.model.AUndertaking)4