Search in sources :

Example 66 with SelectionAdapter

use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.

the class TableEditorManager method createCheckboxEditor.

public TableEditor createCheckboxEditor(Table table, boolean checked, TableItem item, int column, final IPropertySetter<Boolean> accessor) {
    TableEditor editor = new TableEditor(table);
    final Button button = new Button(table, SWT.CHECK);
    button.setSelection(checked);
    if (accessor != null) {
        button.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                accessor.set(button.getSelection());
            }
        });
    }
    editor.grabHorizontal = true;
    editor.setEditor(button, item, column);
    addEditor(item, column, editor);
    return editor;
}
Also used : Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(org.eclipse.swt.custom.TableEditor)

Example 67 with SelectionAdapter

use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.

the class NameSpaceDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    super.createDialogArea(parent);
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(6, true));
    //$NON-NLS-1$
    nsValueLabel = new LabelledText(composite, "Namespace", 5);
    nsValueLabel.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            nsValue = nsValueLabel.getText();
            validateField();
        }
    });
    prefixBtn = new Button(composite, SWT.CHECK | SWT.RIGHT);
    prefixBtn.setText("Prefix");
    prefixBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (prefixText != null) {
                if (prefixBtn.getSelection()) {
                    prefixText.setVisible(true);
                } else {
                    prefixText.setVisible(false);
                    prefixText.setText("");
                }
                validateField();
            }
        }
    });
    //$NON-NLS-1$
    prefixText = new Text(composite, SWT.BORDER);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.horizontalSpan = 5;
    prefixText.setLayoutData(gridData);
    prefixText.setVisible(false);
    prefixText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            prefixValue = prefixText.getText();
            validateField();
        }
    });
    if (currentNode != null) {
        nsValueLabel.setText(currentNode.getDefaultValue());
        String prefix = currentNode.getName();
        if (prefix != null && !"".equals(prefix) && !XmlMapUtil.DEFAULT_NAME_SPACE_PREFIX.equals(prefix)) {
            prefixBtn.setSelection(true);
            prefixText.setVisible(true);
            prefixText.setText(prefix);
        }
    }
    nsValue = nsValueLabel.getText();
    if (prefixText.isVisible()) {
        prefixValue = prefixText.getText();
    }
    return parent;
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) LabelledText(org.talend.commons.ui.swt.formtools.LabelledText)

Example 68 with SelectionAdapter

use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.

the class PrefixChangeDialog method createDialogArea.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createDialogArea(Composite parent) {
    super.createDialogArea(parent);
    this.getShell().setText("Root Node Prefix Changed");
    this.setTitle("Imported root Node Prefix Changed");
    this.setMessage("Imported document root node prefix changed , do you want to change output expression and keep the mapping ?");
    Composite composite = new Composite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout();
    layout.marginLeft = 20;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    label.setText("Imported document root  has  changed from: ");
    Label text1 = new Label(composite, SWT.NONE);
    text1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text1.setText(rootNodeName);
    text1.setForeground(text1.getDisplay().getSystemColor(SWT.COLOR_RED));
    Label text2 = new Label(composite, SWT.NONE);
    text2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text2.setText(" to: ");
    Label text3 = new Label(composite, SWT.NONE);
    text3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text3.setText(prefix + ":" + rootNodeName);
    text3.setForeground(text1.getDisplay().getSystemColor(SWT.COLOR_RED));
    Label text4 = new Label(composite, SWT.NONE);
    text4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text4.setText("Do you wan't to propagate " + prefix + ":" + rootNodeName + " for expression : ");
    Label text5 = new Label(composite, SWT.NONE);
    text5.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text5.setText(sourceExpression);
    text5.setForeground(text1.getDisplay().getSystemColor(SWT.COLOR_RED));
    Label text6 = new Label(composite, SWT.NONE);
    text6.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text6.setText(" to keep the mapping ? ");
    applyAllBtn = new Button(composite, SWT.CHECK);
    applyAllBtn.setText("Apply for all expressions");
    applyAllBtn.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            applyAll = applyAllBtn.getSelection();
            if (applyAll) {
                cancelAllBtn.setSelection(false);
                cancelAll = false;
            }
        }
    });
    applyAllBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    applyAllBtn.setSelection(true);
    cancelAllBtn = new Button(composite, SWT.CHECK);
    cancelAllBtn.setText("Cancel for all expressions");
    cancelAllBtn.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            cancelAll = cancelAllBtn.getSelection();
            if (cancelAll) {
                applyAllBtn.setSelection(false);
                applyAll = false;
            }
        }
    });
    cancelAllBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    return parent;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 69 with SelectionAdapter

use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.

the class VersionManagementPage method createItemTableColumns.

