Example usage for org.eclipse.swt.widgets Label setLayoutData

List of usage examples for org.eclipse.swt.widgets Label setLayoutData

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Label setLayoutData.

Prototype

public void setLayoutData(Object layoutData) 

Source Link

Document

Sets the layout data associated with the receiver to the argument.

Usage

From source file:edu.isistan.carcha.plugin.editors.TraceabilityEditor.java

/**
 * Creates a page to allow users to create a traceability link.
 *///from   w  w w.  ja  va  2  s  . c  o m
void createTraceabilityLinkPage() {
    final Composite composite = new Composite(getContainer(), SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 5));
    composite.setLayout(new GridLayout());

    Label concernLabel = new Label(composite, SWT.BORDER);
    concernLabel.setText("Crosscuttings Concerns(CCC)");
    concernLabel.setToolTipText("This are the Crosscuttings Concerns detected on the requierement document");
    GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
    concernLabel.setLayoutData(gridData);

    topNewLink = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    createColumns(composite, topNewLink);

    final Table table = topNewLink.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    topNewLink.setContentProvider(new ArrayContentProvider());
    getSite().setSelectionProvider(topNewLink);
    // define layout for the viewer
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    topNewLink.getControl().setLayoutData(gridData);

    Button button = new Button(composite, SWT.PUSH);
    button.setText("Link");
    button.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent event) {
        }

        public void widgetSelected(SelectionEvent event) {
            IStructuredSelection topSelection = (IStructuredSelection) topNewLink.getSelection();
            IStructuredSelection bottomSelection = (IStructuredSelection) bottomNewLink.getSelection();

            String[] crosscuttingConcern = (String[]) topSelection.getFirstElement();
            String[] designDecision = (String[]) bottomSelection.getFirstElement();

            if ((crosscuttingConcern != null) && (designDecision != null)) {
                // create dialog with ok and cancel button and info icon
                MessageBox dialog = new MessageBox(composite.getShell(),
                        SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
                dialog.setText("Link confirmation");
                dialog.setMessage("Do you want to link the selected items?");

                // open dialog and await user selection
                int response = dialog.open();
                if (response == SWT.OK) {
                    PluginUtil.createNewLink(crosscuttingConcern, designDecision, cp);
                    dirty = true;
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                }
            } else {
                MessageDialog.openError(composite.getShell(), "Error", "Please select item(s) to link");
            }
        }
    });

    gridData = new GridData(SWT.CENTER, SWT.TOP, false, false, 2, 1);
    button.setLayoutData(gridData);

    Label ddsLabel = new Label(composite, SWT.BORDER);
    ddsLabel.setText("Architectural design decisions");
    ddsLabel.setToolTipText("This are the design decisions detected in the architectural document");
    gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
    ddsLabel.setLayoutData(gridData);
    bottomNewLink = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    createColumns(composite, bottomNewLink);

    Table table2 = bottomNewLink.getTable();
    table2.setHeaderVisible(true);
    table2.setLinesVisible(true);

    bottomNewLink.setContentProvider(new ArrayContentProvider());

    getSite().setSelectionProvider(bottomNewLink);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    bottomNewLink.getControl().setLayoutData(gridData);

    int index = addPage(composite);
    setPageText(index, "New Link");
}

From source file:code.google.gclogviewer.GCLogViewer.java

