Search in sources :

Example 16 with Spinner

use of org.eclipse.swt.widgets.Spinner in project cubrid-manager by CUBRID.

the class ExportQueryResultDialog method createComposite.

/**
	 * Create the composite
	 *
	 * @param parent Composite
	 */
private void createComposite(Composite parent) {
    final boolean isOneResult = queryExecuterList.size() == 1;
    String tableName = null;
    try {
        tableName = UIQueryUtil.getTableNameFromQuery(queryExecuterList.get(0).getConnection().checkAndConnectQuietly(), queryExecuterList.get(0).getOrignQuery());
    } finally {
        if (queryExecuterList.get(0).getConnection().isAutoClosable()) {
            queryExecuterList.get(0).getConnection().close();
        }
    }
    boolean isTable = isOneResult && !StringUtil.isEmpty(tableName);
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    // where to export group
    Group whereOptionGroup = new Group(composite, SWT.None);
    whereOptionGroup.setText(Messages.grpWhereExport);
    whereOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    whereOptionGroup.setLayout(new GridLayout(2, false));
    Label fileTypeLabel = new Label(whereOptionGroup, SWT.None);
    fileTypeLabel.setText(Messages.lblFileType);
    fileTypeLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    Composite fileTypeComposite = new Composite(whereOptionGroup, SWT.None);
    fileTypeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    int layoutCount = 0;
    if (isTable) {
        sqlButton = new Button(fileTypeComposite, SWT.RADIO);
        sqlButton.setText("SQL");
        sqlButton.setLayoutData(CommonUITool.createGridData(1, 1, 50, -1));
        sqlButton.setSelection(true);
        sqlButton.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                widgetDefaultSelected(e);
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                useFirstAsColumnBtn.setEnabled(false);
                setNullWidgetStatus(false);
                setDelimiterWidgetStatus(false);
                fileCharsetCombo.setText(DEFAULT_FILE_CHARSET);
                changeFileSuffix();
                verify();
            }
        });
        layoutCount++;
    }
    csvButton = new Button(fileTypeComposite, SWT.RADIO);
    csvButton.setText("CSV");
    csvButton.setSelection(isTable ? false : true);
    csvButton.setLayoutData(CommonUITool.createGridData(1, 1, 50, -1));
    csvButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            useFirstAsColumnBtn.setEnabled(true);
            setNullWidgetStatus(true);
            setDelimiterWidgetStatus(false);
            fileCharsetCombo.setText(DEFAULT_FILE_CHARSET);
            changeFileSuffix();
            verify();
        }
    });
    layoutCount++;
    xlsButton = new Button(fileTypeComposite, SWT.RADIO);
    xlsButton.setText("XLS");
    xlsButton.setLayoutData(CommonUITool.createGridData(1, 1, 50, -1));
    xlsButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            useFirstAsColumnBtn.setEnabled(true);
            setNullWidgetStatus(true);
            setDelimiterWidgetStatus(false);
            String charset = StringUtil.getDefaultCharset();
            if (charset != null) {
                fileCharsetCombo.setText(charset);
            }
            changeFileSuffix();
            verify();
        }
    });
    layoutCount++;
    xlsxButton = new Button(fileTypeComposite, SWT.RADIO);
    xlsxButton.setText("XLSX");
    xlsxButton.setLayoutData(CommonUITool.createGridData(1, 1, 57, -1));
    xlsxButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            useFirstAsColumnBtn.setEnabled(true);
            setNullWidgetStatus(true);
            setDelimiterWidgetStatus(false);
            fileCharsetCombo.setText(DEFAULT_FILE_CHARSET);
            changeFileSuffix();
            verify();
        }
    });
    layoutCount++;
    txtButton = new Button(fileTypeComposite, SWT.RADIO);
    txtButton.setText("TXT");
    txtButton.setLayoutData(CommonUITool.createGridData(1, 1, 50, -1));
    txtButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            useFirstAsColumnBtn.setEnabled(true);
            setNullWidgetStatus(true);
            setDelimiterWidgetStatus(true);
            fileCharsetCombo.setText(DEFAULT_FILE_CHARSET);
            changeFileSuffix();
            verify();
        }
    });
    layoutCount++;
    fileTypeComposite.setLayout(new GridLayout(layoutCount, false));
    Label pathLabel = new Label(whereOptionGroup, SWT.None);
    pathLabel.setText(Messages.lblFilePath);
    pathLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    Composite fileComposite = new Composite(whereOptionGroup, SWT.None);
    fileComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    fileComposite.setLayout(new GridLayout(2, false));
    filePathText = new Text(fileComposite, SWT.BORDER);
    filePathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    Button browseButton = new Button(fileComposite, SWT.None);
    browseButton.setText(Messages.btnBrowse);
    browseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            File file = FileDialogUtils.getDataExportedFile(getShell(), new String[] { "*.*" }, new String[] { "*.*" }, null);
            if (file == null) {
                return;
            }
            filePathText.setText(file.getAbsolutePath() + getFileExtName(getFileType()));
            verify();
        }
    });
    Group parsingGroup = new Group(composite, SWT.None);
    parsingGroup.setText(Messages.grpParsingOption);
    parsingGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    parsingGroup.setLayout(new GridLayout(4, false));
    Label threadCountLabel = new Label(parsingGroup, SWT.None);
    threadCountLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, 100, -1));
    threadCountLabel.setText(Messages.lblThreadCount);
    threadCountSpinner = new Spinner(parsingGroup, SWT.BORDER | SWT.LEFT);
    threadCountSpinner.setValues(queryExecuterList.size(), 1, queryExecuterList.size(), 0, 1, 1);
    threadCountSpinner.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, 100, -1));
    exportFromCacheBtn = new Button(parsingGroup, SWT.CHECK);
    {
        exportFromCacheBtn.setText(Messages.lblExportFromCache);
        exportFromCacheBtn.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 2, 1, -1, -1));
        exportFromCacheBtn.setSelection(false);
        exportFromCacheBtn.setToolTipText(Messages.tipExportFromCache);
    }
    Label dbCharsetLabel = new Label(parsingGroup, SWT.None);
    dbCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, 110, -1));
    dbCharsetLabel.setText(Messages.lblJDBCCharset);
    dbCharsetCombo = new Combo(parsingGroup, SWT.BORDER);
    dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 100, 21));
    String dbCharset = database.getDatabaseInfo().getCharSet();
    dbCharsetCombo.setItems(QueryOptions.getAllCharset(null));
    if (dbCharset != null && dbCharset.length() > 0) {
        dbCharsetCombo.setText(dbCharset);
    }
    dbCharsetCombo.setEnabled(false);
    Label fileCharsetLabel = new Label(parsingGroup, SWT.None);
    fileCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    fileCharsetLabel.setText(Messages.lblFileCharset);
    fileCharsetCombo = new Combo(parsingGroup, SWT.BORDER);
    fileCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 100, 21));
    fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
    fileCharsetCombo.setText(DEFAULT_FILE_CHARSET);
    fileCharsetCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            verify();
        }
    });
    Group dataOptionGroup = new Group(composite, SWT.None);
    dataOptionGroup.setText(Messages.grpDataOptions);
    dataOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    dataOptionGroup.setLayout(new GridLayout(2, false));
    useFirstAsColumnBtn = new Button(dataOptionGroup, SWT.CHECK);
    {
        useFirstAsColumnBtn.setText(Messages.btnFirstLineAsCol);
        GridData gridData = new GridData();
        gridData.widthHint = 400;
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalIndent = 0;
        gridData.horizontalSpan = 2;
        useFirstAsColumnBtn.setLayoutData(gridData);
        useFirstAsColumnBtn.setSelection(true);
    }
    Group delimiterOptionGroup = new Group(dataOptionGroup, SWT.None);
    delimiterOptionGroup.setText(Messages.grpDelimiter);
    delimiterOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    delimiterOptionGroup.setLayout(new GridLayout(2, false));
    Label rowLabel = new Label(delimiterOptionGroup, SWT.None);
    rowLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    rowLabel.setText(Messages.lblRow);
    rowDelimiterCombo = new Combo(delimiterOptionGroup, SWT.BORDER);
    rowDelimiterCombo.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    rowDelimiterCombo.setTextLimit(32);
    rowDelimiterCombo.setItems(rowDelimeterName);
    rowDelimiterCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            verify();
        }
    });
    Label columnLabel = new Label(delimiterOptionGroup, SWT.None);
    columnLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    columnLabel.setText(Messages.lblCol);
    columnDelimiterCombo = new Combo(delimiterOptionGroup, SWT.BORDER);
    columnDelimiterCombo.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    columnDelimiterCombo.setTextLimit(32);
    columnDelimiterCombo.setItems(columnDelimeterName);
    columnDelimiterCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            verify();
        }
    });
    Group nullValueGroup = new Group(dataOptionGroup, SWT.None);
    nullValueGroup.setText(Messages.grpNullOption);
    nullValueGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    nullValueGroup.setLayout(new GridLayout(3, false));
    nullOneButton = new Button(nullValueGroup, SWT.RADIO);
    nullOneButton.setText(NULL_VALUES[0]);
    nullOneButton.setLayoutData(CommonUITool.createGridData(1, 1, 70, -1));
    nullOneButton.setSelection(true);
    nullTwoButton = new Button(nullValueGroup, SWT.RADIO);
    nullTwoButton.setText(NULL_VALUES[1]);
    nullTwoButton.setLayoutData(CommonUITool.createGridData(2, 1, 70, -1));
    nullThreeButton = new Button(nullValueGroup, SWT.RADIO);
    nullThreeButton.setText(NULL_VALUES[2]);
    nullThreeButton.setLayoutData(CommonUITool.createGridData(1, 1, 70, -1));
    otherButton = new Button(nullValueGroup, SWT.RADIO);
    otherButton.setText(Messages.btnOther);
    otherButton.setLayoutData(CommonUITool.createGridData(1, 1, 70, -1));
    otherButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            verify();
        }
    });
    otherText = new Text(nullValueGroup, SWT.BORDER);
    otherText.setLayoutData(CommonUITool.createGridData(1, 1, 60, 14));
    otherText.setTextLimit(64);
    otherText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            verify();
        }
    });
    if (sqlButton != null && sqlButton.getSelection()) {
        useFirstAsColumnBtn.setEnabled(false);
        setDelimiterWidgetStatus(false);
        setNullWidgetStatus(false);
    } else {
        useFirstAsColumnBtn.setEnabled(true);
        setDelimiterWidgetStatus(false);
        setNullWidgetStatus(true);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) File(java.io.File) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 17 with Spinner

