Search in sources :

Example 81 with ScrolledComposite

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

the class SystemTapScriptGraphOptionsTab method createColumnSelector.

private void createColumnSelector(Composite parent) {
    GridLayout layout = new GridLayout();
    parent.setLayout(layout);
    Composite topLayout = new Composite(parent, SWT.NONE);
    topLayout.setLayout(new GridLayout(1, false));
    topLayout.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    Button generateExpsButton = new Button(topLayout, SWT.PUSH);
    generateExpsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    generateExpsButton.setText(Messages.SystemTapScriptGraphOptionsTab_generateFromPrintsButton);
    generateExpsButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_generateFromPrintsTooltip);
    generateExpsButton.addSelectionListener(regexGenerator);
    Composite regexButtonLayout = new Composite(parent, SWT.NONE);
    regexButtonLayout.setLayout(new GridLayout(3, false));
    regexButtonLayout.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label selectedRegexLabel = new Label(regexButtonLayout, SWT.NONE);
    selectedRegexLabel.setText(Messages.SystemTapScriptGraphOptionsTab_regexLabel);
    selectedRegexLabel.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_regexTooltip);
    regularExpressionCombo = new Combo(regexButtonLayout, SWT.DROP_DOWN);
    regularExpressionCombo.setTextLimit(MAX_REGEX_LENGTH);
    regularExpressionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    regularExpressionCombo.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        int selected = regularExpressionCombo.getSelectionIndex();
        if (selected == selectedRegex) {
            return;
        }
        // If deselecting an empty regular expression, delete it automatically.
        if (regularExpressionCombo.getItem(selectedRegex).isEmpty() && graphsDataList.get(selectedRegex).size() == 0 && outputList.get(selectedRegex).isEmpty()) {
            // Otherwise, the deleted blank entry would be replaced by another blank entry.
            if (selected == regularExpressionCombo.getItemCount() - 1) {
                // To keep the text blank.
                regularExpressionCombo.select(selectedRegex);
                return;
            }
            removeRegex(false);
            if (selected > selectedRegex) {
                selected--;
            }
        }
        // update all appropriate values to make room for a new regular expression.
        if (selected == regularExpressionCombo.getItemCount() - 1 && getNumberOfRegexs() < MAX_NUMBER_OF_REGEXS) {
            // $NON-NLS-1$
            outputList.add("");
            regexErrorMessages.add(null);
            columnNamesList.add(new ArrayList<String>());
            cachedNamesList.add(new Stack<String>());
            graphsDataList.add(new LinkedList<GraphData>());
            // Remove "Add New Regex" from the selected combo item; make it blank.
            // $NON-NLS-1$
            regularExpressionCombo.setItem(selected, "");
            regularExpressionCombo.select(selected);
            updateRegexSelection(selected, false);
            updateLaunchConfigurationDialog();
            // (Don't do this _every_ time something is added.)
            if (getNumberOfRegexs() == 2) {
                removeRegexButton.setEnabled(true);
            }
            if (getNumberOfRegexs() < MAX_NUMBER_OF_REGEXS) {
                regularExpressionCombo.add(Messages.SystemTapScriptGraphOptionsTab_regexAddNew);
            }
        } else {
            updateRegexSelection(selected, false);
        }
    }));
    regularExpressionCombo.addModifyListener(regexListener);
    removeRegexButton = new Button(regexButtonLayout, SWT.PUSH);
    removeRegexButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
    removeRegexButton.setText(Messages.SystemTapScriptGraphOptionsTab_regexRemove);
    removeRegexButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        IWorkbench workbench = PlatformUI.getWorkbench();
        MessageDialog dialog = new MessageDialog(workbench.getActiveWorkbenchWindow().getShell(), Messages.SystemTapScriptGraphOptionsTab_removeRegexTitle, null, MessageFormat.format(Messages.SystemTapScriptGraphOptionsTab_removeRegexAsk, regularExpressionCombo.getItem(selectedRegex)), MessageDialog.QUESTION, new String[] { "Yes", "No" }, // $NON-NLS-1$ //$NON-NLS-2$
        0);
        int result = dialog.open();
        if (result == 0) {
            // Yes
            removeRegex(true);
        }
    }));
    GridLayout twoColumns = new GridLayout(2, false);
    Composite regexSummaryComposite = new Composite(parent, SWT.NONE);
    regexSummaryComposite.setLayout(twoColumns);
    regexSummaryComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    Label sampleOutputLabel = new Label(regexSummaryComposite, SWT.NONE);
    sampleOutputLabel.setText(Messages.SystemTapScriptGraphOptionsTab_sampleOutputLabel);
    sampleOutputLabel.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_sampleOutputTooltip);
    this.sampleOutputText = new Text(regexSummaryComposite, SWT.BORDER);
    this.sampleOutputText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    this.sampleOutputText.addModifyListener(sampleOutputListener);
    sampleOutputText.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_sampleOutputTooltip);
    Composite expressionTableLabels = new Composite(parent, SWT.NONE);
    expressionTableLabels.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    expressionTableLabels.setLayout(twoColumns);
    Label label = new Label(expressionTableLabels, SWT.NONE);
    label.setText(Messages.SystemTapScriptGraphOptionsTab_columnTitle);
    label.setAlignment(SWT.LEFT);
    Label label2 = new Label(expressionTableLabels, SWT.NONE);
    label2.setAlignment(SWT.LEFT);
    label2.setText(Messages.SystemTapScriptGraphOptionsTab_extractedValueLabel);
    ScrolledComposite regexTextScrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    data.heightHint = 200;
    regexTextScrolledComposite.setLayoutData(data);
    textFieldsComposite = new Composite(regexTextScrolledComposite, SWT.NONE);
    textFieldsComposite.setLayout(new GridLayout(4, false));
    regexTextScrolledComposite.setContent(textFieldsComposite);
    regexTextScrolledComposite.setExpandHorizontal(true);
    // To position the column labels properly, add a dummy column and use its children's sizes for reference.
    // This is necessary since expressionTableLabels can't share a layout with textFieldsComposite.
    textListenersEnabled = false;
    addColumn(null);
    data = new GridData(SWT.FILL, SWT.FILL, false, false);
    data.horizontalIndent = textFieldsComposite.getChildren()[2].getLocation().x;
    data.widthHint = textFieldsComposite.getChildren()[2].getSize().x;
    label.setLayoutData(data);
    label2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    removeColumn(false);
    textListenersEnabled = true;
}
Also used : RowDataSet(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.RowDataSet) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) Table(org.eclipse.swt.widgets.Table) Stack(java.util.Stack) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ExceptionErrorDialog(org.eclipse.linuxtools.systemtap.graphing.ui.widgets.ExceptionErrorDialog) Matcher(java.util.regex.Matcher) ILaunchConfigurationTab(org.eclipse.debug.ui.ILaunchConfigurationTab) GraphFactory(org.eclipse.linuxtools.systemtap.graphing.ui.wizards.graph.GraphFactory) IDEPlugin(org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPlugin) DataSetFactory(org.eclipse.linuxtools.systemtap.graphing.ui.wizards.dataset.DataSetFactory) IPath(org.eclipse.core.runtime.IPath) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) GraphData(org.eclipse.linuxtools.systemtap.graphing.core.structures.GraphData) AbstractUIPlugin(org.eclipse.ui.plugin.AbstractUIPlugin) GridData(org.eclipse.swt.layout.GridData) LinkedList(java.util.LinkedList) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) TableItem(org.eclipse.swt.widgets.TableItem) Text(org.eclipse.swt.widgets.Text) PatternSyntaxException(java.util.regex.PatternSyntaxException) IDataSetParser(org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataSetParser) Combo(org.eclipse.swt.widgets.Combo) Button(org.eclipse.swt.widgets.Button) PlatformUI(org.eclipse.ui.PlatformUI) IDataSet(org.eclipse.linuxtools.systemtap.graphing.core.datasets.IDataSet) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Group(org.eclipse.swt.widgets.Group) SelectGraphAndSeriesWizard(org.eclipse.linuxtools.systemtap.graphing.ui.wizards.graph.SelectGraphAndSeriesWizard) IFilteredDataSet(org.eclipse.linuxtools.systemtap.graphing.core.datasets.IFilteredDataSet) List(java.util.List) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) Entry(java.util.Map.Entry) IWorkbench(org.eclipse.ui.IWorkbench) Pattern(java.util.regex.Pattern) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) Control(org.eclipse.swt.widgets.Control) LineParser(org.eclipse.linuxtools.systemtap.graphing.core.datasets.row.LineParser) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) LinkedList(java.util.LinkedList) Stack(java.util.Stack) IWorkbench(org.eclipse.ui.IWorkbench) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 82 with ScrolledComposite

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

