Search in sources :

Example 1 with DataGrid

use of org.eclipse.linuxtools.systemtap.graphing.ui.datadisplay.DataGrid in project linuxtools by eclipse.

the class GraphDisplaySet method createPartControl.

/**
 * This method creates the framework for what will be displayed by this dialog box.
 * @param parent The composite that will contain all the elements from this dialog
 */
private void createPartControl(Composite parent) {
    parent.setLayout(new FormLayout());
    FormData data1 = new FormData();
    Composite cmpCoolBar = new Composite(parent, SWT.NONE);
    data1.left = new FormAttachment(0, 0);
    data1.top = new FormAttachment(0, 0);
    data1.right = new FormAttachment(100, 0);
    data1.bottom = new FormAttachment(0, 10);
    cmpCoolBar.setLayoutData(data1);
    FormData data2 = new FormData();
    data2.left = new FormAttachment(0, 0);
    data2.top = new FormAttachment(cmpCoolBar);
    data2.right = new FormAttachment(100, 0);
    data2.bottom = new FormAttachment(100, 0);
    Composite cmpGraph = new Composite(parent, SWT.NONE);
    cmpGraph.setLayoutData(data2);
    // This is for the tab view
    cmpGraph.setLayout(new FormLayout());
    folder = new CTabFolder(cmpGraph, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    folder.setLayoutData(data);
    listener = new ButtonClickListener();
    folder.addSelectionListener(listener);
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent e) {
            int selected = folder.indexOf((CTabItem) e.item) - 2;
            if (null != updater) {
                updater.removeUpdateListener(builders.get(selected));
            }
            builders.remove(selected);
        }
    });
    // This is a tab/button for opening new graphs
    CTabItem newGraph = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    newGraph.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(GraphingUIPlugin.PLUGIN_ID, "icons/actions/new_wiz.gif").createImage());
    // $NON-NLS-1$
    newGraph.setToolTipText(Localization.getString("GraphDisplaySet.CreateGraph"));
    // Tab containing the data table
    CTabItem item = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    item.setText(Localization.getString("GraphDisplaySet.DataView"));
    Composite c = new Composite(folder, SWT.NONE);
    GridLayout grid = new GridLayout();
    grid.marginHeight = 0;
    grid.marginWidth = 0;
    c.setLayout(grid);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    DataGrid table = DataSetFactory.getDataGrid(c, dataSet);
    if (null != updater) {
        updater.addUpdateListener(table);
    }
    table.getControl().setLayoutData(gd);
    item.setControl(c);
    folder.setSelection(item);
    lastSelectedTab = 1;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) GraphComposite(org.eclipse.linuxtools.systemtap.graphing.ui.widgets.GraphComposite) Composite(org.eclipse.swt.widgets.Composite) DataGrid(org.eclipse.linuxtools.systemtap.graphing.ui.datadisplay.DataGrid) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

DataGrid (org.eclipse.linuxtools.systemtap.graphing.ui.datadisplay.DataGrid)1 GraphComposite (org.eclipse.linuxtools.systemtap.graphing.ui.widgets.GraphComposite)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 CTabFolder2Adapter (org.eclipse.swt.custom.CTabFolder2Adapter)1 CTabFolderEvent (org.eclipse.swt.custom.CTabFolderEvent)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 FormLayout (org.eclipse.swt.layout.FormLayout)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1