use of org.eclipse.swt.widgets.Spinner in project dbeaver by serge-rider.

the class DatabaseConsumerPageLoadSettings method createControl.

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    composite.setLayout(gl);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final DatabaseConsumerSettings settings = getWizard().getPageSettings(this, DatabaseConsumerSettings.class);
    {
        Group performanceSettings = UIUtils.createControlGroup(composite, "Performance", 4, GridData.FILL_HORIZONTAL, 0);
        final Button newConnectionCheckbox = UIUtils.createLabelCheckbox(performanceSettings, CoreMessages.data_transfer_wizard_output_checkbox_new_connection, settings.isOpenNewConnections());
        newConnectionCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setOpenNewConnections(newConnectionCheckbox.getSelection());
            }
        });
        newConnectionCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
        final Button useTransactionsCheck = UIUtils.createLabelCheckbox(performanceSettings, "Use transactions", settings.isUseTransactions());
        useTransactionsCheck.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setUseTransactions(useTransactionsCheck.getSelection());
            }
        });
        useTransactionsCheck.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
        final Spinner commitAfterEdit = UIUtils.createLabelSpinner(performanceSettings, "Commit after insert of ", settings.getCommitAfterRows(), 1, Integer.MAX_VALUE);
        commitAfterEdit.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setCommitAfterRows(commitAfterEdit.getSelection());
            }
        });
        commitAfterEdit.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
    }
    {
        Group generalSettings = UIUtils.createControlGroup(composite, "General", 4, GridData.FILL_HORIZONTAL, 0);
        final Button showTableCheckbox = UIUtils.createLabelCheckbox(generalSettings, "Open table editor on finish", settings.isOpenTableOnFinish());
        showTableCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                settings.setOpenTableOnFinish(showTableCheckbox.getSelection());
            }
        });
        showTableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
    }
    setControl(composite);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 18 with Spinner