private void createShell() {
    shell = new Shell(SWT.SHELL_TRIM | SWT.APPLICATION_MODAL);
    shell.setText(SHELL_TITLE);// w w w .  ja va2 s  .c  o  m
    shell.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
    shell.setMaximized(false);
    shell.setToolTipText(
            "A free open source tool to visualize data produced by the Java VM options -Xloggc:<file>");
    Monitor primary = shell.getDisplay().getPrimaryMonitor();
    Rectangle bounds = primary.getBounds();
    shell.setSize(new Point(bounds.width - 100, bounds.height - 100));
    Rectangle rect = shell.getBounds();
    int x = bounds.x + (bounds.width - rect.width) / 2;
    int y = bounds.y + (bounds.height - rect.height) / 2;
    shell.setLocation(x, y);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    shell.setLayout(layout);

    menuBar = new Menu(shell, SWT.BAR);
    fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
    fileMenuHeader.setText("&File");
    toolsMenuItem = new MenuItem(menuBar, SWT.CASCADE);
    toolsMenuItem.setText("&Tools");
    backToHomeMenuItem = new MenuItem(menuBar, SWT.CASCADE);
    backToHomeMenuItem.setText("Back To Home");
    backToHomeMenuItem.setEnabled(false);
    backToHomeMenuItem.addSelectionListener(new BackToHomeListener());
    exitMenuItem = new MenuItem(menuBar, SWT.CASCADE);
    exitMenuItem.setText("&Exit");
    exitMenuItem.addSelectionListener(new ExitListener());

    fileMenu = new Menu(shell, SWT.DROP_DOWN);
    fileMenuHeader.setMenu(fileMenu);

    fileOpenMenuItem = new MenuItem(fileMenu, SWT.PUSH);
    fileOpenMenuItem.setText("&Open log file...");
    fileOpenMenuItem.addSelectionListener(new OpenFileListener());

    toolsMenu = new Menu(shell, SWT.DROP_DOWN);
    toolsMenuItem.setMenu(toolsMenu);

    compareLogMenuItem = new MenuItem(toolsMenu, SWT.PUSH);
    compareLogMenuItem.setText("Compare GC Log");
    compareLogMenuItem.setEnabled(false);
    compareLogMenuItem.addSelectionListener(new CompareLogListener());
    memoryLeakDetectionMenuItem = new MenuItem(toolsMenu, SWT.PUSH);
    memoryLeakDetectionMenuItem.setText("Memory Leak Detection");
    memoryLeakDetectionMenuItem.setEnabled(false);
    memoryLeakDetectionMenuItem.addSelectionListener(new MemoryLeakDetectionListener());
    gcTuningMenuItem = new MenuItem(toolsMenu, SWT.PUSH);
    gcTuningMenuItem.setText("Data for GC Tuning");
    gcTuningMenuItem.setEnabled(false);
    gcTuningMenuItem.addSelectionListener(new DataForGCTuningListener());
    exportToPDFMenuItem = new MenuItem(toolsMenu, SWT.PUSH);
    exportToPDFMenuItem.setText("Export to PDF");
    exportToPDFMenuItem.setEnabled(false);

    shell.setMenuBar(menuBar);

    createSummary();
    createGCTrendGroup();
    createMemoryTrendGroup();
    createProgressBar();

    // Info Grid
    GridData infoGrid = new GridData(GridData.FILL_BOTH);
    final Label runtimeLabel = new Label(summary, SWT.NONE);
    runtimeLabel.setText("Run time: ");
    runtimeLabel.setLayoutData(infoGrid);
    runtimedataLabel = new Label(summary, SWT.NONE);
    runtimedataLabel.setText("xxx seconds");
    runtimedataLabel.setLayoutData(infoGrid);
    final Label gctypeLabel = new Label(summary, SWT.NONE);
    gctypeLabel.setText("GC Type: ");
    gctypeLabel.setLayoutData(infoGrid);
    gctypedataLabel = new Label(summary, SWT.NONE);
    gctypedataLabel.setText("xxx");
    gctypedataLabel.setLayoutData(infoGrid);
    final Label throughputLabel = new Label(summary, SWT.NONE);
    throughputLabel.setText("Throughput: ");
    throughputLabel.setLayoutData(infoGrid);
    throughputdataLabel = new Label(summary, SWT.NONE);
    throughputdataLabel.setText("xx%");
    throughputdataLabel.setLayoutData(infoGrid);
    final Label emptyLabel = new Label(summary, SWT.NONE);
    emptyLabel.setText(" ");
    emptyLabel.setLayoutData(infoGrid);
    final Label emptyDataLabel = new Label(summary, SWT.NONE);
    emptyDataLabel.setText(" ");
    emptyDataLabel.setLayoutData(infoGrid);

    // YGC Grid
    GridData ygcInfoGrid = new GridData(GridData.FILL_BOTH);
    final Label ygcLabel = new Label(summary, SWT.NONE);
    ygcLabel.setText("YGC: ");
    ygcLabel.setLayoutData(ygcInfoGrid);
    ygcDataLabel = new Label(summary, SWT.NONE);
    ygcDataLabel.setText("xxx");
    ygcDataLabel.setLayoutData(ygcInfoGrid);
    final Label ygctLabel = new Label(summary, SWT.NONE);
    ygctLabel.setText("YGCT: ");
    ygctLabel.setLayoutData(ygcInfoGrid);
    ygctDataLabel = new Label(summary, SWT.NONE);
    ygctDataLabel.setText("xxx seconds");
    ygctDataLabel.setLayoutData(ygcInfoGrid);
    final Label avgYGCTLabel = new Label(summary, SWT.NONE);
    avgYGCTLabel.setText("Avg YGCT: ");
    avgYGCTLabel.setLayoutData(ygcInfoGrid);
    avgYGCTDataLabel = new Label(summary, SWT.NONE);
    avgYGCTDataLabel.setText("xxx seconds");
    avgYGCTDataLabel.setLayoutData(ygcInfoGrid);
    final Label avgYGCRateLabel = new Label(summary, SWT.NONE);
    avgYGCRateLabel.setText("Avg YGCRate: ");
    avgYGCRateLabel.setLayoutData(ygcInfoGrid);
    avgYGCRateDataLabel = new Label(summary, SWT.NONE);
    avgYGCRateDataLabel.setText("xxx seconds");
    avgYGCRateDataLabel.setLayoutData(ygcInfoGrid);

    // CMS Grid
    GridData cmsgcInfoGrid = new GridData(GridData.FILL_BOTH);
    cmsgcInfoGrid.exclude = true;
    final Label cmsgcLabel = new Label(summary, SWT.NONE);
    cmsgcLabel.setText("CMSGC: ");
    cmsgcLabel.setLayoutData(cmsgcInfoGrid);
    cmsgcDataLabel = new Label(summary, SWT.NONE);
    cmsgcDataLabel.setText("xxx");
    cmsgcDataLabel.setLayoutData(cmsgcInfoGrid);
    final Label cmsgctLabel = new Label(summary, SWT.NONE);
    cmsgctLabel.setText("CMSGCT: ");
    cmsgctLabel.setLayoutData(cmsgcInfoGrid);
    cmsgctDataLabel = new Label(summary, SWT.NONE);
    cmsgctDataLabel.setText("xxx seconds");
    cmsgctDataLabel.setLayoutData(cmsgcInfoGrid);
    final Label avgCMSGCTLabel = new Label(summary, SWT.NONE);
    avgCMSGCTLabel.setText("Avg CMSGCT: ");
    avgCMSGCTLabel.setLayoutData(cmsgcInfoGrid);
    avgCMSGCTDataLabel = new Label(summary, SWT.NONE);
    avgCMSGCTDataLabel.setText("xxx seconds");
    avgCMSGCTDataLabel.setLayoutData(cmsgcInfoGrid);
    final Label avgCMSGCRateLabel = new Label(summary, SWT.NONE);
    avgCMSGCRateLabel.setText("Avg CMSGCRate: ");
    avgCMSGCRateLabel.setLayoutData(cmsgcInfoGrid);
    avgCMSGCRateDataLabel = new Label(summary, SWT.NONE);
    avgCMSGCRateDataLabel.setText("xxx seconds");
    avgCMSGCRateDataLabel.setLayoutData(cmsgcInfoGrid);

    // LDS & PTOS Grid
    GridData ldsAndPTOSGrid = new GridData(GridData.FILL_BOTH);
    ldsAndPTOSGrid.exclude = true;
    final Label avgYGCLDSLabel = new Label(summary, SWT.NONE);
    avgYGCLDSLabel.setText("AVG YGCLDS: ");
    avgYGCLDSLabel.setLayoutData(ldsAndPTOSGrid);
    avgYGCLDSDataLabel = new Label(summary, SWT.NONE);
    avgYGCLDSDataLabel.setText("xxx(K)");
    avgYGCLDSDataLabel.setLayoutData(ldsAndPTOSGrid);
    final Label avgFGCLDSLabel = new Label(summary, SWT.NONE);
    avgFGCLDSLabel.setText("AVG FGCLDS: ");
    avgFGCLDSLabel.setLayoutData(ldsAndPTOSGrid);
    avgFGCLDSDataLabel = new Label(summary, SWT.NONE);
    avgFGCLDSDataLabel.setText("xxx(K)");
    avgFGCLDSDataLabel.setLayoutData(ldsAndPTOSGrid);
    final Label avgPTOSLabel = new Label(summary, SWT.NONE);
    avgPTOSLabel.setText("AVG PTOS: ");
    avgPTOSLabel.setLayoutData(ldsAndPTOSGrid);
    avgPTOSDataLabel = new Label(summary, SWT.NONE);
    avgPTOSDataLabel.setText("xx%");
    avgPTOSDataLabel.setLayoutData(ldsAndPTOSGrid);
    final Label emptyLabel2 = new Label(summary, SWT.NONE);
    emptyLabel2.setText(" ");
    emptyLabel2.setLayoutData(ldsAndPTOSGrid);
    final Label emptyDataLabel2 = new Label(summary, SWT.NONE);
    emptyDataLabel2.setText(" ");
    emptyDataLabel2.setLayoutData(ldsAndPTOSGrid);

    // FGC Grid
    GridData fgcInfoGrid = new GridData(GridData.FILL_BOTH);
    final Label fgcLabel = new Label(summary, SWT.NONE);
    fgcLabel.setText("FGC: ");
    fgcLabel.setLayoutData(fgcInfoGrid);
    fgcDataLabel = new Label(summary, SWT.NONE);
    fgcDataLabel.setText("xxx");
    fgcDataLabel.setLayoutData(fgcInfoGrid);
    final Label fgctLabel = new Label(summary, SWT.NONE);
    fgctLabel.setText("FGCT: ");
    fgctLabel.setLayoutData(fgcInfoGrid);
    fgctDataLabel = new Label(summary, SWT.NONE);
    fgctDataLabel.setText("xxx seconds");
    fgctDataLabel.setLayoutData(fgcInfoGrid);
    final Label avgFGCTLabel = new Label(summary, SWT.NONE);
    avgFGCTLabel.setText("Avg FGCT: ");
    avgFGCTLabel.setLayoutData(fgcInfoGrid);
    avgFGCTDataLabel = new Label(summary, SWT.NONE);
    avgFGCTDataLabel.setText("xxx seconds");
    avgFGCTDataLabel.setLayoutData(fgcInfoGrid);
    final Label avgFGCRateLabel = new Label(summary, SWT.NONE);
    avgFGCRateLabel.setText("Avg FGCRate: ");
    avgFGCRateLabel.setLayoutData(fgcInfoGrid);
    avgFGCRateDataLabel = new Label(summary, SWT.NONE);
    avgFGCRateDataLabel.setText("xxx seconds");
    avgFGCRateDataLabel.setLayoutData(fgcInfoGrid);

}

