Example usage for org.eclipse.swt.widgets Tree setHeaderVisible

List of usage examples for org.eclipse.swt.widgets Tree setHeaderVisible

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Tree setHeaderVisible.

Prototype

public void setHeaderVisible(boolean value) 

Source Link

Document

Marks the receiver's header as visible if the argument is true , and marks it invisible otherwise.

Usage

From source file:org.eclipse.swt.snippets.Snippet312.java

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 312");
    shell.setLayout(new FillLayout());

    final Tree tree = new Tree(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    tree.setHeaderVisible(true);
    final Menu headerMenu = new Menu(shell, SWT.POP_UP);
    final TreeColumn columnName = new TreeColumn(tree, SWT.NONE);
    columnName.setText("Name");
    columnName.setWidth(150);//from   w  ww  . j  a v a 2  s.co m
    createMenuItem(headerMenu, columnName);
    final TreeColumn columnSize = new TreeColumn(tree, SWT.NONE);
    columnSize.setText("Size");
    columnSize.setWidth(150);
    createMenuItem(headerMenu, columnSize);
    final TreeColumn columnType = new TreeColumn(tree, SWT.NONE);
    columnType.setText("Type");
    columnType.setWidth(150);
    createMenuItem(headerMenu, columnType);
    final TreeColumn columnDate = new TreeColumn(tree, SWT.NONE);
    columnDate.setText("Date");
    columnDate.setWidth(150);
    createMenuItem(headerMenu, columnDate);
    final TreeColumn columnOwner = new TreeColumn(tree, SWT.NONE);
    columnOwner.setText("Owner");
    columnOwner.setWidth(0);
    columnOwner.setResizable(false);
    createMenuItem(headerMenu, columnOwner);

    for (int i = 0; i < files.length; i++) {
        TreeItem item = new TreeItem(tree, SWT.NONE);
        item.setText(files[i]);
        TreeItem subItem = new TreeItem(item, SWT.NONE);
        subItem.setText("node");
    }

    final Menu treeMenu = new Menu(shell, SWT.POP_UP);
    MenuItem item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Open");
    item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Open With");
    new MenuItem(treeMenu, SWT.SEPARATOR);
    item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Cut");
    item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Copy");
    item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Paste");
    new MenuItem(treeMenu, SWT.SEPARATOR);
    item = new MenuItem(treeMenu, SWT.PUSH);
    item.setText("Delete");

    tree.addListener(SWT.MenuDetect, event -> {
        Point pt = display.map(null, tree, new Point(event.x, event.y));
        Rectangle clientArea = tree.getClientArea();
        boolean header = clientArea.y <= pt.y && pt.y < (clientArea.y + tree.getHeaderHeight());
        tree.setMenu(header ? headerMenu : treeMenu);
    });

    /* IMPORTANT: Dispose the menus (only the current menu, set with setMenu(), will be automatically disposed) */
    tree.addListener(SWT.Dispose, event -> {
        headerMenu.dispose();
        treeMenu.dispose();
    });

    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet221.java

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 221");
    shell.setLayout(new FillLayout());
    final Tree tree = new Tree(shell, SWT.FULL_SELECTION | SWT.BORDER);
    tree.setHeaderVisible(true);
    TreeColumn column0 = new TreeColumn(tree, SWT.LEFT);
    column0.setText("Column 0");
    TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
    column1.setText("Column 1");
    TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
    column2.setText("Column 2");
    for (int i = 0; i < 9; i++) {
        TreeItem item = new TreeItem(tree, SWT.NONE);
        item.setText("item " + i);
        item.setText(1, "column 1 - " + i);
        item.setText(2, "column 2 - " + i);
        for (int j = 0; j < 9; j++) {
            TreeItem subItem = new TreeItem(item, SWT.NONE);
            subItem.setText("item " + i + " " + j);
            subItem.setText(1, "column 1 - " + i + " " + j);
            subItem.setText(2, "column 2 - " + i + " " + j);
            for (int k = 0; k < 9; k++) {
                TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
                subsubItem.setText("item " + i + " " + j + " " + k);
                subsubItem.setText(1, "column 1 - " + i + " " + j + " " + k);
                subsubItem.setText(2, "column 2 - " + i + " " + j + " " + k);
            }//from ww  w. j  a v  a2s. co  m
        }
    }
    column0.pack();
    column1.pack();
    column2.pack();

    Heartbeat = () -> {
        if (!Tracking || tree.isDisposed())
            return;
        Point cursor = display.getCursorLocation();
        cursor = display.map(null, tree, cursor);
        Scroll(tree, cursor.x, cursor.y);
        display.timerExec(ScrollSpeed, Heartbeat);
    };
    Listener listener = event -> {
        switch (event.type) {
        case SWT.MouseEnter:
            Tracking = true;
            display.timerExec(0, Heartbeat);
            break;
        case SWT.MouseExit:
            Tracking = false;
            break;
        }
    };
    tree.addListener(SWT.MouseEnter, listener);
    tree.addListener(SWT.MouseExit, listener);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:TreeItemLines.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Multiple lines in a TreeItem");
    shell.setLayout(new FillLayout());
    final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);//from w  w  w  . j a va  2s  . c om
    int columnCount = 4;
    for (int i = 0; i < columnCount; i++) {
        TreeColumn column = new TreeColumn(tree, SWT.NONE);
        column.setText("Column " + i);
        column.setWidth(100);
    }
    int itemCount = 3;
    for (int i = 0; i < itemCount; i++) {
        TreeItem item1 = new TreeItem(tree, SWT.NONE);
        item1.setText("item " + i);
        for (int c = 1; c < columnCount; c++) {
            item1.setText(c, "item [" + i + "-" + c + "]");
        }
        for (int j = 0; j < itemCount; j++) {
            TreeItem item2 = new TreeItem(item1, SWT.NONE);
            item2.setText("item [" + i + " " + j + "]");
            for (int c = 1; c < columnCount; c++) {
                item2.setText(c, "item [" + i + " " + j + "-" + c + "]");
            }
            for (int k = 0; k < itemCount; k++) {
                TreeItem item3 = new TreeItem(item2, SWT.NONE);
                item3.setText("item [" + i + " " + j + " " + k + "]");
                for (int c = 1; c < columnCount; c++) {
                    item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]");
                }
            }
        }
    }

    /*
     * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly.
     * Therefore, it is critical for performance that these methods be as
     * efficient as possible.
     */
    Listener paintListener = new Listener() {
        public void handleEvent(Event event) {
            switch (event.type) {
            case SWT.MeasureItem: {
                TreeItem item = (TreeItem) event.item;
                String text = getText(item, event.index);
                Point size = event.gc.textExtent(text);
                event.width = size.x;
                event.height = Math.max(event.height, size.y);
                break;
            }
            case SWT.PaintItem: {
                TreeItem item = (TreeItem) event.item;
                String text = getText(item, event.index);
                Point size = event.gc.textExtent(text);
                int offset2 = event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0;
                event.gc.drawText(text, event.x, event.y + offset2, true);
                break;
            }
            case SWT.EraseItem: {
                event.detail &= ~SWT.FOREGROUND;
                break;
            }
            }
        }

        String getText(TreeItem item, int column) {
            String text = item.getText(column);
            if (column != 0) {
                TreeItem parent = item.getParentItem();
                int index = parent == null ? tree.indexOf(item) : parent.indexOf(item);
                if ((index + column) % 3 == 1) {
                    text += "\nnew line";
                }
                if ((index + column) % 3 == 2) {
                    text += "\nnew line\nnew line";
                }
            }
            return text;
        }
    };
    tree.addListener(SWT.MeasureItem, paintListener);
    tree.addListener(SWT.PaintItem, paintListener);
    tree.addListener(SWT.EraseItem, paintListener);

    shell.setSize(600, 400);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet227.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Multiple lines in a TreeItem");
    shell.setLayout(new FillLayout());
    final Tree tree = new Tree(shell, SWT.MULTI | SWT.FULL_SELECTION);
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);//from   w  ww . ja  va  2  s  . c  om
    int columnCount = 4;
    for (int i = 0; i < columnCount; i++) {
        TreeColumn column = new TreeColumn(tree, SWT.NONE);
        column.setText("Column " + i);
        column.setWidth(100);
    }
    int itemCount = 3;
    for (int i = 0; i < itemCount; i++) {
        TreeItem item1 = new TreeItem(tree, SWT.NONE);
        item1.setText("item " + i);
        for (int c = 1; c < columnCount; c++) {
            item1.setText(c, "item [" + i + "-" + c + "]");
        }
        for (int j = 0; j < itemCount; j++) {
            TreeItem item2 = new TreeItem(item1, SWT.NONE);
            item2.setText("item [" + i + " " + j + "]");
            for (int c = 1; c < columnCount; c++) {
                item2.setText(c, "item [" + i + " " + j + "-" + c + "]");
            }
            for (int k = 0; k < itemCount; k++) {
                TreeItem item3 = new TreeItem(item2, SWT.NONE);
                item3.setText("item [" + i + " " + j + " " + k + "]");
                for (int c = 1; c < columnCount; c++) {
                    item3.setText(c, "item [" + i + " " + j + " " + k + "-" + c + "]");
                }
            }
        }
    }

    /*
     * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly.
     * Therefore, it is critical for performance that these methods be
     * as efficient as possible.
     */
    Listener paintListener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            switch (event.type) {
            case SWT.MeasureItem: {
                TreeItem item = (TreeItem) event.item;
                String text = getText(item, event.index);
                Point size = event.gc.textExtent(text);
                event.width = size.x;
                event.height = Math.max(event.height, size.y);
                break;
            }
            case SWT.PaintItem: {
                TreeItem item = (TreeItem) event.item;
                String text = getText(item, event.index);
                Point size = event.gc.textExtent(text);
                int offset2 = event.index == 0 ? Math.max(0, (event.height - size.y) / 2) : 0;
                event.gc.drawText(text, event.x, event.y + offset2, true);
                break;
            }
            case SWT.EraseItem: {
                event.detail &= ~SWT.FOREGROUND;
                break;
            }
            }
        }

        String getText(TreeItem item, int column) {
            String text = item.getText(column);
            if (column != 0) {
                TreeItem parent = item.getParentItem();
                int index = parent == null ? tree.indexOf(item) : parent.indexOf(item);
                if ((index + column) % 3 == 1) {
                    text += "\nnew line";
                }
                if ((index + column) % 3 == 2) {
                    text += "\nnew line\nnew line";
                }
            }
            return text;
        }
    };
    tree.addListener(SWT.MeasureItem, paintListener);
    tree.addListener(SWT.PaintItem, paintListener);
    tree.addListener(SWT.EraseItem, paintListener);

    shell.setSize(600, 400);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet360.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 360");
    shell.setLayout(new GridLayout());

    // create a a tree with 3 columns and fill with data
    final Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));
    tree.setHeaderVisible(true);
    TreeColumn column1 = new TreeColumn(tree, SWT.NONE);
    TreeColumn column2 = new TreeColumn(tree, SWT.NONE);
    TreeColumn column3 = new TreeColumn(tree, SWT.NONE);
    for (int i = 0; i < 9; i++) {
        TreeItem item = new TreeItem(tree, SWT.NONE);
        item.setText(new String[] { "root " + i + " 0", "root " + i + " 1", "root " + i + " 2" });
        for (int j = 0; j < 9; j++) {
            TreeItem item2 = new TreeItem(item, SWT.NONE);
            item2.setText(new String[] { "child " + j + " 0", "child " + j + " 1", "child " + j + " 2" });
            TreeItem current = item2;/*w  ww  .  ja va2 s  . co m*/
            for (int k = 0; k < 5; k++) {
                TreeItem item3 = new TreeItem(current, SWT.NONE);
                item3.setText(new String[] { "descendent " + k + " 0", "descendent " + k + " 1",
                        "descendent " + k + " 2" });
                current = item3;
            }
        }
    }
    column1.setWidth(200);
    column2.setWidth(100);
    column3.setWidth(100);

    // create a TreeCursor to navigate around the tree
    final TreeCursor cursor = new TreeCursor(tree, SWT.NONE);
    // create an editor to edit the cell when the user hits "ENTER"
    // while over a cell in the tree
    final ControlEditor editor = new ControlEditor(cursor);
    editor.grabHorizontal = true;
    editor.grabVertical = true;

    cursor.addSelectionListener(new SelectionAdapter() {
        // when the TreeEditor is over a cell, select the corresponding row
        // in the tree
        @Override
        public void widgetSelected(SelectionEvent e) {
            tree.setSelection(new TreeItem[] { cursor.getRow() });
        }

        // when the user hits "ENTER" in the TreeCursor, pop up a text
        // editor so that they can change the text of the cell
        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            final Text text = new Text(cursor, SWT.NONE);
            TreeItem row = cursor.getRow();
            int column = cursor.getColumn();
            text.setText(row.getText(column));
            text.addKeyListener(keyPressedAdapter(event -> {
                // close the text editor and copy the data over
                // when the user hits "ENTER"
                if (event.character == SWT.CR) {
                    TreeItem localRow = cursor.getRow();
                    int localColumn = cursor.getColumn();
                    localRow.setText(localColumn, text.getText());
                    text.dispose();
                }
                // close the text editor when the user hits "ESC"
                if (event.character == SWT.ESC) {
                    text.dispose();
                }
            }));
            editor.setEditor(text);
            text.setFocus();
        }
    });
    // Hide the TreeCursor when the user hits the "MOD1" or "MOD2" key.
    // This allows the user to select multiple items in the tree.
    cursor.addKeyListener(keyPressedAdapter(e -> {
        if (e.keyCode == SWT.MOD1 || e.keyCode == SWT.MOD2 || (e.stateMask & SWT.MOD1) != 0
                || (e.stateMask & SWT.MOD2) != 0) {
            cursor.setVisible(false);
        }
    }));
    // Show the TreeCursor when the user releases the "MOD2" or "MOD1" key.
    // This signals the end of the multiple selection task.
    tree.addKeyListener(new KeyListener() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.MOD1 && (e.stateMask & SWT.MOD2) != 0)
                return;
            if (e.keyCode == SWT.MOD2 && (e.stateMask & SWT.MOD1) != 0)
                return;
            if (e.keyCode != SWT.MOD1 && (e.stateMask & SWT.MOD1) != 0)
                return;
            if (e.keyCode != SWT.MOD2 && (e.stateMask & SWT.MOD2) != 0)
                return;

            TreeItem[] selection = tree.getSelection();
            TreeItem row = (selection.length == 0) ? tree.getItem(tree.indexOf(tree.getTopItem()))
                    : selection[0];
            tree.showItem(row);
            cursor.setSelection(row, cursor.getColumn());
            cursor.setVisible(true);
            cursor.setFocus();
        }

        @Override
        public void keyPressed(KeyEvent e) {
            switch (e.keyCode) {
            case SWT.ARROW_LEFT:
            case SWT.ARROW_RIGHT: {
                if ((e.stateMask & SWT.MOD1) != 0) {
                    TreeItem[] selection = tree.getSelection();
                    if (selection.length > 0) {
                        selection[0].setExpanded(e.keyCode == SWT.ARROW_RIGHT);
                    }
                    break;
                }
            }
            }
        }
    });

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.examples.dnd.DNDExample.java

