Search in sources :

Example 86 with SelectionAdapter

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

the class NameAndLabelsDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite comp = new Composite(composite, SWT.NONE);
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));
    comp.setLayout(new GridLayout());
    selectionComposite = new ElementsSelectionComposite<NamedThing>(comp) {

        @Override
        protected IBaseLabelProvider getLabelProvider() {
            return new LabelProvider() {

                @Override
                public String getText(Object obj) {
                    NamedThing nal = (NamedThing) obj;
                    return nal.getDisplayName();
                }

                @Override
                public Image getImage(Object obj) {
                    return null;
                }
            };
        }

        ;
    }.setMultipleSelection(false).create();
    selectionComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    selectionComposite.setViewerData(nameAndLabels);
    Composite customComposite = new Composite(comp, SWT.NONE);
    customComposite.setLayout(new GridLayout());
    customComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Button useCustomBtn = new Button(customComposite, SWT.CHECK);
    //$NON-NLS-1$
    useCustomBtn.setText(Messages.getString("NameAndLabelsDialog.custom.button"));
    useCustomBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateFieldsStatus(useCustomBtn.getSelection());
        }
    });
    //$NON-NLS-1$
    customObjNameText = new LabelledText(customComposite, Messages.getString("NameAndLabelsDialog.custom.text"));
    updateFieldsStatus(useCustomBtn.getSelection());
    if (!isInWizard) {
        // set empty quotes to show the user he should fill the name between quotes
        //$NON-NLS-1$
        customObjNameText.setText("\"\"");
    }
    return composite;
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) ElementsSelectionComposite(org.talend.core.ui.composite.ElementsSelectionComposite) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) NamedThing(org.talend.daikon.NamedThing) Image(org.eclipse.swt.graphics.Image) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) IBaseLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IBaseLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider)

Example 87 with SelectionAdapter

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

the class ButtonController method createControl.

@Override
public Control createControl(Composite subComposite, IElementParameter param, int numInRow, int nbInRow, int top, Control lastControl) {
    //$NON-NLS-1$
    Button theBtn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
    theBtn.setBackground(subComposite.getBackground());
    if (param.getDisplayName().equals("")) {
        //$NON-NLS-1$
        theBtn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    } else {
        theBtn.setText(param.getDisplayName());
    }
    FormData data = new FormData();
    if (isInWizard()) {
        if (lastControl != null) {
            data.right = new FormAttachment(lastControl, 0);
        } else {
            data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
        }
    } else {
        if (lastControl != null) {
            data.left = new FormAttachment(lastControl, 0);
        } else {
            data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
        }
    }
    data.top = new FormAttachment(0, top);
    theBtn.setLayoutData(data);
    theBtn.setEnabled(!param.isReadOnly());
    theBtn.setData(param);
    hashCurControls.put(param.getName(), theBtn);
    theBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Command cmd = createCommand((Button) e.getSource());
            executeCommand(cmd);
        }
    });
    Point initialSize = theBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    dynamicProperty.setCurRowSize(initialSize.y + ITabbedPropertyConstants.VSPACE);
    return theBtn;
}
Also used : FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) Command(org.eclipse.gef.commands.Command) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 88 with SelectionAdapter

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

the class PerformancePreferencePage method addSVNInforAutoCheckFiled.

private void addSVNInforAutoCheckFiled() {
    if (PluginChecker.isSVNProviderPluginLoaded()) {
        final CheckBoxFieldEditor autoCheckField = new CheckBoxFieldEditor(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK, Messages.getString("PerformancePreferencePage.autoCheckField"), //$NON-NLS-1$
        getFieldEditorParent());
        addField(autoCheckField);
        final IntegerFieldEditor autoCheckTime = new IntegerFieldEditor(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL, //$NON-NLS-1$
        Messages.getString("PerformancePreferencePage.autoCheckTime"), getFieldEditorParent());
        autoCheckTime.setValidRange(1, 30);
        autoCheckTime.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK), getFieldEditorParent());
        addField(autoCheckTime);
        autoCheckField.getButton().addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                if (autoCheckField.getButton().getSelection()) {
                    autoCheckTime.setEnabled(true, getFieldEditorParent());
                } else {
                    autoCheckTime.setEnabled(false, getFieldEditorParent());
                }
            }
        });
        final CheckBoxFieldEditor autoRefreshLocksField = new CheckBoxFieldEditor(ITalendCorePrefConstants.AUTO_REFRESH_LOCKS, Messages.getString("PerformancePreferencePage.autoRefreshLocksField"), //$NON-NLS-1$
        getFieldEditorParent());
        addField(autoRefreshLocksField);
        final IntegerFieldEditor tacConnectionTimeout = new IntegerFieldEditor(ITalendCorePrefConstants.PERFORMANCE_TAC_CONNECTION_TIMEOUT, //$NON-NLS-1$
        Messages.getString("PerformancePreferencePage.tacTimeout"), getFieldEditorParent());
        autoCheckTime.setValidRange(0, 3600);
        addField(tacConnectionTimeout);
    }
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) CheckBoxFieldEditor(org.talend.commons.ui.swt.preferences.CheckBoxFieldEditor)

Example 89 with SelectionAdapter

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

the class DownloadCheckUpdatesDialog method createDialogArea.

/**
     * Create contents of the dialog.
     * 
     * @param parent
     */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    GridData gd_composite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_composite.heightHint = 188;
    gd_composite.widthHint = 423;
    composite.setLayoutData(gd_composite);
    Label lblNewLabel = new Label(composite, SWT.NONE);
    GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblNewLabel.heightHint = 92;
    gd_lblNewLabel.widthHint = 406;
    lblNewLabel.setLayoutData(gd_lblNewLabel);
    lblNewLabel.setText("\nThere are newer versions of some items you have downloaded\nfrom the Talend Exchange.");
    Label lblNewLabel_1 = new Label(composite, SWT.NONE);
    lblNewLabel_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    lblNewLabel_1.setText("Total available updates : ");
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    Button btnCheckButton = new Button(composite, SWT.CHECK);
    btnCheckButton.setText("Don't ask again ");
    new Label(composite, SWT.NONE);
    btnCheckButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
            prefStore.setValue(ITalendCorePrefConstants.EXCHANGE_DOWNLOADED_CHECK_UPDATES, true);
            cancelPressed();
        }
    });
    return container;
}
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) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 90 with SelectionAdapter

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

the class ImportCompatibleEcoComponentsComposite method creatOptions.

/**
     * 
     * There will create three radio button.
     */
private void creatOptions(Composite exchangeDialogCom) {
    Group group = new Group(exchangeDialogCom, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 5;
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = 5;
    group.setLayout(layout);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Category
    creatCategory(group);
    category = categoryCombo.getText();
    // Tos Version
    creatTosVersionFilter(group, true);
    version = versionCombo.getText();
    // Refresh
    Button refresh = new Button(group, SWT.PUSH);
    refresh.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
    //$NON-NLS-1$
    refresh.setToolTipText(Messages.getString("ImportExchangeDialog.REFRESH_BUTTON"));
    refresh.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            //$NON-NLS-1$
            progressBarMessage = Messages.getString("ImportExchangeDialog.REFRESHING_PROGRESSBAR");
            findChoiceExchange();
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

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