From source file:edu.isistan.carcha.plugin.editors.TraceabilityEditor.java

/**
 * Creates the impact list page./*from  w w w .j a  v a  2s.  c  o  m*/
 */
void impactListPage() {
    final Composite composite = new Composite(getContainer(), SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    composite.setLayout(new GridLayout());

    Label concernLabel = new Label(composite, SWT.BORDER);
    concernLabel.setText("Crosccuting Concerns(CCC)");
    concernLabel.setToolTipText("This are the concern detected on the requierement document.");
    GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
    concernLabel.setLayoutData(gridData);

    /////////////////////
    ScrolledComposite sc = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    Composite parent = new Composite(sc, SWT.NONE);
    parent.setLayout(new GridLayout());

    topViewLink = new TableViewer(parent, SWT.BORDER);
    createColumns(parent, topViewLink);

    final Table table = topViewLink.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    topViewLink.setContentProvider(new ArrayContentProvider());

    getSite().setSelectionProvider(topViewLink);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    data.heightHint = 10 * table.getItemHeight();
    table.setLayoutData(data);

    sc.setContent(parent);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    /////////////////////

    Button button = new Button(composite, SWT.PUSH);
    button.setText("Remove");
    button.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent event) {
        }

        public void widgetSelected(SelectionEvent event) {
            IStructuredSelection topSelection = (IStructuredSelection) topViewLink.getSelection();
            IStructuredSelection bottomSelection = (IStructuredSelection) bottomViewLink.getSelection();

            String[] crosscuttingConcern = (String[]) topSelection.getFirstElement();
            String[] designDecision = (String[]) bottomSelection.getFirstElement();
            if (topSelection.size() > 1) {
                MessageDialog.openError(composite.getShell(), "Error",
                        "Please select one crosscutting concern");
            } else {
                if ((crosscuttingConcern != null) && (designDecision != null)) {
                    // create dialog with ok and cancel button and info icon
                    MessageBox dialog = new MessageBox(composite.getShell(),
                            SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
                    dialog.setText("Link confirmation");
                    dialog.setMessage("Do you want to remove the link between the selected items?");

                    // open dialog and await user selection
                    int response = dialog.open();
                    if (response == SWT.OK) {
                        PluginUtil.removeLink(crosscuttingConcern, designDecision, cp);
                        dirty = true;
                        firePropertyChange(IEditorPart.PROP_DIRTY);
                        // update the list after the remove
                        generateLinkViewData();
                        bottomViewLink.getTable().clearAll();
                    }
                } else {
                    MessageDialog.openError(composite.getShell(), "Error",
                            "Please select a crosscutting concern and a design decision to remove a traceability link");
                }
            }
        }
    });
    gridData = new GridData(SWT.CENTER, SWT.TOP, false, false, 2, 1);
    button.setLayoutData(gridData);

    Label ddsLabel = new Label(composite, SWT.BORDER);
    ddsLabel.setText("Architectural design decisions");
    ddsLabel.setToolTipText("This are the design decisions detected on the architectural document");

    gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
    ddsLabel.setLayoutData(gridData);

    bottomViewLink = new TableViewer(composite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    createColumns(composite, bottomViewLink);
    Table table2 = bottomViewLink.getTable();
    table2.setHeaderVisible(true);
    table2.setLinesVisible(true);
    bottomViewLink.setContentProvider(new ArrayContentProvider());
    topViewLink.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (!selection.isEmpty()) {
                String[] cccs = (String[]) selection.getFirstElement();
                List<DesignDecision> dds = PluginUtil.getDesignDecisionsForCrossCuttingConcern(cp, cccs[1],
                        cccs[0]);
                logger.info("Impact List for CCC (" + dds.size() + " DDD): " + cccs[0] + " - " + cccs[1]);
                List<String[]> designDecisions = new ArrayList<String[]>();

                for (DesignDecision dd : dds) {
                    String[] designDecision = { dd.getKind(), dd.getName() };
                    designDecisions.add(designDecision);
                }
                bottomViewLink.setInput(designDecisions);
            }
        }
    });
    getSite().setSelectionProvider(bottomViewLink);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    bottomViewLink.getControl().setLayoutData(gridData);

    int index = addPage(composite);
    setPageText(index, "Links");
}