use of org.eclipse.swt.widgets.Spinner in project eclipse.platform.text by eclipse.

the class TextEditorDefaultsPreferencePage method addSpinner.

/**
 * Adds a spinner for the given preference and domain. Assumes that the
 * <code>EnumeratedDomain</code> contains only numeric values in a
 * continuous range, no custom entries (use <code>addCombo</code> in that
 * case).
 *
 * @param composite the parent composite
 * @param preference the preference
 * @param domain its domain
 * @param indentation the indentation
 * @return the created controls, a <code>Label</code> and a
 *         <code>Spinner</code> control
 */
Control[] addSpinner(Composite composite, final Preference preference, final EnumeratedDomain domain, int indentation) {
    Label labelControl = new Label(composite, SWT.NONE);
    labelControl.setText(preference.getName());
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.horizontalIndent = indentation;
    labelControl.setLayoutData(gd);
    final Spinner spinner = new Spinner(composite, SWT.READ_ONLY | SWT.BORDER);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    spinner.setLayoutData(gd);
    spinner.setToolTipText(preference.getDescription());
    spinner.setMinimum(domain.getMinimumValue().getIntValue());
    spinner.setMaximum(domain.getMaximumValue().getIntValue());
    spinner.setIncrement(1);
    spinner.setPageIncrement(4);
    spinner.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            int index = spinner.getSelection();
            EnumValue value = domain.getValueByInteger(index);
            IStatus status = domain.validate(value);
            if (!status.matches(IStatus.ERROR))
                fOverlayStore.setValue(preference.getKey(), value.getIntValue());
            updateStatus(status);
        }
    });
    fInitializers.add(fInitializerFactory.create(preference, spinner, domain));
    return new Control[] { labelControl, spinner };
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Control(org.eclipse.swt.widgets.Control) Spinner(org.eclipse.swt.widgets.Spinner) EnumValue(org.eclipse.ui.internal.editors.text.TextEditorDefaultsPreferencePage.EnumeratedDomain.EnumValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 19 with Spinner

use of org.eclipse.swt.widgets.Spinner in project linuxtools by eclipse.

the class OprofileSetupTab method createControl.

@Override
public void createControl(Composite parent) {
    options = new LaunchOptions();
    Composite top = new Composite(parent, SWT.NONE);
    setControl(top);
    top.setLayout(new GridLayout());
    GridData data;
    GridLayout layout;
    createVerticalSpacer(top, 1);
    // Create container for kernel image file selection
    Composite p = new Composite(top, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    p.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    p.setLayoutData(data);
    Label l2 = new Label(p, SWT.NONE);
    // $NON-NLS-1$
    l2.setText(OprofileLaunchMessages.getString("tab.global.select"));
    data = new GridData();
    data.horizontalSpan = 2;
    l2.setLayoutData(data);
    controlCombo = new CCombo(p, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    List<String> tools = new ArrayList<>(Arrays.asList(OprofileProject.OPERF_BINARY));
    /*
         * Check if tools are installed. Use whichComand() method from
         * RuntimeProcessFactory as it considers the LinuxTools Path.
         */
    IProject project = getOprofileProject();
    try {
        String toolPath = RuntimeProcessFactory.getFactory().whichCommand(OprofileProject.OCOUNT_BINARY, project);
        // Command found
        if (!toolPath.equals(OprofileProject.OCOUNT_BINARY)) {
            tools.add(OprofileProject.OCOUNT_BINARY);
        }
    } catch (Exception e) {
    }
    controlCombo.setItems(tools.toArray(new String[0]));
    controlCombo.select(0);
    controlCombo.addModifyListener(mev -> {
        OprofileProject.setProfilingBinary(controlCombo.getText());
        options.setOprofileComboText(controlCombo.getText());
        enableOptionWidgets();
        updateLaunchConfigurationDialog();
    });
    data = new GridData();
    data.horizontalSpan = 2;
    controlCombo.setLayoutData(data);
    kernelLabel = new Label(p, SWT.NONE);
    // $NON-NLS-1$
    kernelLabel.setText(OprofileLaunchMessages.getString("tab.global.kernelImage.label.text"));
    kernelLabel.setEnabled(false);
    data = new GridData();
    data.horizontalSpan = 2;
    kernelLabel.setLayoutData(data);
    kernelImageFileText = new Text(p, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    kernelImageFileText.setLayoutData(data);
    kernelImageFileText.addModifyListener(mev -> handleKernelImageFileTextModify(kernelImageFileText));
    // $NON-NLS-1$
    Button button = createPushButton(p, OprofileLaunchMessages.getString("tab.global.kernelImage.browse.button.text"), null);
    final Shell shell = top.getShell();
    button.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> showFileDialog(shell)));
    createVerticalSpacer(top, 1);
    // Create checkbox options container
    p = new Composite(top, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    p.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    p.setLayoutData(data);
    // $NON-NLS-1$
    checkSeparateLibrary = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateLibrary.text"));
    // $NON-NLS-1$
    checkSeparateKernel = myCreateCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateKernel.text"));
    // Number of executions spinner
    Composite executionsComposite = new Composite(top, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    executionsComposite.setLayout(gridLayout);
    executionsSpinnerLabel = new Label(executionsComposite, SWT.LEFT);
    // $NON-NLS-1$
    executionsSpinnerLabel.setText(OprofileLaunchMessages.getString("tab.global.executionsNumber.label.text"));
    // $NON-NLS-1$
    executionsSpinnerLabel.setToolTipText(OprofileLaunchMessages.getString("tab.global.executionsNumber.label.tooltip"));
    executionsSpinner = new Spinner(executionsComposite, SWT.BORDER);
    executionsSpinner.setMinimum(1);
    executionsSpinner.addModifyListener(e -> {
        options.setExecutionsNumber(executionsSpinner.getSelection());
        updateLaunchConfigurationDialog();
    });
}
Also used : Arrays(java.util.Arrays) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) Oprofile(org.eclipse.linuxtools.internal.oprofile.core.Oprofile) Spinner(org.eclipse.swt.widgets.Spinner) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IProject(org.eclipse.core.resources.IProject) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) OprofileLaunchPlugin(org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchPlugin) RemoteProxyManager(org.eclipse.linuxtools.profiling.launch.RemoteProxyManager) GridData(org.eclipse.swt.layout.GridData) IFileStore(org.eclipse.core.filesystem.IFileStore) CCombo(org.eclipse.swt.custom.CCombo) Text(org.eclipse.swt.widgets.Text) Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) FileDialog(org.eclipse.swt.widgets.FileDialog) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) List(java.util.List) OprofileDaemonOptions(org.eclipse.linuxtools.internal.oprofile.core.daemon.OprofileDaemonOptions) ICDTLaunchConfigurationConstants(org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants) IRemoteFileProxy(org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy) OprofileLaunchMessages(org.eclipse.linuxtools.internal.oprofile.launch.OprofileLaunchMessages) SWT(org.eclipse.swt.SWT) MessageBox(org.eclipse.swt.widgets.MessageBox) OprofileProject(org.eclipse.linuxtools.internal.oprofile.core.Oprofile.OprofileProject) RuntimeProcessFactory(org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) GridLayout(org.eclipse.swt.layout.GridLayout) Shell(org.eclipse.swt.widgets.Shell) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 20 with Spinner

