Search in sources :

Example 51 with ModifyListener

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

the class XmlTableForm method addFieldsListeners.

private void addFieldsListeners() {
    nameFilter.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String pattern = nameFilter.getText();
            SearchPattern matcher = new SearchPattern();
            matcher.setPattern(pattern);
            final List<Item> newList = new ArrayList<Item>();
            for (Item item : items) {
                if (matcher.matches(item.getLabel())) {
                    newList.add(item);
                }
            }
            reftesTableContent(newList);
            completeListener.setComplete(!getSelectionItems().isEmpty());
        }
    });
    // Event checkBox action
    table.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (e.detail == SWT.CHECK) {
                ((Item) e.item.getData()).setCheck(((TableItem) e.item).getChecked());
                if (null != completeListener) {
                    completeListener.setComplete(!getSelectionItems().isEmpty());
                }
            }
        }
    });
    table.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            table.getColumns()[0].setWidth(table.getClientArea().width - 2 * table.getBorderWidth());
        }
    });
    selectAllTablesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            setChecked(true);
        }
    });
    selectNoneTablesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            setChecked(false);
        }
    });
}
Also used : ModifyListener(org.eclipse.swt.events.ModifyListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) TableItem(org.eclipse.swt.widgets.TableItem) XmlFileConnectionItem(org.talend.core.model.properties.XmlFileConnectionItem) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SearchPattern(org.eclipse.ui.dialogs.SearchPattern) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) List(java.util.List) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 52 with ModifyListener

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

the class OpenWSDLPage method createControl.

public void createControl(Composite parent) {
    Composite parentArea = new Composite(parent, SWT.NONE);
    parentArea.setLayout(new GridLayout());
    radioCreateWsdl = new Button(parentArea, SWT.RADIO);
    radioCreateWsdl.setText(Messages.AssignWsdlDialog_WsdlChoice_CreateNew);
    radioCreateWsdl.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            switchRadio();
        }
    });
    radioCreateWsdl.setSelection(true);
    radioImportWsdl = new Button(parentArea, SWT.RADIO);
    radioImportWsdl.setText(Messages.AssignWsdlDialog_WsdlChoice_ImportExistent);
    radioImportWsdl.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            switchRadio();
        }
    });
    Composite wsdlFileArea = new Composite(parentArea, SWT.NONE);
    wsdlFileArea.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    GridLayout layout = new GridLayout(3, false);
    //        layout.marginLeft = 15;
    //        layout.marginHeight = 0;
    wsdlFileArea.setLayout(layout);
    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    String[] xmlExtensions = { "*.xml;*.xsd;*.wsdl", "*.*", "*" };
    wsdlText = new LabelledFileField(wsdlFileArea, Messages.AssignWsdlDialog_ExistentWsdlFilePath, xmlExtensions);
    final String initialPath = //$NON-NLS-1$
    null == item || null == item.getConnection() ? //$NON-NLS-1$
    "" : ((ServiceConnection) item.getConnection()).getWSDLPath();
    wsdlText.setText(initialPath);
    wsdlText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            path = wsdlText.getText().trim();
            setPageComplete(!path.isEmpty());
        }
    });
    new Label(wsdlFileArea, SWT.NONE);
    checkImport = new Button(wsdlFileArea, SWT.CHECK);
    checkImport.setText(Messages.AssignWsdlDialog_ImportWsdlSchemas);
    checkImport.setSelection(true);
    switchRadio();
    setControl(parentArea);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) LabelledFileField(org.talend.commons.ui.swt.formtools.LabelledFileField) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData)

Example 53 with ModifyListener

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

the class ServiceExportWSWizardPage method createControl.

public void createControl(Composite parent) {
    setControl(parent);
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    container.setLayout(new GridLayout(1, false));
    Group destinationGroup = new Group(container, SWT.NONE);
    destinationGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    destinationGroup.setText("Destination");
    destinationGroup.setLayout(new GridLayout(2, false));
    destinationText = new Text(destinationGroup, SWT.SINGLE | SWT.BORDER);
    destinationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    destinationText.setText(getDestinationValue());
    destinationText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            destinationValue = destinationText.getText();
            checkDestination(destinationValue);
        }
    });
    Button browseButton = new Button(destinationGroup, SWT.PUSH);
    browseButton.setText("Browse");
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleDestinationBrowseButtonPressed();
            destinationText.setText(destinationValue);
        }
    });
    Group optionsGroup = new Group(container, SWT.NONE);
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    optionsGroup.setLayoutData(layoutData);
    GridLayout layout = new GridLayout();
    optionsGroup.setLayout(layout);
    // optionsGroup.setText(IDEWorkbenchMessages.WizardExportPage_options);
    //$NON-NLS-1$
    optionsGroup.setText(org.talend.repository.i18n.Messages.getString("IDEWorkbenchMessages.WizardExportPage_options"));
    optionsGroup.setFont(parent.getFont());
    createBSGroup(optionsGroup);
}
Also used : Group(org.eclipse.swt.widgets.Group) 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) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text)

Example 54 with ModifyListener

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

the class MultiPageSqlBuilderEditor method attachListeners.

/**
     * qzhang Comment method "attachListeners".
     */
private void attachListeners() {
    sqlDesigner.getColorText().addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        public void modifyText(ModifyEvent e) {
            if (!isFirst) {
                updateEditorTitle(null);
            } else {
                isFirst = false;
            }
        }
    });
    sqlEdit.getColorText().addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        public void modifyText(ModifyEvent e) {
            if (!isFirst2) {
                updateEditorTitle(null);
            } else {
                isFirst2 = false;
            }
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener)

Example 55 with ModifyListener

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

the class SQLPropertyDialog method addListener.

/**
     * Adds modify listener.
     */
/**
     * DOC dev Comment method "addListener".
     */
/**
     * DOC dev Comment method "addListener".
     */
private void addListener() {
    nameText.addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        @Override
        public void modifyText(ModifyEvent e) {
            String result = validate(nameText.getText());
            if (result == null) {
                SQLPropertyDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(true);
                //$NON-NLS-1$
                SQLPropertyDialog.this.setMessage(//$NON-NLS-1$
                Messages.getString("SQLEditor.Actions.InputMessage"), IMessageProvider.INFORMATION);
            } else {
                SQLPropertyDialog.this.setMessage(result, IMessageProvider.ERROR);
                SQLPropertyDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(false);
            }
        }

        /**
             * Validates input text.
             * 
             * @param text
             * @return a string
             */
        private String validate(String text) {
            if (nameText.getText().length() == 0) {
                //$NON-NLS-1$
                return Messages.getString("SQLEditor.Actions.EmptyNameMessage");
            } else if (names.contains(text)) {
                //$NON-NLS-1$
                return Messages.getString("SQLEditor.Actions.DuplicateNameMessage");
            }
            return null;
        }
    });
    commentText.addModifyListener(new ModifyListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
             */
        @Override
        public void modifyText(ModifyEvent e) {
            if (commentText.getText().length() == 0) {
                //$NON-NLS-1$
                SQLPropertyDialog.this.setMessage(//$NON-NLS-1$
                Messages.getString("SQLEditor.Actions.EmptyCommentMessage"), IMessageProvider.INFORMATION);
            } else if (showQueryProperty) {
                SQLPropertyDialog.this.setMessage(//$NON-NLS-1$
                Messages.getString("SQLEditor.SQLPropertyDialog.ShowQueryProperty.message"), IMessageProvider.INFORMATION);
                SQLPropertyDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener)

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