Java Code Examples for org.eclipse.swt.widgets.TreeColumn#pack()

The following examples show how to use org.eclipse.swt.widgets.TreeColumn#pack() . 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: TmfSynchronizationView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
    fTree = new Tree(parent, SWT.NONE);
    TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0);
    TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1);
    nameCol.setText(Messages.TmfSynchronizationView_NameColumn);
    valueCol.setText(Messages.TmfSynchronizationView_ValueColumn);

    fTree.setItemCount(0);

    fTree.setHeaderVisible(true);
    nameCol.pack();
    valueCol.pack();

    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        traceSelected(new TmfTraceSelectedSignal(this, trace));
    }
}
 
Example 2
Source File: TmfSynchronizationView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void updateTable() {
    fTree.setItemCount(0);
    if (fAlgoSync == null) {
        return;
    }

    for (Map.Entry<String, Map<String, Object>> entry : fAlgoSync.getStats().entrySet()) {
        TreeItem item = new TreeItem(fTree, SWT.NONE);
        item.setText(0, entry.getKey().toString());
        item.setText(1, entry.getValue().toString());

        for (Map.Entry<String, Object> subentry : entry.getValue().entrySet()) {
            TreeItem subitem = new TreeItem(item, SWT.NONE);
            subitem.setText(0, subentry.getKey().toString());
            subitem.setText(1, subentry.getValue().toString());
        }
    }

    /* Expand the tree items */
    for (int i = 0; i < fTree.getItemCount(); i++) {
        fTree.getItem(i).setExpanded(true);
    }

    for (TreeColumn column : fTree.getColumns()) {
        column.pack();
    }
}
 
Example 3
Source File: TreeWithAddRemove.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public void fitToContents() {
    if (columns != null) {
        for (TreeColumn c : columns) {
            c.pack();
        }
    }

}
 
Example 4
Source File: ViewProperties.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Refreshes the tree
 */
protected void refresh() {
    treeViewer.refresh();
    treeViewer.expandAll();
    for (TreeColumn tc : treeViewer.getTree().getColumns()) {
        tc.pack();
    }
}