@Override
protected void createItemTableColumns() {
    TableColumn itemColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    itemColumn.setText(Messages.getString("VersionManagementDialog.Items"));
    itemColumn.setWidth(110);
    TableColumn oldVersionColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    oldVersionColumn.setText(Messages.getString("VersionManagementDialog.Version"));
    oldVersionColumn.setWidth(60);
    TableColumn versionColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    versionColumn.setText(Messages.getString("VersionManagementDialog.NewVersion"));
    versionColumn.setWidth(82);
    final TableColumn delColumn = new TableColumn(itemTable, SWT.CENTER);
    //$NON-NLS-1$
    delColumn.setText("");
    delColumn.setWidth(26);
    delColumn.setResizable(false);
    versionColumn.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            if (!isFixedVersion()) {
                refreshTableItems();
            }
        }
    });
    itemTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkButtonsState();
        }
    });
}
Also used : ControlAdapter(org.eclipse.swt.events.ControlAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 70 with SelectionAdapter

use of org.eclipse.swt.events.SelectionAdapter in project tdi-studio-se by Talend.

the class VersionManagementPage method addItemsOption.

protected void addItemsOption(Composite parent) {
    Group option = new Group(parent, SWT.NONE);
    option.setLayout(new GridLayout());
    //$NON-NLS-1$
    option.setText(Messages.getString("VersionManagementDialog.Options"));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(option);
    fixedVersionButton = new Button(option, SWT.RADIO);
    //$NON-NLS-1$
    fixedVersionButton.setText(Messages.getString("VersionManagementDialog.FixedVersion"));
    // default
    fixedVersionButton.setSelection(true);
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
    Composite versionComposit = new Composite(option, SWT.NONE);
    GridLayout layout = new GridLayout(8, false);
    layout.horizontalSpacing = 1;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    versionComposit.setLayout(layout);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(versionComposit);
    fixedVersionText = new Text(versionComposit, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData();
    data.widthHint = 50;
    data.minimumWidth = 50;
    fixedVersionText.setLayoutData(data);
    fixedVersionText.setEnabled(false);
    fixedVersionText.setText(VersionUtils.DEFAULT_VERSION);
    majorBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    majorBtn.setText("M");
    //$NON-NLS-1$
    majorBtn.setToolTipText(Messages.getString("VersionManagementDialog.MajorVersionTip"));
    majorBtn.setEnabled(allowVerchange);
    minorBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    minorBtn.setText("m");
    //$NON-NLS-1$
    minorBtn.setToolTipText(Messages.getString("VersionManagementDialog.MinorVersionTip"));
    minorBtn.setEnabled(allowVerchange);
    Label label = new Label(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    label.setText("");
    data = new GridData();
    data.minimumWidth = 20;
    data.widthHint = 20;
    label.setLayoutData(data);
    label.setVisible(false);
    revertBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    revertBtn.setText(Messages.getString("VersionManagementDialog.Revert"));
    //$NON-NLS-1$
    revertBtn.setToolTipText(Messages.getString("VersionManagementDialog.RevertTip"));
    Label bLabel = new Label(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    bLabel.setText("");
    data = new GridData();
    data.minimumWidth = 20;
    data.widthHint = 20;
    bLabel.setLayoutData(data);
    bLabel.setVisible(false);
    alldependcies = new Button(versionComposit, SWT.NONE);
    alldependcies.setText(Messages.getString("VersionManagementDialog.allDependencies"));
    alldependcies.setEnabled(false);
    subjobs = new Button(versionComposit, SWT.NONE);
    subjobs.setText(Messages.getString("VersionManagementDialog.subjob"));
    subjobs.setEnabled(false);
    eachVersionButton = new Button(option, SWT.RADIO);
    //$NON-NLS-1$
    eachVersionButton.setText(Messages.getString("VersionManagementDialog.EachVersion"));
    eachVersionButton.setEnabled(allowVerchange);
    versionLatest = new Button(option, SWT.CHECK);
    versionLatest.setText(Messages.getString("VersionManagementDialog.FixVersion"));
    versionLatest.setToolTipText(Messages.getString("VersionManagementDialog.FixLastVersion"));
    // event
    fixedVersionButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFixedButtons();
            researchMaxVersion();
            refreshTableItems();
        }
    });
    alldependcies.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectAllDependencies();
        }
    });
    subjobs.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectSubjob();
        }
    });
    versionLatest.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            versionLatest();
        }
    });
    majorBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String version = fixedVersionText.getText();
            version = VersionUtils.upMajor(version);
            fixedVersionText.setText(version);
            refreshTableItems();
        }
    });
    minorBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String version = fixedVersionText.getText();
            version = VersionUtils.upMinor(version);
            fixedVersionText.setText(version);
            refreshTableItems();
        }
    });
    revertBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // set min version
            fixedVersionText.setText(VersionUtils.DEFAULT_VERSION);
            researchMaxVersion();
            refreshTableItems();
        }
    });
    eachVersionButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFixedButtons();
            refreshTableItems();
        }
    });
    checkFixedButtons();
}
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) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3041 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3036 GridData (org.eclipse.swt.layout.GridData)1608 Button (org.eclipse.swt.widgets.Button)1600 Composite (org.eclipse.swt.widgets.Composite)1220 Label (org.eclipse.swt.widgets.Label)1106 GridLayout (org.eclipse.swt.layout.GridLayout)1095 Text (org.eclipse.swt.widgets.Text)773 ModifyListener (org.eclipse.swt.events.ModifyListener)638 ModifyEvent (org.eclipse.swt.events.ModifyEvent)630 Group (org.eclipse.swt.widgets.Group)459 FormAttachment (org.eclipse.swt.layout.FormAttachment)428 FormData (org.eclipse.swt.layout.FormData)428 Shell (org.eclipse.swt.widgets.Shell)407 FormLayout (org.eclipse.swt.layout.FormLayout)406 Event (org.eclipse.swt.widgets.Event)384 Listener (org.eclipse.swt.widgets.Listener)378 Display (org.eclipse.swt.widgets.Display)353 ShellEvent (org.eclipse.swt.events.ShellEvent)323 ShellAdapter (org.eclipse.swt.events.ShellAdapter)321