Search in sources :

Example 86 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.

the class PerfOptionsTab method createControl.

@Override
public void createControl(Composite parent) {
    scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollTop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrollTop.setExpandVertical(true);
    scrollTop.setExpandHorizontal(true);
    setControl(scrollTop);
    top = new Composite(scrollTop, SWT.NONE);
    top.setLayout(new GridLayout());
    createVerticalSpacer(top, 1);
    GridData data;
    // Kernel Selection
    Composite kernelComp = new Composite(top, SWT.NONE);
    GridLayout parallelLayout = new GridLayout(2, false);
    data = new GridData(GridData.FILL_HORIZONTAL);
    parallelLayout.marginHeight = 0;
    parallelLayout.marginWidth = 0;
    kernelComp.setLayout(parallelLayout);
    kernelComp.setLayoutData(data);
    Label kernelLabel = new Label(kernelComp, SWT.NONE);
    kernelLabel.setText(PerfPlugin.STRINGS_Kernel_Location);
    data = new GridData();
    data.horizontalSpan = 2;
    kernelLabel.setLayoutData(data);
    txtKernelLocation = new Text(kernelComp, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    txtKernelLocation.setLayoutData(data);
    txtKernelLocation.addModifyListener(mev -> handleKernelImageFileTextModify(txtKernelLocation));
    Button button = createPushButton(kernelComp, Messages.PerfOptionsTab_Browse, null);
    final Shell shell = top.getShell();
    button.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> showFileDialog(shell)));
    createVerticalSpacer(top, 1);
    // Create checkbox options container
    Composite chkBoxComp = new Composite(top, SWT.NONE);
    GridLayout chkBoxLayout = new GridLayout();
    chkBoxLayout.marginHeight = 0;
    chkBoxLayout.marginWidth = 0;
    chkBoxComp.setLayout(chkBoxLayout);
    chkRecordVerbose = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_Record_Verbose);
    chkModuleSymbols = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_ModuleSymbols);
    chkHideUnresolvedSymbols = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_HideUnresolvedSymbols);
    chkSourceLineNumbers = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_SourceLineNumbers);
    chkShowSourceDisassembly = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_ShowSourceDisassembly);
    Composite showStatComp = new Composite(top, SWT.NONE);
    showStatComp.setLayout(parallelLayout);
    chkShowStat = createCheckButtonHelper(showStatComp, PerfPlugin.STRINGS_ShowStat);
    chkShowStat.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> handleShowStatSelection()));
    statRunCount = new Spinner(showStatComp, SWT.BORDER);
    statRunCount.setEnabled(false);
    statRunCount.setMinimum(1);
    statRunCount.addModifyListener(e -> updateLaunchConfigurationDialog());
    chkSourceLineNumbers.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if ((chkKernelSourceLineNumbers != null) && (!chkSourceLineNumbers.getSelection())) {
            chkKernelSourceLineNumbers.setEnabled(false);
        } else {
            chkKernelSourceLineNumbers.setEnabled(true);
        }
    }));
    chkKernelSourceLineNumbers = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_Kernel_SourceLineNumbers);
    Composite realtimeComp = new Composite(top, SWT.NONE);
    realtimeComp.setLayout(parallelLayout);
    chkRecordRealtime = createCheckButtonHelper(realtimeComp, PerfPlugin.STRINGS_Record_Realtime);
    chkRecordRealtime.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        rtPriority.setEnabled(chkRecordRealtime.getSelection());
    }));
    rtPriority = new Spinner(realtimeComp, SWT.BORDER);
    rtPriority.setEnabled(chkRecordRealtime.getSelection());
    rtPriority.setMinimum(1);
    rtPriority.addModifyListener(e -> updateLaunchConfigurationDialog());
    // A disabled button does not respond to mouse events so use a composite.
    final Composite multiplexEventsComp = new Composite(chkBoxComp, SWT.NONE);
    multiplexEventsComp.setLayout(chkBoxLayout);
    multiplexEventsComp.addListener(SWT.MouseHover, event -> multiplexEventsComp.setToolTipText(Messages.PerfOptionsTab_Requires_LTE + multiplexEventsVersion));
    chkMultiplexEvents = createCheckButtonHelper(multiplexEventsComp, PerfPlugin.STRINGS_Multiplex);
    scrollTop.setContent(top);
    recomputeSize();
    updateLaunchConfigurationDialog();
}
Also used : PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) Spinner(org.eclipse.swt.widgets.Spinner) PerfPlugin(org.eclipse.linuxtools.internal.perf.PerfPlugin) Point(org.eclipse.swt.graphics.Point) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) PerfCore(org.eclipse.linuxtools.internal.perf.PerfCore) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) PlatformUI(org.eclipse.ui.PlatformUI) FileDialog(org.eclipse.swt.widgets.FileDialog) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) File(java.io.File) ISharedImages(org.eclipse.ui.ISharedImages) SWT(org.eclipse.swt.SWT) MessageBox(org.eclipse.swt.widgets.MessageBox) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) GridLayout(org.eclipse.swt.layout.GridLayout) Shell(org.eclipse.swt.widgets.Shell) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Text(org.eclipse.swt.widgets.Text)