use of org.eclipse.swt.widgets.Spinner in project linuxtools by eclipse.

the class HelgrindToolPage method createControl.

@Override
public void createControl(Composite parent) {
    Composite top = new Composite(parent, SWT.NONE);
    GridLayout helgrindLayout = new GridLayout(2, true);
    top.setLayout(helgrindLayout);
    top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    lockordersButton = new Button(top, SWT.CHECK);
    lockordersButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // $NON-NLS-1$
    lockordersButton.setText(Messages.getString("HelgrindToolPage.track_lockorders"));
    lockordersButton.addSelectionListener(selectListener);
    Composite historyTop = new Composite(top, SWT.NONE);
    historyTop.setLayout(new GridLayout(2, false));
    historyTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label historyLabel = new Label(historyTop, SWT.NONE);
    // $NON-NLS-1$
    historyLabel.setText(Messages.getString("HelgrindToolPage.history_level"));
    historyCombo = new Combo(historyTop, SWT.READ_ONLY);
    String[] historyOpts = { HelgrindLaunchConstants.HISTORY_FULL, HelgrindLaunchConstants.HISTORY_APPROX, HelgrindLaunchConstants.HISTORY_NONE };
    historyCombo.setItems(historyOpts);
    historyCombo.addSelectionListener(selectListener);
    Composite conflictCacheSizeTop = new Composite(top, SWT.NONE);
    conflictCacheSizeTop.setLayout(new GridLayout(2, false));
    conflictCacheSizeTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label cacheSizeLabel = new Label(conflictCacheSizeTop, SWT.NONE);
    // $NON-NLS-1$
    cacheSizeLabel.setText(Messages.getString("HelgrindToolPage.cache_size"));
    cacheSizeSpinner = new Spinner(conflictCacheSizeTop, SWT.BORDER);
    cacheSizeSpinner.setMaximum(Integer.MAX_VALUE);
    cacheSizeSpinner.addModifyListener(modifyListener);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo)

Aggregations

Spinner (org.eclipse.swt.widgets.Spinner)70 GridLayout (org.eclipse.swt.layout.GridLayout)54 Label (org.eclipse.swt.widgets.Label)54 Button (org.eclipse.swt.widgets.Button)53 Composite (org.eclipse.swt.widgets.Composite)52 GridData (org.eclipse.swt.layout.GridData)51 Group (org.eclipse.swt.widgets.Group)32 SelectionEvent (org.eclipse.swt.events.SelectionEvent)25 Text (org.eclipse.swt.widgets.Text)24 Combo (org.eclipse.swt.widgets.Combo)20 SelectionListener (org.eclipse.swt.events.SelectionListener)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)18 SWT (org.eclipse.swt.SWT)16 ModifyListener (org.eclipse.swt.events.ModifyListener)14 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11 Point (org.eclipse.swt.graphics.Point)11 Control (org.eclipse.swt.widgets.Control)10 CoreException (org.eclipse.core.runtime.CoreException)6 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)6 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)6