From source file:org.pentaho.di.ui.spoon.trans.TransPerfDelegate.java

/**
 * Tell the user that the transformation is not running or that there is no monitoring configured.
 */// w w w . ja va  2 s.  com
private void showEmptyGraph() {
    if (perfComposite.isDisposed()) {
        return;
    }

    emptyGraph = true;

    Label label = new Label(perfComposite, SWT.CENTER);
    label.setText(BaseMessages.getString(PKG, "TransLog.Dialog.PerformanceMonitoringNotEnabled.Message"));
    label.setBackground(perfComposite.getBackground());
    label.setFont(GUIResource.getInstance().getFontMedium());

    FormData fdLabel = new FormData();
    fdLabel.left = new FormAttachment(5, 0);
    fdLabel.right = new FormAttachment(95, 0);
    fdLabel.top = new FormAttachment(5, 0);
    label.setLayoutData(fdLabel);

    Button button = new Button(perfComposite, SWT.CENTER);
    button.setText(BaseMessages.getString(PKG, "TransLog.Dialog.PerformanceMonitoring.Button"));
    button.setBackground(perfComposite.getBackground());
    button.setFont(GUIResource.getInstance().getFontMedium());

    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            TransGraph.editProperties(spoon.getActiveTransformation(), spoon, spoon.rep, true,
                    TransDialog.Tabs.MONITOR_TAB);
        }
    });

    FormData fdButton = new FormData();
    fdButton.left = new FormAttachment(40, 0);
    fdButton.right = new FormAttachment(60, 0);
    fdButton.top = new FormAttachment(label, 5);
    button.setLayoutData(fdButton);

    perfComposite.layout(true, true);
}

From source file:org.pentaho.di.ui.spoon.trans.TransPerfDelegate.java

public void setupContent() {
    // there is a potential infinite loop below if this method
    // is called when the transgraph is not running, so we check
    // early to make sure it won't happen (see PDI-5009)
    if (!transGraph.isRunning() || transGraph.trans == null
            || !transGraph.trans.getTransMeta().isCapturingStepPerformanceSnapShots()) {
        showEmptyGraph();/*from w  w  w. j a  va 2  s  . co  m*/
        return; // TODO: display help text and rerty button
    }

    if (perfComposite.isDisposed()) {
        return;
    }

    // Remove anything on the perf composite, like an empty page message
    //
    for (Control control : perfComposite.getChildren()) {
        if (!control.isDisposed()) {
            control.dispose();
        }
    }

    emptyGraph = false;

    this.title = transGraph.trans.getTransMeta().getName();
    this.timeDifference = transGraph.trans.getTransMeta().getStepPerformanceCapturingDelay();
    this.stepPerformanceSnapShots = transGraph.trans.getStepPerformanceSnapShots();

    // Wait a second for the first data to pour in...
    // TODO: make this wait more elegant...
    //
    while (this.stepPerformanceSnapShots == null || stepPerformanceSnapShots.isEmpty()) {
        this.stepPerformanceSnapShots = transGraph.trans.getStepPerformanceSnapShots();
        try {
            Thread.sleep(100L);
        } catch (InterruptedException e) {
            // Ignore errors
        }
    }

    Set<String> stepsSet = stepPerformanceSnapShots.keySet();
    steps = stepsSet.toArray(new String[stepsSet.size()]);
    Arrays.sort(steps);

    // Display 2 lists with the data types and the steps on the left side.
    // Then put a canvas with the graph on the right side
    //
    Label dataListLabel = new Label(perfComposite, SWT.NONE);
    dataListLabel.setText(BaseMessages.getString(PKG, "StepPerformanceSnapShotDialog.Metrics.Label"));
    spoon.props.setLook(dataListLabel);
    FormData fdDataListLabel = new FormData();

    fdDataListLabel.left = new FormAttachment(0, 0);
    fdDataListLabel.right = new FormAttachment(spoon.props.getMiddlePct() / 2, Const.MARGIN);
    fdDataListLabel.top = new FormAttachment(0, Const.MARGIN + 5);
    dataListLabel.setLayoutData(fdDataListLabel);

    dataList = new org.eclipse.swt.widgets.List(perfComposite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.LEFT | SWT.BORDER);
    spoon.props.setLook(dataList);
    dataList.setItems(dataChoices);
    dataList.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {

            // If there are multiple selections here AND there are multiple selections in the steps list, we only take the
            // first step in the selection...
            //
            if (dataList.getSelectionCount() > 1 && stepsList.getSelectionCount() > 1) {
                stepsList.setSelection(stepsList.getSelectionIndices()[0]);
            }

            updateGraph();
        }
    });

    FormData fdDataList = new FormData();
    fdDataList.left = new FormAttachment(0, 0);
    fdDataList.right = new FormAttachment(spoon.props.getMiddlePct() / 2, Const.MARGIN);
    fdDataList.top = new FormAttachment(dataListLabel, Const.MARGIN);
    fdDataList.bottom = new FormAttachment(40, Const.MARGIN);
    dataList.setLayoutData(fdDataList);

    Label stepsListLabel = new Label(perfComposite, SWT.NONE);
    stepsListLabel.setText(BaseMessages.getString(PKG, "StepPerformanceSnapShotDialog.Steps.Label"));

    spoon.props.setLook(stepsListLabel);

    FormData fdStepsListLabel = new FormData();
    fdStepsListLabel.left = new FormAttachment(0, 0);
    fdStepsListLabel.right = new FormAttachment(spoon.props.getMiddlePct() / 2, Const.MARGIN);
    fdStepsListLabel.top = new FormAttachment(dataList, Const.MARGIN);
    stepsListLabel.setLayoutData(fdStepsListLabel);

    stepsList = new org.eclipse.swt.widgets.List(perfComposite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.LEFT | SWT.BORDER);
    spoon.props.setLook(stepsList);
    stepsList.setItems(steps);
    stepsList.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {

            // If there are multiple selections here AND there are multiple selections in the data list, we only take the
            // first data item in the selection...
            //
            if (dataList.getSelectionCount() > 1 && stepsList.getSelectionCount() > 1) {
                dataList.setSelection(dataList.getSelectionIndices()[0]);
            }

            updateGraph();
        }
    });
    FormData fdStepsList = new FormData();
    fdStepsList.left = new FormAttachment(0, 0);
    fdStepsList.right = new FormAttachment(spoon.props.getMiddlePct() / 2, Const.MARGIN);
    fdStepsList.top = new FormAttachment(stepsListLabel, Const.MARGIN);
    fdStepsList.bottom = new FormAttachment(100, Const.MARGIN);
    stepsList.setLayoutData(fdStepsList);

    canvas = new Canvas(perfComposite, SWT.NONE);
    spoon.props.setLook(canvas);
    FormData fdCanvas = new FormData();
    fdCanvas.left = new FormAttachment(spoon.props.getMiddlePct() / 2, Const.MARGIN);
    fdCanvas.right = new FormAttachment(100, 0);
    fdCanvas.top = new FormAttachment(0, Const.MARGIN);
    fdCanvas.bottom = new FormAttachment(100, 0);
    canvas.setLayoutData(fdCanvas);

    perfComposite.addControlListener(new ControlAdapter() {
        public void controlResized(ControlEvent event) {
            updateGraph();
        }
    });

    perfComposite.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            if (image != null) {
                image.dispose();
            }
        }
    });

    canvas.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent event) {
            if (image != null && !image.isDisposed()) {
                event.gc.drawImage(image, 0, 0);
            }
        }
    });

    // Refresh automatically every 5 seconds as well.
    //
    final Timer timer = new Timer("TransPerfDelegate Timer");
    timer.schedule(new TimerTask() {
        public void run() {
            updateGraph();
        }
    }, 0, 5000);

    // When the tab is closed, we remove the update timer
    //
    transPerfTab.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent arg0) {
            timer.cancel();
        }
    });
}

