Search in sources :

Example 76 with SelectionAdapter

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

the class ChooseJobletDialog method addListeners.

private void addListeners() {
    jobletBut.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            addJoblet = jobletBut.getSelection();
        }
    });
    jobBut.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            addJoblet = !jobBut.getSelection();
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 77 with SelectionAdapter

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

the class HadoopJarSetupController method createControl.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#createControl
     * (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter, int, int, int,
     * org.eclipse.swt.widgets.Control)
     */
@Override
public Control createControl(Composite subComposite, final IElementParameter param, int numInRow, int nbInRow, int top, Control lastControl) {
    final Composite container = subComposite;
    //$NON-NLS-1$
    Button subButton = getWidgetFactory().createButton(container, "", SWT.PUSH);
    subButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            initHadoopVersionType();
            boolean readonly = false;
            String readOnlyIfString = param.getReadOnlyIf();
            if (StringUtils.isNotEmpty(readOnlyIfString)) {
                if (param.isReadOnly(elem.getElementParameters())) {
                    readonly = true;
                }
            }
            // if readonly is true, then needn't to do this check, since it's aim is check readonly also
            if (readonly == false) {
                IElementParameter propertyParameter = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
                if (propertyParameter != null) {
                    if (EmfComponent.REPOSITORY.equals(propertyParameter.getValue())) {
                        readonly = true;
                    }
                }
            }
            HadoopCustomVersionDefineDialog customVersionDialog = new HadoopCustomVersionDefineDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), getCustomVersionMap()) {

                @Override
                protected ECustomVersionType[] getDisplayTypes() {
                    return new ECustomVersionType[] { versionType };
                }
            };
            IElementParameter sparkLocalParam = elem.getElementParameter(HadoopConstants.SPARK_LOCAL_MODE);
            IElementParameter sparkParam = elem.getElementParameter(HadoopConstants.SPARK_MODE);
            boolean isSparkLocalMode = false;
            if (sparkLocalParam != null) {
                isSparkLocalMode = (Boolean) sparkLocalParam.getValue();
            }
            if (sparkParam != null) {
                String sparkMode = null;
                if (isSparkLocalMode) {
                    //$NON-NLS-1$
                    sparkMode = "LOCAL";
                } else {
                    //$NON-NLS-1$
                    sparkMode = "" + sparkParam.getValue();
                }
                customVersionDialog.setSparkMode(sparkMode);
                customVersionDialog.setSparkStreamingMode(sparkMode);
            }
            customVersionDialog.setReadonly(readonly);
            Set<String> oldLibList = customVersionDialog.getLibList(versionType.getGroup());
            if (customVersionDialog.open() == Window.OK) {
                Set<String> newLibList = customVersionDialog.getLibList(versionType.getGroup());
                if (oldLibList != null && newLibList != null && oldLibList.size() == newLibList.size() && oldLibList.containsAll(newLibList)) {
                // means nothing changes, so nothing need to do
                } else {
                    // changed
                    String customJars = customVersionDialog.getLibListStr(versionType.getGroup());
                    executeCommand(new PropertyChangeCommand(elem, EParameterName.HADOOP_CUSTOM_JARS.getName(), StringUtils.trimToEmpty(customJars)));
                }
            }
        }
    });
    subButton.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    FormData data = new FormData();
    data.left = new FormAttachment(lastControl, 0);
    data.right = new FormAttachment(lastControl, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
    data.top = new FormAttachment(0, top);
    data.height = STANDARD_HEIGHT - 2;
    subButton.setLayoutData(data);
    return container;
}
Also used : FormData(org.eclipse.swt.layout.FormData) HashSet(java.util.HashSet) Set(java.util.Set) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) HadoopCustomVersionDefineDialog(org.talend.core.hadoop.version.custom.HadoopCustomVersionDefineDialog) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IElementParameter(org.talend.core.model.process.IElementParameter) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 78 with SelectionAdapter

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

the class DataMapTableView method addListeners.

/**
     * DOC amaumont Comment method "addListeners".
     */