Example 87 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.

the class ValgrindOptionsTab method createControl.

@Override
public void createControl(Composite parent) {
    // Check for exception
    if (ex != null) {
        setErrorMessage(ex.getLocalizedMessage());
    }
    scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollTop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrollTop.setExpandVertical(true);
    scrollTop.setExpandHorizontal(true);
    setControl(scrollTop);
    top = new Composite(scrollTop, SWT.NONE);
    top.setLayout(new GridLayout());
    createVerticalSpacer(top, 1);
    // provide the tool combo if it is not excluded
    if (!noToolCombo)
        createToolCombo(top);
    createVerticalSpacer(top, 1);
    optionsFolder = new TabFolder(top, SWT.BORDER);
    optionsFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    // "general" tab
    TabItem generalTab = new TabItem(optionsFolder, SWT.NONE);
    // $NON-NLS-1$
    generalTab.setText(Messages.getString("ValgrindOptionsTab.General"));
    Composite generalTop = new Composite(optionsFolder, SWT.NONE);
    generalTop.setLayout(new GridLayout());
    generalTop.setLayoutData(new GridData(GridData.FILL_BOTH));
    createBasicOptions(generalTop);
    createVerticalSpacer(generalTop, 1);
    createErrorOptions(generalTop);
    createVerticalSpacer(generalTop, 1);
    createOtherOptions(generalTop);
    generalTab.setControl(generalTop);
    TabItem suppTab = new TabItem(optionsFolder, SWT.NONE);
    // $NON-NLS-1$
    suppTab.setText(Messages.getString("ValgrindOptionsTab.Suppressions"));
    Composite suppTop = new Composite(optionsFolder, SWT.NONE);
    suppTop.setLayout(new GridLayout());
    suppTop.setLayoutData(new GridData(GridData.FILL_BOTH));
    createSuppressionsOption(suppTop);
    suppTab.setControl(suppTop);
    toolTab = new TabItem(optionsFolder, SWT.NONE);
    // $NON-NLS-1$
    toolTab.setText(Messages.getString("ValgrindOptionsTab.Tool"));
    dynamicTabHolder = new Composite(optionsFolder, SWT.NONE);
    dynamicTabHolder.setLayout(new GridLayout());
    dynamicTabHolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    toolTab.setControl(dynamicTabHolder);
    scrollTop.setContent(top);
    recomputeSize();
    updateLaunchConfigurationDialog();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 88 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.

the class SubnodeLayoutJSONEditorPage method createBasicComposite.

private Composite createBasicComposite(final Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, true));
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
    composite.setLayoutData(gridData);
    ScrolledComposite scrollPane = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    scrollPane.setExpandHorizontal(true);
    scrollPane.setExpandVertical(true);
    m_basicComposite = new Composite(scrollPane, SWT.NONE);
    scrollPane.setContent(m_basicComposite);
    scrollPane.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    fillBasicComposite();
    scrollPane.setMinSize(m_basicComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 89 with ScrolledComposite

use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.

the class SubnodeLayoutPage method createControl.

/**
 * {@inheritDoc}
 */
@Override
public void createControl(final Composite parent) {
    ScrolledComposite scrollPane = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    scrollPane.setExpandHorizontal(true);
    scrollPane.setExpandVertical(true);
    Composite composite = new Composite(scrollPane, SWT.NONE);
    scrollPane.setContent(composite);
    scrollPane.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    composite.setLayout(new GridLayout(4, false));
    composite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    Label titleLabel = new Label(composite, SWT.LEFT);
    FontData fontData = titleLabel.getFont().getFontData()[0];
    Font boldFont = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
    titleLabel.setText("Node");
    titleLabel.setFont(boldFont);
    Label xLabel = new Label(composite, SWT.LEFT);
    xLabel.setText("X");
    xLabel.setFont(boldFont);
    Label yLabel = new Label(composite, SWT.LEFT);
    yLabel.setText("Y");
    yLabel.setFont(boldFont);
    Label paddingLabel = new Label(composite, SWT.LEFT);
    paddingLabel.setText("Padding");
    paddingLabel.setFont(boldFont);
    for (final NodeID nodeID : m_viewNodes) {
        NodeContainer nodeContainer = m_wfManager.getNodeContainer(nodeID);
        WizardNodeLayoutInfo layoutInfo = null;
        if (m_subNodeContainer != null && m_subNodeContainer.getLayoutInfo() != null) {
            layoutInfo = m_subNodeContainer.getLayoutInfo().get(nodeID.getIndex());
            if (layoutInfo != null) {
                m_layoutMap.put(nodeID.getIndex(), layoutInfo);
            }
        }
        Composite labelComposite = new Composite(composite, SWT.NONE);
        labelComposite.setLayout(new GridLayout(2, false));
        labelComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
        Label iconLabel = new Label(labelComposite, SWT.CENTER);
        iconLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
        try (InputStream iconURLStream = FileLocator.resolve(nodeContainer.getIcon()).openStream()) {
            iconLabel.setImage(new Image(Display.getCurrent(), iconURLStream));
        } catch (IOException e) {
        /* do nothing */
        }
        Label nodeLabel = new Label(labelComposite, SWT.LEFT);
        nodeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
        String nodeName = nodeContainer.getName();
        String annotation = nodeContainer.getNodeAnnotation().getText();
        nodeLabel.setText(nodeName + "\nID: " + nodeID.getIndex() + "\n" + annotation);
        GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
        gridData.widthHint = 80;
        final Text xText = new Text(composite, SWT.SINGLE | SWT.BORDER);
        xText.setLayoutData(gridData);
        xText.setText(layoutInfo == null ? "" : layoutInfo.getX());
        xText.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(final ModifyEvent e) {
                editX(nodeID, xText);
            }
        });
        final Text yText = new Text(composite, SWT.SINGLE | SWT.BORDER);
        yText.setLayoutData(gridData);
        yText.setText(layoutInfo == null ? "" : layoutInfo.getY());
        yText.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(final ModifyEvent e) {
                editY(nodeID, yText);
            }
        });
        final Text paddingText = new Text(composite, SWT.SINGLE | SWT.BORDER);
        paddingText.setLayoutData(gridData);
        paddingText.setText(layoutInfo == null || layoutInfo.getPadding() == null ? "" : layoutInfo.getPadding());
        paddingText.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(final ModifyEvent e) {
                editPadding(nodeID, paddingText);
            }
        });
    }
    scrollPane.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    setControl(scrollPane);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) InputStream(java.io.InputStream) FontData(org.eclipse.swt.graphics.FontData) Label(org.eclipse.swt.widgets.Label) SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) NodeContainer(org.knime.core.node.workflow.NodeContainer) Text(org.eclipse.swt.widgets.Text) IOException(java.io.IOException) Image(org.eclipse.swt.graphics.Image) Font(org.eclipse.swt.graphics.Font) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) NodeID(org.knime.core.node.workflow.NodeID) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) WizardNodeLayoutInfo(org.knime.core.node.wizard.WizardNodeLayoutInfo)

Aggregations

ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)89 Composite (org.eclipse.swt.widgets.Composite)67 GridData (org.eclipse.swt.layout.GridData)55 GridLayout (org.eclipse.swt.layout.GridLayout)51 Label (org.eclipse.swt.widgets.Label)39 Point (org.eclipse.swt.graphics.Point)27 Button (org.eclipse.swt.widgets.Button)21 Text (org.eclipse.swt.widgets.Text)20 FillLayout (org.eclipse.swt.layout.FillLayout)19 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)14 Control (org.eclipse.swt.widgets.Control)13 Group (org.eclipse.swt.widgets.Group)13 ControlEvent (org.eclipse.swt.events.ControlEvent)10 Rectangle (org.eclipse.swt.graphics.Rectangle)9 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)8 ArrayList (java.util.ArrayList)7 Combo (org.eclipse.swt.widgets.Combo)7 Image (org.eclipse.swt.graphics.Image)6 FormAttachment (org.eclipse.swt.layout.FormAttachment)6