From source file:au.gov.ansto.bragg.kakadu.ui.plot.FitPlotPropertiesComposite.java

private void updateParameterGroup(Map<String, Double> parameters, Double quality) {
    inverseButton.setSelection(fitter.isInverse());
    inverseButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }// www.jav  a 2s.  c om

        public void widgetSelected(SelectionEvent arg0) {
            if (fitter.isInverseAllowed())
                inverseButton.setEnabled(isEnabled());
            if (inverseButton.getSelection() != fitter.isInverse())
                setInverseValue(inverseButton.getSelection());
        }

    });
    parameterList.clear();
    GridData data;
    parameterGroup.dispose();
    if (removeButton != null)
        removeButton.dispose();
    parameterGroup = new Group(this, SWT.NONE);
    parameterGroup.setText("Parameters");
    GridLayout propertiesGridLayout = new GridLayout();
    propertiesGridLayout.numColumns = 2;
    propertiesGridLayout.marginHeight = 3;
    propertiesGridLayout.marginWidth = 3;
    propertiesGridLayout.horizontalSpacing = 3;
    propertiesGridLayout.verticalSpacing = 3;
    parameterGroup.setLayout(propertiesGridLayout);
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.horizontalSpan = 2;
    data.grabExcessHorizontalSpace = true;
    parameterGroup.setLayoutData(data);

    Label functionLabel = new Label(parameterGroup, SWT.NONE);
    functionLabel.setText("Function");
    data = new GridData();
    data.verticalAlignment = GridData.BEGINNING;
    data.verticalIndent = 3;
    functionLabel.setLayoutData(data);

    Text functionText = new Text(parameterGroup, SWT.NONE);
    functionText.setText(fitter.getFunctionText());
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    functionText.setLayoutData(data);
    functionText.setEditable(false);

    for (Entry<String, Double> entry : parameters.entrySet()) {
        Label label = new Label(parameterGroup, SWT.NONE);
        label.setText(entry.getKey());
        data = new GridData();
        data.verticalAlignment = GridData.BEGINNING;
        data.verticalIndent = 3;
        label.setLayoutData(data);

        Text text = new Text(parameterGroup, SWT.BORDER);
        text.setData(entry.getKey());
        text.setText(String.valueOf(entry.getValue()));
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        text.setLayoutData(data);

        parameterList.add(text);
    }
    Label resolutionlabel = new Label(parameterGroup, SWT.NONE);
    resolutionlabel.setText("resolution");
    data = new GridData();
    data.verticalAlignment = GridData.BEGINNING;
    data.verticalIndent = 3;
    resolutionlabel.setLayoutData(data);

    resolutionText = new Text(parameterGroup, SWT.BORDER);
    resolutionText.setText(String.valueOf(fitter.getResolutionMultiple()));
    //      resolutionText.
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    resolutionText.setLayoutData(data);

    if (!quality.isNaN()) {
        Label label = new Label(parameterGroup, SWT.NONE);
        label.setText("Quality(" + fitter.getFitterType().getValue() + ")");
        data = new GridData();
        data.verticalAlignment = GridData.BEGINNING;
        data.verticalIndent = 3;
        label.setLayoutData(data);

        Text text = new Text(parameterGroup, SWT.BORDER);
        text.setText(String.valueOf(quality));
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        text.setLayoutData(data);
    }
    if (fitter.getFunctionType() == FunctionType.AddFunction) {
        removeButton = new Button(this, SWT.PUSH);
        removeButton
                .setText("Remove Function " + fitFunctionCombo.getItem(fitFunctionCombo.getSelectionIndex()));
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.verticalAlignment = GridData.FILL;
        data.horizontalSpan = 2;
        data.grabExcessHorizontalSpace = true;
        data.grabExcessVerticalSpace = true;
        removeButton.setLayoutData(data);
        removeButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent arg0) {
            }

            public void widgetSelected(SelectionEvent arg0) {
                try {
                    removeFunction(fitFunctionCombo.getItem(fitFunctionCombo.getSelectionIndex()));
                } catch (Exception e) {
                    plot.handleException(e);
                }
            }

        });
    }
    //      parameterGroup.redraw();
    //      this.redraw();
    //      parent.redraw();
    //      redraw();
    layout();
    if (expandItem != null) {
        expandItem.setHeight(this.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    }
    parent.update();
    parent.redraw();
    //      parent.layout();
}