protected void addListeners() {
    final UIManager uiManager = mapperManager.getUiManager();
    MouseTrackListener mouseTracker = new MouseTrackListener() {

        @Override
        public void mouseEnter(MouseEvent e) {
        }

        @Override
        public void mouseExit(MouseEvent e) {
            setDefaultCursor();
            resizeHelper.stopDrag();
        }

        @Override
        public void mouseHover(MouseEvent e) {
        }
    };
    this.addMouseTrackListener(mouseTracker);
    SelectionListener scrollListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            uiManager.refreshBackground(true, false);
        }
    };
    tableForEntries.getVerticalBar().addSelectionListener(scrollListener);
    // /////////////////////////////////////////////////////////////////
    addManualTableResizeListeners(uiManager);
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    Listener onSelectDataMapTableViewListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.MouseDown:
                    onSelectDataMapTableView();
                    break;
                default:
            }
        }
    };
    this.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    headerComposite.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    nameLabel.addListener(SWT.MouseDown, onSelectDataMapTableViewListener);
    // /////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////
    minimizeButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // TODO Auto-generated method stub
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            minimizeTable(!abstractDataMapTable.isMinimized());
        }
    });
    // /////////////////////////////////////////////////////////////////
    initShowMessageErrorListener(tableForEntries);
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionListener(org.eclipse.swt.events.SelectionListener) ControlListener(org.eclipse.swt.events.ControlListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) DisposeListener(org.eclipse.swt.events.DisposeListener) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) MouseListener(org.eclipse.swt.events.MouseListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) FocusListener(org.eclipse.swt.events.FocusListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) KeyListener(org.eclipse.swt.events.KeyListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) UIManager(org.talend.designer.dbmap.managers.UIManager) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener)

Example 79 with SelectionAdapter

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

the class TabFolderEditors method createPreview.

/**
     * qzhang Comment method "createPreview".
     * 
     * @return
     */
private void createPreview(final Composite parent, final int width, int height) {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    // gridLayout.marginBottom = 0;
    // gridLayout.marginLeft = 0;
    // gridLayout.marginRight = 0;
    // gridLayout.marginTop = 0;
    // gridLayout.verticalSpacing = 0;
    gridLayout.marginHeight = 2;
    gridLayout.marginWidth = 2;
    parent.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    Composite previewHeader = new Composite(parent, SWT.NONE);
    height = height - HEIGHT_BUTTON_PIXEL - 15;
    previewHeader.setLayout(gridLayout);
    previewHeader.setLayoutData(gridData);
    // row number text.
    Composite header = new Composite(previewHeader, SWT.NONE);
    GridLayout fill = new GridLayout();
    fill.numColumns = 3;
    fill.marginBottom = 0;
    fill.marginHeight = 0;
    fill.marginLeft = 0;
    fill.marginRight = 0;
    fill.marginTop = 0;
    fill.marginWidth = 0;
    header.setLayout(fill);
    rowText = new Text(header, SWT.BORDER);
    // String number = component.getNumber();
    // if (number == null || "".equals(number)) {
    // number = "10";
    // }
    //$NON-NLS-1$
    rowText.setText("10");
    GridDataFactory.swtDefaults().hint(50, SWT.DEFAULT).applyTo(rowText);
    // rowText.getBounds().width = 100;
    rowText.setRedraw(true);
    Label rowNum = new Label(header, SWT.NONE);
    rowNum.getBounds().height = HEIGHT_BUTTON_PIXEL;
    //$NON-NLS-1$
    rowNum.setText(Messages.getString("TabFolderEditors.RowNum.LabelText"));
    rowNum.setAlignment(SWT.CENTER);
    refreshButton = new Button(header, SWT.NONE);
    //$NON-NLS-1$
    refreshButton.setText(Messages.getString("TabFolderEditors.PreviewButton.Label"));
    refreshButton.setSize(WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL);
    processPreview = new ShadowProcessPreview(previewHeader, width, height - 10);
    processPreview.newTablePreview();
    refreshButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent e) {
            if (!refreshButton.getText().equals(Messages.getString("TabFolderEditors.WaitButton.Label"))) {
                //$NON-NLS-1$
                //$NON-NLS-1$
                refreshButton.setText(Messages.getString("TabFolderEditors.WaitButton.Label"));
                refreshPreview(rowText.getText());
            } else {
                //$NON-NLS-1$
                refreshButton.setText(Messages.getString("TabFolderEditors.PreviewButton.Label"));
            }
        }
    });
}
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) Text(org.eclipse.swt.widgets.Text)

Example 80 with SelectionAdapter

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

the class MetadataTableEditorViewExt method addHorizontalBarListener.

private void addHorizontalBarListener() {
    final ScrollBar horizontalBar = getTable().getHorizontalBar();
    horizontalBar.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Java)
             * 
             * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            // if (e.detail == SWT.DRAG) {
            int shift = horizontalBar.getSelection();
            attachLabelPosition(shift);
        // }
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrollBar(org.eclipse.swt.widgets.ScrollBar)

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