Search in sources :

Example 46 with ModifyListener

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

the class FTPForm method addFieldsListeners.

/*
     * (non-Javadoc)
     *
     * @see org.talend.repository.ui.swt.utils.AbstractForm#addFieldsListeners()
     */
@Override
protected void addFieldsListeners() {
    ftpUsernameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setUsername(ftpUsernameText.getText());
            checkFieldsValue();
        }
    });
    ftpPasswordText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            FTPConnection conn = getConnection();
            conn.setPassword(conn.getValue(ftpPasswordText.getText(), true));
            checkFieldsValue();
        }
    });
    ftpPortText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setPort(ftpPortText.getText());
            checkFieldsValue();
        }
    });
    ftpHostText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setHost(ftpHostText.getText());
            checkFieldsValue();
        }
    });
    proxyUsernameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setProxyuser(proxyUsernameText.getText());
        }
    });
    proxyPasswordText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            FTPConnection conn = getConnection();
            conn.setProxypassword(conn.getValue(proxyPasswordText.getText(), true));
        }
    });
    proxyPortText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setProxyport(proxyPortText.getText());
        }
    });
    proxyHostText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setProxyhost(proxyHostText.getText());
        }
    });
    keyFileText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setKeystoreFile(PathUtils.getPortablePath(keyFileText.getText()));
            checkFilePathAndManageIt();
        }
    });
    keyPasswordText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            FTPConnection conn = getConnection();
            conn.setKeystorePassword(conn.getValue(keyPasswordText.getText(), true));
        }
    });
    connModelCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setMode(connModelCombo.getText());
        }
    });
    encodeCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setEcoding(encodeCombo.getText());
            if (CUSTOM.equals(getConnection().getEcoding())) {
                customText.setVisible(true);
                customText.setText(ENCODING);
                getConnection().setCustomEncode(customText.getText());
            } else {
                getConnection().setCustomEncode(getConnection().getEcoding());
                customText.setVisible(false);
            }
        }
    });
    customText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setCustomEncode(customText.getText());
        }
    });
    methodCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            FTPConnection conn = getConnection();
            conn.setMethod(methodCombo.getText());
            if (PUBLIC_KEY.equals(conn.getMethod())) {
                privatekeyText.setVisible(true);
                passphraseText.setVisible(true);
                //$NON-NLS-1$
                privatekeyText.setText(conn.getPrivatekey() != null ? conn.getPrivatekey() : "");
                // decrypt password
                passphraseText.setText(conn.getValue(conn.getPassphrase(), false));
            } else {
                privatekeyText.setVisible(false);
                passphraseText.setVisible(false);
            }
            checkFieldsValue();
        }
    });
    privatekeyText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getConnection().setPrivatekey(PathUtils.getPortablePath(privatekeyText.getText()));
            checkFilePathAndManageIt();
        }
    });
    passphraseText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            FTPConnection conn = getConnection();
            conn.setPassphrase(conn.getValue(passphraseText.getText(), true));
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) FTPConnection(org.talend.core.model.metadata.builder.connection.FTPConnection)

Example 47 with ModifyListener

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

the class NameSection method createControls.

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    composite = getWidgetFactory().createFlatFormComposite(parent);
    FormData data;
    //$NON-NLS-1$
    nameText = getWidgetFactory().createText(composite, "");
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(50, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    nameText.setLayoutData(data);
    addFocusListener(nameText);
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            IStatus status = evaluateTextField();
            if (status.getSeverity() == IStatus.ERROR) {
                errorLabel.setText(status.getMessage());
                errorLabel.setVisible(true);
            } else {
                errorLabel.setVisible(false);
            }
        }
    });
    //$NON-NLS-1$
    CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("NameSection.Name"));
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(nameText, 0, SWT.CENTER);
    labelLabel.setLayoutData(data);
    //$NON-NLS-1$
    errorLabel = getWidgetFactory().createCLabel(composite, "");
    data = new FormData();
    data.left = new FormAttachment(nameText, ITabbedPropertyConstants.HSPACE * 3);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(nameText, 0, SWT.CENTER);
    errorLabel.setLayoutData(data);
    errorLabel.setImage(ImageProvider.getImage(EImage.ERROR_ICON));
    errorLabel.setVisible(false);
    addFocusListenerToChildren(composite);
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IStatus(org.eclipse.core.runtime.IStatus) ModifyListener(org.eclipse.swt.events.ModifyListener) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 48 with ModifyListener

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

the class NewImportProjectWizardPage method addListeners.

private void addListeners() {
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkFieldsValue();
        }
    });
    descriptionText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkFieldsValue();
        }
    });
    languagePerlRadio.addSelectionListener(new SelectionAdapter() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFieldsValue();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 49 with ModifyListener

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

the class NewProjectWizardPage method addListeners.

private void addListeners() {
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            checkFieldsValue();
        }
    });
    descriptionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            checkFieldsValue();
        }
    });
    languagePerlRadio.addSelectionListener(new SelectionAdapter() {

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

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFieldsValue();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 50 with ModifyListener

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

the class ErDiagramComposite method addErDiagramEditor.

/**
     * admin Comment method "addErDiagramEditor".
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private void addErDiagramEditor(boolean isShowDesignerPage) {
    GridData gridData = new GridData(GridData.FILL_BOTH);
    this.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 1;
    this.setLayout(layout);
    editor = new ErdiagramDiagramEditor();
    editor.createPartControl(this);
    editor.getViewer().setContents(createErDiagram(isShowDesignerPage));
    Control control = editor.getGraphicalControl();
    if (control != null) {
        control.setParent(this);
        control.setLayoutData(gridData);
    }
    layout = new GridLayout();
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 30;
    int textstyle = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
    sqlText = new ColorStyledText(this, textstyle, CorePlugin.getDefault().getPreferenceStore(), language);
    sqlText.setLayoutData(gridData);
    //$NON-NLS-1$
    sqlText.setText("");
    sqlText.setBackground(getBackground());
    sqlText.addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        public void modifyText(ModifyEvent e) {
            sqlString = sqlText.getText();
        }
    });
}
Also used : ErdiagramDiagramEditor(org.talend.sqlbuilder.erdiagram.ui.editor.ErdiagramDiagramEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) ColorStyledText(org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)

Aggregations

ModifyListener (org.eclipse.swt.events.ModifyListener)308 ModifyEvent (org.eclipse.swt.events.ModifyEvent)296 GridData (org.eclipse.swt.layout.GridData)209 GridLayout (org.eclipse.swt.layout.GridLayout)185 Text (org.eclipse.swt.widgets.Text)185 Composite (org.eclipse.swt.widgets.Composite)171 Label (org.eclipse.swt.widgets.Label)165 SelectionEvent (org.eclipse.swt.events.SelectionEvent)158 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)127 Button (org.eclipse.swt.widgets.Button)101 Combo (org.eclipse.swt.widgets.Combo)65 Group (org.eclipse.swt.widgets.Group)50 SelectionListener (org.eclipse.swt.events.SelectionListener)48 File (java.io.File)30 KeyEvent (org.eclipse.swt.events.KeyEvent)26 StyledText (org.eclipse.swt.custom.StyledText)24 FileDialog (org.eclipse.swt.widgets.FileDialog)23 Point (org.eclipse.swt.graphics.Point)22 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)21 ArrayList (java.util.ArrayList)18