private Control createWidget(int type, Composite parent, String prefix) {
    switch (type) {
    case BUTTON_CHECK: {
        Button button = new Button(parent, SWT.CHECK);
        button.setText(prefix + " Check box");
        return button;
    }//www.j  a  va  2 s.co  m
    case BUTTON_TOGGLE: {
        Button button = new Button(parent, SWT.TOGGLE);
        button.setText(prefix + " Toggle button");
        return button;
    }
    case BUTTON_RADIO: {
        Button button = new Button(parent, SWT.RADIO);
        button.setText(prefix + " Radio button");
        return button;
    }
    case STYLED_TEXT: {
        StyledText text = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
        text.setText(prefix + " Styled Text");
        return text;
    }
    case TABLE: {
        Table table = new Table(parent, SWT.BORDER | SWT.MULTI);
        table.setHeaderVisible(true);
        TableColumn column0 = new TableColumn(table, SWT.LEFT);
        column0.setText("Name");
        TableColumn column1 = new TableColumn(table, SWT.RIGHT);
        column1.setText("Value");
        TableColumn column2 = new TableColumn(table, SWT.CENTER);
        column2.setText("Description");
        for (int i = 0; i < 10; i++) {
            TableItem item = new TableItem(table, SWT.NONE);
            item.setText(0, prefix + " name " + i);
            item.setText(1, prefix + " value " + i);
            item.setText(2, prefix + " description " + i);
            item.setImage(itemImage);
        }
        column0.pack();
        column1.pack();
        column2.pack();
        return table;
    }
    case TEXT: {
        Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
        text.setText(prefix + " Text");
        return text;
    }
    case TREE: {
        Tree tree = new Tree(parent, SWT.BORDER | SWT.MULTI);
        tree.setHeaderVisible(true);
        TreeColumn column0 = new TreeColumn(tree, SWT.LEFT);
        column0.setText("Name");
        TreeColumn column1 = new TreeColumn(tree, SWT.RIGHT);
        column1.setText("Value");
        TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
        column2.setText("Description");
        for (int i = 0; i < 3; i++) {
            TreeItem item = new TreeItem(tree, SWT.NONE);
            item.setText(0, prefix + " name " + i);
            item.setText(1, prefix + " value " + i);
            item.setText(2, prefix + " description " + i);
            item.setImage(itemImage);
            for (int j = 0; j < 3; j++) {
                TreeItem subItem = new TreeItem(item, SWT.NONE);
                subItem.setText(0, prefix + " name " + i + " " + j);
                subItem.setText(1, prefix + " value " + i + " " + j);
                subItem.setText(2, prefix + " description " + i + " " + j);
                subItem.setImage(itemImage);
                for (int k = 0; k < 3; k++) {
                    TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
                    subsubItem.setText(0, prefix + " name " + i + " " + j + " " + k);
                    subsubItem.setText(1, prefix + " value " + i + " " + j + " " + k);
                    subsubItem.setText(2, prefix + " description " + i + " " + j + " " + k);
                    subsubItem.setImage(itemImage);
                }
            }
        }
        column0.pack();
        column1.pack();
        column2.pack();
        return tree;
    }
    case CANVAS: {
        Canvas canvas = new Canvas(parent, SWT.BORDER);
        canvas.setData("STRINGS", new String[] { prefix + " Canvas widget" });
        canvas.addPaintListener(e -> {
            Canvas c = (Canvas) e.widget;
            Image image = (Image) c.getData("IMAGE");
            if (image != null) {
                e.gc.drawImage(image, 5, 5);
            } else {
                String[] strings = (String[]) c.getData("STRINGS");
                if (strings != null) {
                    FontMetrics metrics = e.gc.getFontMetrics();
                    int height = metrics.getHeight();
                    int y = 5;
                    for (String string : strings) {
                        e.gc.drawString(string, 5, y);
                        y += height + 5;
                    }
                }
            }
        });
        return canvas;
    }
    case LABEL: {
        Label label = new Label(parent, SWT.BORDER);
        label.setText(prefix + " Label");
        return label;
    }
    case LIST: {
        List list = new List(parent, SWT.BORDER | SWT.MULTI);
        list.setItems(prefix + " Item a", prefix + " Item b", prefix + " Item c", prefix + " Item d");
        return list;
    }
    case COMBO: {
        Combo combo = new Combo(parent, SWT.BORDER);
        combo.setItems("Item a", "Item b", "Item c", "Item d");
        return combo;
    }
    default:
        throw new SWTError(SWT.ERROR_NOT_IMPLEMENTED);
    }
}