the class PackageVMPage method createControl.

@Override
public void createControl(Composite parent) {
    ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollTop.setExpandVertical(true);
    scrollTop.setExpandHorizontal(true);
    final Composite container = new Composite(scrollTop, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false).applyTo(container);
    // Box name
    final Label boxNameLabel = new Label(container, SWT.NONE);
    boxNameLabel.setText(// $NON-NLS-1$
    WizardMessages.getString("ImagePull.name.label"));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxNameLabel);
    final Text boxNameText = new Text(container, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(boxNameText);
    boxNameText.setToolTipText(// $NON-NLS-1$
    WizardMessages.getString("ImagePull.name.tooltip"));
    // Name binding
    final IObservableValue<String> boxNameObservable = BeanProperties.value(PackageVMPageModel.class, PackageVMPageModel.BOX_NAME).observe(model);
    dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxNameText), boxNameObservable, new UpdateValueStrategy(), null);
    // Box folder
    final Label boxFolderLabel = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    boxFolderLabel.setText(WizardMessages.getString("PackageVMPage.folder.label"));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(boxFolderLabel);
    final Text boxFolderText = new Text(container, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(boxFolderText);
    boxFolderText.setToolTipText(// $NON-NLS-1$
    WizardMessages.getString("PackageVMPage.folder.desc"));
    // Folder binding
    final IObservableValue<String> boxFolderObservable = BeanProperties.value(PackageVMPageModel.class, PackageVMPageModel.BOX_FOLDER).observe(model);
    dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(boxFolderText), boxFolderObservable, new UpdateValueStrategy(), null);
    // search
    final Button searchButton = new Button(container, SWT.NONE);
    searchButton.setText(// $NON-NLS-1$
    WizardMessages.getString("ImagePull.search.label"));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).applyTo(searchButton);
    searchButton.addSelectionListener(onSearchFolder());
    dbc.addValidationStatusProvider(new PackageVMValidationStatusProvider(boxNameObservable, boxFolderObservable));
    // setup validation support
    WizardPageSupport.create(this, dbc);
    scrollTop.setContent(container);
    Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrollTop.setSize(point);
    scrollTop.setMinSize(point);
    setControl(container);
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point)

