Search in sources :

Example 96 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 97 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 98 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 99 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 100 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

ModifyEvent (org.eclipse.swt.events.ModifyEvent)269 ModifyListener (org.eclipse.swt.events.ModifyListener)269 GridData (org.eclipse.swt.layout.GridData)179 Text (org.eclipse.swt.widgets.Text)160 GridLayout (org.eclipse.swt.layout.GridLayout)159 Composite (org.eclipse.swt.widgets.Composite)148 SelectionEvent (org.eclipse.swt.events.SelectionEvent)141 Label (org.eclipse.swt.widgets.Label)140 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)120 Button (org.eclipse.swt.widgets.Button)87 Combo (org.eclipse.swt.widgets.Combo)54 Group (org.eclipse.swt.widgets.Group)42 SelectionListener (org.eclipse.swt.events.SelectionListener)30 File (java.io.File)27 KeyEvent (org.eclipse.swt.events.KeyEvent)23 StyledText (org.eclipse.swt.custom.StyledText)21 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)21 FileDialog (org.eclipse.swt.widgets.FileDialog)18 FocusEvent (org.eclipse.swt.events.FocusEvent)17 List (java.util.List)16