From source file:fr.inria.soctrace.framesoc.ui.piechart.view.StatisticsPieChartView.java

@Override
public void createFramesocPartControl(Composite parent) {

    // parent layout
    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 2;/*  w  w w. j  a  va  2  s. c o m*/
    gl_parent.marginWidth = 0;
    gl_parent.horizontalSpacing = 0;
    gl_parent.marginHeight = 0;
    parent.setLayout(gl_parent);

    // -------------------------------
    // Base GUI: pie + table
    // -------------------------------

    SashForm sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    // Composite Left: composite combo + composite pie
    Composite compositeLeft = new Composite(sashForm, SWT.NONE);
    GridLayout gl_compositeLeft = new GridLayout(1, false);
    gl_compositeLeft.marginBottom = 3;
    gl_compositeLeft.verticalSpacing = 0;
    gl_compositeLeft.marginHeight = 0;
    compositeLeft.setLayout(gl_compositeLeft);

    // Composite Combo
    Composite compositeCombo = new Composite(compositeLeft, SWT.NONE);
    compositeCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    GridLayout gl_compositeCombo = new GridLayout(1, false);
    gl_compositeCombo.marginWidth = 0;
    compositeCombo.setLayout(gl_compositeCombo);

    // combo
    combo = new Combo(compositeCombo, SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean firstTime = true;
            for (LoaderDescriptor d : loaderDescriptors) {
                firstTime = firstTime && !d.dataLoaded();
            }
            if (firstTime) {
                return;
            }
            currentDescriptor = loaderDescriptors.get(combo.getSelectionIndex());
            cleanTableFilter();
            refreshTableFilter();
            // use global load interval
            timeBar.setSelection(globalLoadInterval);
            loadPieChart();
        }
    });

    int position = 0;
    for (LoaderDescriptor descriptor : loaderDescriptors) {
        combo.add(descriptor.loader.getStatName(), position++);
    }
    combo.select(0);
    currentDescriptor = loaderDescriptors.get(0);
    combo.setEnabled(false);

    // Composite Pie
    compositePie = new Group(compositeLeft, SWT.NONE);
    // Fill layout with Grid Data (FILL) to allow correct resize
    compositePie.setLayout(new FillLayout());
    compositePie.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    txtDescription = new Text(compositePie, SWT.READ_ONLY | SWT.WRAP | SWT.CENTER | SWT.MULTI);
    txtDescription.setEnabled(false);
    txtDescription.setEditable(false);
    txtDescription.setText("Select one of the above metrics, then press the Load button.");
    txtDescription.setVisible(false);

    // Composite Table
    Composite compositeTable = new Composite(sashForm, SWT.NONE);
    GridLayout gl_compositeTable = new GridLayout(1, false);
    compositeTable.setLayout(gl_compositeTable);

    // filter
    textFilter = new Text(compositeTable, SWT.BORDER);
    textFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textFilter.addFocusListener(new FocusListener() {
        @Override
        public void focusLost(FocusEvent e) {
            String filter = textFilter.getText().trim();
            if (filter.isEmpty()) {
                cleanTableFilter();
            }
        }

        @Override
        public void focusGained(FocusEvent e) {
            String filter = textFilter.getText().trim();
            if (filter.equals(FILTER_HINT)) {
                textFilter.setText("");
                textFilter.setData("");
                textFilter.setForeground(blackColor);
            }
        }
    });
    textFilter.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.CR || textFilter.getText().trim().isEmpty()) {
                textFilter.setData(textFilter.getText());
                refreshTableFilter();
            }
        }
    });

    // table
    tableTreeViewer = new TreeViewer(compositeTable,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL);
    tableTreeViewer.setContentProvider(new TreeContentProvider());
    comparator = new StatisticsColumnComparator();
    tableTreeViewer.setComparator(comparator);
    Tree table = tableTreeViewer.getTree();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    createColumns();
    createContextMenu();

    // status bar
    Composite statusBar = new Composite(compositeTable, SWT.BORDER);
    GridLayout statusBarLayout = new GridLayout();
    GridData statusBarGridData = new GridData();
    statusBarGridData.horizontalAlignment = SWT.FILL;
    statusBarGridData.grabExcessHorizontalSpace = true;
    statusBar.setLayoutData(statusBarGridData);
    statusBarLayout.numColumns = 1;
    statusBar.setLayout(statusBarLayout);
    // text
    statusText = new Text(statusBar, SWT.NONE);
    statusText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    statusText.setText(getStatus(0, 0));

    // -------------------------------
    // TIME MANAGEMENT BAR
    // -------------------------------

    Composite timeComposite = new Composite(parent, SWT.BORDER);
    timeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_timeComposite = new GridLayout(1, false);
    gl_timeComposite.horizontalSpacing = 0;
    timeComposite.setLayout(gl_timeComposite);
    // time manager
    timeBar = new TimeBar(timeComposite, SWT.NONE, true, true);
    timeBar.setEnabled(false);
    combo.setEnabled(false);
    IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
    timeBar.setStatusLineManager(statusLineManager);

    // button to synch the timebar with the gantt
    timeBar.getSynchButton().addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (combo != null && timeBar != null && currentDescriptor != null) {
                if (currentDescriptor.dataLoaded()) {
                    timeBar.setSelection(currentDescriptor.interval.startTimestamp,
                            currentDescriptor.interval.endTimestamp);
                } else {
                    timeBar.setSelection(currentShownTrace.getMinTimestamp(),
                            currentShownTrace.getMaxTimestamp());
                }
            }
        }
    });
    timeBar.getSynchButton().setToolTipText("Synch Selection With Pie Chart");

    // load button
    timeBar.getLoadButton().addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (combo.getSelectionIndex() == -1)
                return;
            currentDescriptor = loaderDescriptors.get(combo.getSelectionIndex());
            cleanTableFilter();
            refreshTableFilter();
            loadPieChart();
        }
    });

    // ----------
    // TOOL BAR
    // ----------

    // filters and actions
    createFilterDialogs();
    createActions();

    // create SWT resources
    createResources();
    // clean the filter, after creating the font
    cleanTableFilter();

}