From source file:com.bdaum.zoom.report.internal.wizards.ReportComponent.java

public ReportComponent(Composite parent, int style, int preview) {
    super(parent, style);
    this.preview = preview;
    setLayout(new FillLayout());
    stack = new Composite(this, SWT.NONE);
    stackLayout = new StackLayout();
    stack.setLayout(stackLayout);/*from   ww w.  j a va2 s  . c  o  m*/

    chartComposite = new ChartComposite(stack, SWT.NONE, null, preview == Integer.MAX_VALUE,
            preview == Integer.MAX_VALUE, preview == Integer.MAX_VALUE, preview == Integer.MAX_VALUE,
            preview == Integer.MAX_VALUE);
    chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    pendingComp = new Composite(stack, SWT.NONE);
    pendingComp.setLayout(new GridLayout(1, false));
    Label label = new Label(pendingComp, SWT.NONE);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    label.setText(Messages.ReportPage_pending);
    if (preview == Integer.MAX_VALUE) {
        progressBar = new ProgressIndicator(pendingComp, SWT.BORDER);
        GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
        data.heightHint = PROGRESS_THICKNESS;
        progressBar.setLayoutData(data);
    }
    stackLayout.topControl = pendingComp;
}

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

/** Initialize the SnippetExplorer controls.
 *
 * @param shell parent shell// w ww . ja  va2 s  .  c  o  m
 */
private void createControls(Shell shell) {
    shell.setLayout(new FormLayout());

    if (listUpdater == null) {
        listUpdater = new ListUpdater();
        listUpdater.start();
    }

    final Composite leftContainer = new Composite(shell, SWT.NONE);
    leftContainer.setLayout(new GridLayout());

    final Sash splitter = new Sash(shell, SWT.BORDER | SWT.VERTICAL);
    final int splitterWidth = 3;
    splitter.addListener(SWT.Selection, e -> splitter.setBounds(e.x, e.y, e.width, e.height));

    final Composite rightContainer = new Composite(shell, SWT.NONE);
    rightContainer.setLayout(new GridLayout());

    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(splitter, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    leftContainer.setLayoutData(formData);

    formData = new FormData();
    formData.left = new FormAttachment(50, 0);
    formData.right = new FormAttachment(50, splitterWidth);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    splitter.setLayoutData(formData);
    splitter.addListener(SWT.Selection, event -> {
        final FormData splitterFormData = (FormData) splitter.getLayoutData();
        splitterFormData.left = new FormAttachment(0, event.x);
        splitterFormData.right = new FormAttachment(0, event.x + splitterWidth);
        shell.layout();
    });

    formData = new FormData();
    formData.left = new FormAttachment(splitter, 0);
    formData.right = new FormAttachment(100, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(100, 0);
    rightContainer.setLayoutData(formData);

    filterField = new Text(leftContainer,
            SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    filterField.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    filterField.setMessage(FILTER_HINT);
    filterField.addListener(SWT.Modify, event -> {
        listUpdater.updateInMs(FILTER_DELAY_MS);
    });
    snippetTable = new Table(leftContainer, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
    snippetTable.setLinesVisible(true);
    snippetTable.setHeaderVisible(true);
    final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.heightHint = 500;
    snippetTable.setLayoutData(data);
    snippetTable.addListener(SWT.MouseDoubleClick, event -> {
        final Point clickPoint = new Point(event.x, event.y);
        launchSnippet(snippetTable.getItem(clickPoint));
    });
    snippetTable.addListener(SWT.KeyUp, event -> {
        if (event.keyCode == '\r' || event.keyCode == '\n') {
            launchSnippet(snippetTable.getSelection());
        }
    });

    final Composite buttonRow = new Composite(leftContainer, SWT.NONE);
    buttonRow.setLayout(new GridLayout(3, false));
    buttonRow.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    startSelectedButton = new Button(buttonRow, SWT.LEAD);
    startSelectedButton.setText("  Start &selected Snippets");
    snippetTable.addListener(SWT.Selection, event -> {
        startSelectedButton.setEnabled(snippetTable.getSelectionCount() > 0);
        updateInfoTab(snippetTable.getSelection());
    });
    startSelectedButton.setEnabled(snippetTable.getSelectionCount() > 0);
    startSelectedButton.addListener(SWT.Selection, event -> {
        launchSnippet(snippetTable.getSelection());
    });

    final Label runnerLabel = new Label(buttonRow, SWT.NONE);
    runnerLabel.setText("Snippet Runner:");
    runnerLabel.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, true, false));

    runnerCombo = new Combo(buttonRow, SWT.TRAIL | SWT.DROP_DOWN | SWT.READ_ONLY);
    runnerMapping.clear();
    if (multiDisplaySupport) {
        runnerCombo.add("Thread");
        runnerMapping.add(THREAD_RUNNER);
    }
    if (javaCommand != null) {
        runnerCombo.add("Process");
        runnerMapping.add(PROCESS_RUNNER);
    }
    runnerCombo.add("Serial");
    runnerMapping.add(null);
    runnerCombo.setData(runnerMapping);
    runnerCombo.addListener(SWT.Modify, event -> {
        if (runnerMapping.size() > runnerCombo.getSelectionIndex()) {
            snippetRunner = runnerMapping.get(runnerCombo.getSelectionIndex());
        } else {
            System.err.println("Unknown runner index " + runnerCombo.getSelectionIndex());
        }
    });
    runnerCombo.select(0);

    infoTabs = new TabFolder(rightContainer, SWT.TOP);
    infoTabs.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    descriptionView = new StyledText(infoTabs, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL);

    sourceView = new StyledText(infoTabs, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
    setMonospaceFont(sourceView);

    final ScrolledComposite previewContainer = new ScrolledComposite(infoTabs, SWT.V_SCROLL | SWT.H_SCROLL);
    previewImageLabel = new Label(previewContainer, SWT.NONE);
    previewContainer.setContent(previewImageLabel);

    final TabItem descriptionTab = new TabItem(infoTabs, SWT.NONE);
    descriptionTab.setText("Description");
    descriptionTab.setControl(descriptionView);
    final TabItem sourceTab = new TabItem(infoTabs, SWT.NONE);
    sourceTab.setText("Source");
    sourceTab.setControl(sourceView);
    final TabItem previewTab = new TabItem(infoTabs, SWT.NONE);
    previewTab.setText("Preview");
    previewTab.setControl(previewContainer);

    updateInfoTab(null, true);
    updateInfoTab(snippetTable.getSelection());
}

From source file:com.planetmayo.debrief.satc_rcp.views.MaintainContributionsView.java

private void initPreferencesGroup(Composite parent) {
    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;

    Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
    GridLayout layout = new GridLayout(1, false);
    group.setLayoutData(gridData);/*w  ww.  jav a 2  s  .c  o  m*/
    group.setLayout(layout);
    group.setText("Preferences");

    final ScrolledComposite scrolled = new ScrolledComposite(group, SWT.H_SCROLL);
    scrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Composite preferencesComposite = UIUtils.createScrolledBody(scrolled, SWT.NONE);
    preferencesComposite.setLayout(new GridLayout(6, false));

    scrolled.addListener(SWT.Resize, new Listener() {

        @Override
        public void handleEvent(Event e) {
            scrolled.setMinSize(preferencesComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });
    scrolled.setAlwaysShowScrollBars(true);
    scrolled.setContent(preferencesComposite);
    scrolled.setMinSize(preferencesComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);

    liveConstraints = new Button(preferencesComposite, SWT.TOGGLE);
    liveConstraints.setText("Auto-Recalc of Constraints");
    liveConstraints.setEnabled(false);
    liveConstraints
            .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER));

    recalculate = new Button(preferencesComposite, SWT.DEFAULT);
    recalculate.setText("Calculate Solution");
    recalculate.setEnabled(false);
    recalculate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (activeSolver != null) {
                // ok - make sure the performance tab is open
                graphTabs.setSelection(performanceTab);

                activeSolver.run(true, true);
                main.setSize(0, 0);
                main.getParent().layout(true, true);
            }
        }
    });
    recalculate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER));

    cancelGeneration = new Button(preferencesComposite, SWT.PUSH);
    cancelGeneration.setText("Cancel");
    cancelGeneration.setVisible(false);
    cancelGeneration.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (activeSolver != null) {
                activeSolver.cancel();
            }
        }
    });

    suppressCuts = new Button(preferencesComposite, SWT.CHECK);
    suppressCuts.setText("Suppress Cuts");
    suppressCuts.setVisible(true);
    suppressCuts.setEnabled(false);
    suppressCuts.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (activeSolver != null) {
                boolean doSuppress = suppressCuts.getSelection();
                activeSolver.setAutoSuppress(doSuppress);
            }
        }
    });

    showOSCourse = new Button(preferencesComposite, SWT.CHECK);
    showOSCourse.setText("Plot O/S Course");
    showOSCourse.setVisible(true);
    showOSCourse.setEnabled(false);
    showOSCourse.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (activeSolver != null) {
                redoOwnshipStates();
            }
        }
    });

    Composite precisionPanel = new Composite(preferencesComposite, SWT.NONE);
    precisionPanel.setLayoutData(new GridData(
            GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));

    GridLayout precisionLayout = new GridLayout(2, false);
    precisionLayout.horizontalSpacing = 5;
    precisionPanel.setLayout(precisionLayout);

    Label precisionLabel = new Label(precisionPanel, SWT.NONE);
    precisionLabel.setText("Precision:");
    precisionLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));

    precisionsCombo = new ComboViewer(precisionPanel);
    precisionsCombo.getCombo().setEnabled(false);
    precisionsCombo.setContentProvider(new ArrayContentProvider());
    precisionsCombo.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((Precision) element).getLabel();
        }
    });
    precisionsCombo.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection sel = precisionsCombo.getSelection();
            IStructuredSelection cSel = (IStructuredSelection) sel;
            Precision precision = (Precision) cSel.getFirstElement();
            if (activeSolver != null) {
                activeSolver.setPrecision(precision);
            }
        }
    });
}

