Search in sources :

Example 1 with ModifyEvent

use of org.eclipse.swt.events.ModifyEvent 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 ModifyEvent

use of org.eclipse.swt.events.ModifyEvent 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 ModifyEvent

use of org.eclipse.swt.events.ModifyEvent 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 ModifyEvent

use of org.eclipse.swt.events.ModifyEvent 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 ModifyEvent

use of org.eclipse.swt.events.ModifyEvent 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

ModifyEvent (org.eclipse.swt.events.ModifyEvent)1196 ModifyListener (org.eclipse.swt.events.ModifyListener)1191 Text (org.eclipse.swt.widgets.Text)814 Label (org.eclipse.swt.widgets.Label)784 SelectionEvent (org.eclipse.swt.events.SelectionEvent)701 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)627 GridData (org.eclipse.swt.layout.GridData)595 Button (org.eclipse.swt.widgets.Button)572 Composite (org.eclipse.swt.widgets.Composite)563 GridLayout (org.eclipse.swt.layout.GridLayout)481 FormAttachment (org.eclipse.swt.layout.FormAttachment)347 FormData (org.eclipse.swt.layout.FormData)347 FormLayout (org.eclipse.swt.layout.FormLayout)340 Event (org.eclipse.swt.widgets.Event)324 Listener (org.eclipse.swt.widgets.Listener)316 Shell (org.eclipse.swt.widgets.Shell)307 Display (org.eclipse.swt.widgets.Display)294 ShellEvent (org.eclipse.swt.events.ShellEvent)285 ShellAdapter (org.eclipse.swt.events.ShellAdapter)283 Group (org.eclipse.swt.widgets.Group)245