Example 83 with ScrolledComposite

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

the class EnvironmentVariablesPreferencePage method createContents.

/**
 * Creates a ScrolledComposite, sets options on oit, opens string field editors for the
 * preferences.
 *
 * @param parent The parent of the ScrolledComposite object.
 *
 * @return The ScrolledComposite object that is created configured.
 */
@Override
protected Control createContents(Composite parent) {
    ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    Composite c = new Composite(sc, SWT.NONE);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setContent(c);
    envVariables = new StringFieldEditor[PreferenceConstants.P_ENV.values().length];
    int i = 0;
    for (PreferenceConstants.P_ENV env : PreferenceConstants.P_ENV.values()) {
        envVariables[i] = createStringFieldEditor(env.toPrefKey(), env.toEnvKey(), c);
        i++;
    }
    return sc;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Example 84 with ScrolledComposite

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

the class NewDockerConnectionPage method createControl.

@Override
public void createControl(final Composite parent) {
    final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollTop.setExpandVertical(true);
    scrollTop.setExpandHorizontal(true);
    final Composite container = new Composite(scrollTop, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).applyTo(container);
    createConnectionSettingsContainer(container);
    // attach the Databinding context status to this wizard page.
    WizardPageSupport.create(this, this.dbc);
    Clipboard clip = new Clipboard(Display.getCurrent());
    String content = (String) clip.getContents(TextTransfer.getInstance(), DND.SELECTION_CLIPBOARD);
    // DOCKER_HOST is the minimal property needed
    if (content != null && content.contains(DefaultDockerConnectionSettingsFinder.DOCKER_HOST)) {
        retrieveConnectionSettings(content);
    } else {
        content = (String) clip.getContents(TextTransfer.getInstance(), DND.CLIPBOARD);
        if (content != null && content.contains(DefaultDockerConnectionSettingsFinder.DOCKER_HOST)) {
            retrieveConnectionSettings(content);
        } else {
            retrieveDefaultConnectionSettings();
        }
    }
    scrollTop.setContent(container);
    Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrollTop.setSize(point);
    scrollTop.setMinSize(point);
    setControl(container);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Clipboard(org.eclipse.swt.dnd.Clipboard) Point(org.eclipse.swt.graphics.Point)

Example 85 with ScrolledComposite

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

the class ImageRunResourceVolumesVariablesPage method createControl.

@Override
public void createControl(Composite parent) {
    final ScrolledComposite scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollTop.setExpandVertical(true);
    scrollTop.setExpandHorizontal(true);
    final Composite container = new Composite(scrollTop, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).applyTo(container);
    createVolumeSettingsContainer(container);
    // createSectionSeparator(container, true);
    createEnvironmentVariablesContainer(container);
    createLabelVariablesContainer(container);
    createSectionSeparator(container, true);
    createResourceSettingsContainer(container);
    setDefaultValues();
    scrollTop.setContent(container);
    Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrollTop.setSize(point);
    scrollTop.setMinSize(point);
    // TODO: Workaround https://bugs.eclipse.org/bugs/show_bug.cgi?id=487160
    setControl(scrollTop);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Point(org.eclipse.swt.graphics.Point)

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