From source file:fr.inria.soctrace.framesoc.ui.histogram.view.HistogramView.java

@Override
public void createFramesocPartControl(Composite parent) {

    statusLineManager = getViewSite().getActionBars().getStatusLineManager();

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

    // Sash
    SashForm sashForm = new SashForm(parent, SWT.NONE);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    // Chart Composite
    compositeChart = new Composite(sashForm, SWT.BORDER);
    FillLayout fl_compositeChart = new FillLayout(SWT.HORIZONTAL);
    compositeChart.setLayout(fl_compositeChart);
    compositeChart.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            int width = Math.max(compositeChart.getSize().x - 40, 1);
            numberOfTicks = Math.max(width / TIMESTAMP_MAX_SIZE, 1);
            refresh(false, false, true);
        }
    });

    // Configuration Composite
    compositeConf = new Composite(sashForm, SWT.NONE);
    GridLayout gl_compositeConf = new GridLayout(1, false);
    gl_compositeConf.marginHeight = 1;
    gl_compositeConf.verticalSpacing = 0;
    gl_compositeConf.marginWidth = 0;
    compositeConf.setLayout(gl_compositeConf);
    compositeConf.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    // Tab folder
    TabFolder tabFolder = new TabFolder(compositeConf, SWT.NONE);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    PatternFilter filter = new TreePatternFilter();
    TreeContentProvider contentProvider = new TreeContentProvider();
    ViewerComparator treeComparator = new ViewerComparator();
    SelectionChangedListener selectionChangeListener = new SelectionChangedListener();
    CheckStateListener checkStateListener = new CheckStateListener();

    SquareIconLabelProvider p = null;

    // Tab item types
    TabItem tbtmEventTypes = new TabItem(tabFolder, SWT.NONE);
    tbtmEventTypes.setData(ConfigurationDimension.TYPE);
    tbtmEventTypes.setText(ConfigurationDimension.TYPE.getName());
    filter.setIncludeLeadingWildcard(true);
    FilteredCheckboxTree typeTree = new FilteredCheckboxTree(tabFolder, SWT.BORDER, filter, true);
    configurationMap.get(ConfigurationDimension.TYPE).tree = typeTree;
    typeTree.getViewer().setContentProvider(contentProvider);
    p = new EventTypeTreeLabelProvider();
    labelProviders.add(p);
    typeTree.getViewer().setLabelProvider(p);
    typeTree.getViewer().setComparator(treeComparator);
    typeTree.addCheckStateListener(checkStateListener);
    typeTree.getViewer().addSelectionChangedListener(selectionChangeListener);
    tbtmEventTypes.setControl(typeTree);

    // Tab item producers
    TabItem tbtmEventProducers = new TabItem(tabFolder, SWT.NONE);
    tbtmEventProducers.setData(ConfigurationDimension.PRODUCERS);
    tbtmEventProducers.setText(ConfigurationDimension.PRODUCERS.getName());
    FilteredCheckboxTree prodTree = new FilteredCheckboxTree(tabFolder, SWT.BORDER, filter, true);
    configurationMap.get(ConfigurationDimension.PRODUCERS).tree = prodTree;
    prodTree.getViewer().setContentProvider(contentProvider);
    p = new EventProducerTreeLabelProvider();
    labelProviders.add(p);
    prodTree.getViewer().setLabelProvider(p);
    prodTree.getViewer().setComparator(treeComparator);
    prodTree.addCheckStateListener(checkStateListener);
    prodTree.getViewer().addSelectionChangedListener(selectionChangeListener);
    tbtmEventProducers.setControl(prodTree);

    // sash weights
    sashForm.setWeights(new int[] { 80, 20 });
    // tab switch
    tabFolder.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            currentDimension = (ConfigurationDimension) event.item.getData();
            enableTreeButtons();
            enableSubTreeButtons();
        }
    });

    // Buttons
    Composite compositeBtn = new Composite(compositeConf, SWT.BORDER);
    GridLayout gl_compositeBtn = new GridLayout(10, false);
    gl_compositeBtn.marginWidth = 1;
    gl_compositeBtn.horizontalSpacing = 1;
    compositeBtn.setLayout(gl_compositeBtn);
    compositeBtn.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));

    btnCheckall = new Button(compositeBtn, SWT.NONE);
    btnCheckall.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    btnCheckall.setToolTipText("Check all");
    btnCheckall.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "icons/check_all.png"));
    btnCheckall.setEnabled(false);
    btnCheckall.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (configurationMap.get(currentDimension).roots != null) {
                FilteredCheckboxTree tree = configurationMap.get(currentDimension).tree;
                TreeContentProvider provider = (TreeContentProvider) tree.getViewer().getContentProvider();
                Object[] roots = provider.getElements(tree.getViewer().getInput());
                for (Object root : roots) {
                    checkElementAndSubtree(root);
                }
                selectionChanged();
            }
        }
    });

    btnUncheckall = new Button(compositeBtn, SWT.NONE);
    btnUncheckall.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    btnUncheckall.setToolTipText("Uncheck all");
    btnUncheckall.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "icons/uncheck_all.png"));
    btnUncheckall.setEnabled(false);
    btnUncheckall.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            configurationMap.get(currentDimension).tree.setCheckedElements(EMPTY_ARRAY);
            selectionChanged();
        }
    });

    Label separator = new Label(compositeBtn, SWT.SEPARATOR | SWT.VERTICAL);
    GridData gd_separator = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
    gd_separator.horizontalIndent = 2;
    gd_separator.widthHint = 5;
    gd_separator.heightHint = 20;
    separator.setLayoutData(gd_separator);

    btnCheckSubtree = new Button(compositeBtn, SWT.NONE);
    btnCheckSubtree.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    btnCheckSubtree.setToolTipText("Check subtree");
    btnCheckSubtree.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "icons/check_subtree.png"));
    btnCheckSubtree.setEnabled(false);
    btnCheckSubtree.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (configurationMap.get(currentDimension).roots != null) {
                ITreeNode node = getCurrentSelection(configurationMap.get(currentDimension).tree);
                if (node == null)
                    return;
                checkElementAndSubtree(node);
                selectionChanged();
            }
        }
    });

    btnUncheckSubtree = new Button(compositeBtn, SWT.NONE);
    btnUncheckSubtree.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    btnUncheckSubtree.setToolTipText("Uncheck subtree");
    btnUncheckSubtree
            .setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "icons/uncheck_subtree.png"));
    btnUncheckSubtree.setEnabled(false);
    btnUncheckSubtree.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (configurationMap.get(currentDimension).roots != null) {
                ITreeNode node = getCurrentSelection(configurationMap.get(currentDimension).tree);
                if (node == null)
                    return;
                uncheckElement(node);
                uncheckAncestors(node);
                selectionChanged();
            }
        }
    });

    // Time management bar
    Composite timeComposite = new Composite(parent, SWT.BORDER);
    timeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, 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);
    IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
    timeBar.setStatusLineManager(statusLineManager);
    timeBar.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TimeInterval barInterval = timeBar.getSelection();
            if (marker == null) {
                addNewMarker(barInterval.startTimestamp, barInterval.endTimestamp);
            } else {
                marker.setStartValue(barInterval.startTimestamp);
                marker.setEndValue(barInterval.endTimestamp);
            }
            selectedTs0 = barInterval.startTimestamp;
            selectedTs1 = barInterval.endTimestamp;
            timeChanged = !barInterval.equals(loadedInterval);
        }
    });
    // button to synch the timebar, producers and type with the current loaded data
    timeBar.getSynchButton().setToolTipText("Reset Timebar, Types and Producers");
    timeBar.getSynchButton().addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (loadedInterval != null) {
                timeBar.setSelection(loadedInterval);
                if (marker != null && plot != null) {
                    plot.removeDomainMarker(marker);
                    marker = null;
                }
            }
            for (ConfigurationData data : configurationMap.values()) {
                data.tree.setCheckedElements(data.checked);
            }
            timeChanged = false;
            enableTreeButtons();
            enableSubTreeButtons();
        }
    });
    // load button
    timeBar.getLoadButton().addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (timeChanged || configurationChanged) {
                loadHistogram(currentShownTrace, timeBar.getSelection());
            }
        }
    });

    // build toolbar
    IActionBars actionBars = getViewSite().getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    TableTraceIntervalAction.add(toolBar, createTableAction());
    GanttTraceIntervalAction.add(toolBar, createGanttAction());
    PieTraceIntervalAction.add(toolBar, createPieAction());
    enableActions(false);
}