Search in sources :

Example 1 with ModifyListener

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

the class SchemaDetailsColumnMouseAdapter method createTextControl.

private Control createTextControl(final TreeItem item, final EPropertyName pName, final MultiMetadataColumn multiMetadataColumn) {
    final Text newEditor = new Text(getTree(), SWT.NONE);
    if (UIManager.isFirstForColumnModel(pName)) {
        newEditor.setText(MultiSchemasUtil.validateValue(multiMetadataColumn.getLabel()));
    } else {
        switch(pName) {
            case LENGTH:
                newEditor.setText(MultiSchemasUtil.getAndCheckIntgerValue(multiMetadataColumn.getLength()));
                break;
            // break;
            case PATTERN:
                newEditor.setText(MultiSchemasUtil.validateValue(multiMetadataColumn.getPattern()));
                break;
        }
    }
    newEditor.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            Text text = (Text) getEditor();
            final String value = text.getText();
            if (UIManager.isFirstForColumnModel(pName)) {
                if (//$NON-NLS-1$
                value != null && !"".equals(value.trim()) && UIManager.checkSchemaDetailsValue(getSchemaDetailsViewer(), multiMetadataColumn, pName, value)) {
                    multiMetadataColumn.setLabel(value.trim());
                    text.setBackground(null);
                } else {
                    text.setBackground(redColor);
                    return;
                }
            } else {
                switch(pName) {
                    case LENGTH:
                        if (!"".equals(value)) {
                            //$NON-NLS-1$
                            if (UIManager.checkSchemaDetailsValue(getSchemaDetailsViewer(), multiMetadataColumn, pName, value)) {
                                multiMetadataColumn.setLength(Integer.parseInt((String) value));
                                text.setBackground(null);
                            } else {
                                // else, don't change it.
                                text.setBackground(redColor);
                                return;
                            }
                        } else {
                            multiMetadataColumn.setLength(null);
                        }
                        break;
                    // break;
                    case PATTERN:
                        multiMetadataColumn.setPattern(value);
                        break;
                }
            }
            getSchemaDetailsViewer().update(item.getData(), null);
        }
    });
    newEditor.selectAll();
    return newEditor;
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) Text(org.eclipse.swt.widgets.Text)

Example 2 with ModifyListener

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

the class AddRowDialog method createControls.

private void createControls(Composite main) {
    keyLbl = new Label(main, SWT.NONE);
    //$NON-NLS-1$
    keyLbl.setText("Schema:");
    key = new Text(main, SWT.BORDER);
    key.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            keyValue = key.getText();
            validate(keyValue);
        }
    });
    recoredLbl = new Label(main, SWT.NONE);
    //$NON-NLS-1$
    recoredLbl.setText("Record:");
    record = new Text(main, SWT.BORDER);
    record.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            recordValue = record.getText();
        }
    });
    sepLbl = new Label(main, SWT.NONE);
    //$NON-NLS-1$
    sepLbl.setText("Seperator:");
    sep = new Text(main, SWT.BORDER);
    sep.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            sepValue = sep.getText();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 3 with ModifyListener

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

the class GenerateDocAsHTMLWizardPage method addDocumentListener.

private void addDocumentListener() {
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            cssField.setEditable(button.getSelection());
            if (button.getSelection()) {
                cssFilePath = cssField.getText();
            }
            updatePageCompletion();
        }
    });
    cssField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            cssFilePath = cssField.getText();
            updatePageCompletion();
        }
    });
}
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 4 with ModifyListener

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

the class ToolsPreferencePage method createUpdatePeriodTextField.

/**
     * Creates the update period text field.
     * 
     * @param parent
     *            The parent composite
     */
private void createUpdatePeriodTextField(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setText(Messages.autoDetectGroupLabel);
    Label label = new Label(group, SWT.NONE);
    label.setText(Messages.updatePeriodLabel);
    updatePeriodText = new Text(group, SWT.BORDER);
    updatePeriodText.setText(String.valueOf(getPreferenceStore().getInt(IConstants.UPDATE_PERIOD)));
    updatePeriodText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    updatePeriodText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateUpdatePeriod();
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 5 with ModifyListener

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

the class ToolsPreferencePage method createJdkRootDirectoryGroup.

/**
     * Creates the JDK root directory group.
     * 
     * @param parent
     *            The parent composite
     */
private void createJdkRootDirectoryGroup(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.jdkRootDirectoryLabel);
    jdkRootDirectoryText = new Text(composite, SWT.BORDER);
    jdkRootDirectoryText.setText(getPreferenceStore().getString(IConstants.JDK_ROOT_DIRECTORY));
    jdkRootDirectoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    jdkRootDirectoryText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateJdkRootDirectory();
        }
    });
    Button button = new Button(composite, SWT.NONE);
    button.setText(Messages.browseButton);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(e.display.getActiveShell());
            dialog.setMessage(Messages.selectJdkRootDirectoryMsg);
            String path = dialog.open();
            if (path == null) {
                return;
            }
            File file = new File(path);
            if (file.isDirectory()) {
                jdkRootDirectoryText.setText(path);
            }
        }
    });
}
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) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) File(java.io.File) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog)

Aggregations

ModifyListener (org.eclipse.swt.events.ModifyListener)1206 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1177 Text (org.eclipse.swt.widgets.Text)836 Label (org.eclipse.swt.widgets.Label)799 SelectionEvent (org.eclipse.swt.events.SelectionEvent)701 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)627 GridData (org.eclipse.swt.layout.GridData)623 Button (org.eclipse.swt.widgets.Button)589 Composite (org.eclipse.swt.widgets.Composite)583 GridLayout (org.eclipse.swt.layout.GridLayout)502 FormAttachment (org.eclipse.swt.layout.FormAttachment)351 FormData (org.eclipse.swt.layout.FormData)351 FormLayout (org.eclipse.swt.layout.FormLayout)345 Event (org.eclipse.swt.widgets.Event)323 Listener (org.eclipse.swt.widgets.Listener)318 Shell (org.eclipse.swt.widgets.Shell)314 Display (org.eclipse.swt.widgets.Display)297 ShellEvent (org.eclipse.swt.events.ShellEvent)288 ShellAdapter (org.eclipse.swt.events.ShellAdapter)286 Group (org.eclipse.swt.widgets.Group)249