Example usage for java.lang Character isIdentifierIgnorable

List of usage examples for java.lang Character isIdentifierIgnorable

Introduction

In this page you can find the example usage for java.lang Character isIdentifierIgnorable.

Prototype

public static boolean isIdentifierIgnorable(int codePoint) 

Source Link

Document

Determines if the specified character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

Usage

From source file:Main.java

public static void main(String[] args) {
    char ch1 = '\u0000', ch2 = '8';

    boolean b1 = Character.isIdentifierIgnorable(ch1);
    boolean b2 = Character.isIdentifierIgnorable(ch2);

    System.out.println(b1);/* ww w. ja  v a 2s . com*/
    System.out.println(b2);
}

From source file:Main.java

public static void main(String[] args) {
    int cp1 = 0x008f, cp2 = 0x0abc;

    boolean b1 = Character.isIdentifierIgnorable(cp1);
    boolean b2 = Character.isIdentifierIgnorable(cp2);

    System.out.println(b1);//from  w  w w  .  j av  a2s . com
    System.out.println(b1);
}

From source file:Main.java

public static void main(String[] args) throws java.io.IOException {
    char c = 'a';

    System.out.println("Character = " + (int) c);
    System.out.println("Defined = " + Character.isDefined(c));
    System.out.println("Digit = " + Character.isDigit(c));
    System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c));
    System.out.println("ISO control = " + Character.isISOControl(c));
    System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c));
    System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c));
    System.out.println("Letter = " + Character.isLetter(c));
    System.out.println("Letter or digit = " + Character.isLetterOrDigit(c));
    System.out.println("Lowercase = " + Character.isLowerCase(c));
    System.out.println("Space = " + Character.isSpaceChar(c));
    System.out.println("Titlecase = " + Character.isTitleCase(c));
    System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c));
    System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c));
    System.out.println("Uppercase = " + Character.isUpperCase(c));
    System.out.println("White space = " + Character.isWhitespace(c));

    byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL,
            Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER,
            Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER,
            Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL,
            Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER,
            Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL,
            Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR,
            Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED,
            Character.UPPERCASE_LETTER };

    String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol",
            "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format",
            "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol",
            "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol",
            "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate",
            "Titlecase letter", "Unassigned", "Uppercase letter" };

    int type = Character.getType(c);

    for (int i = 0; i < types.length; i++)
        if (type == types[i]) {
            System.out.println("Type name = " + typeNames[i]);
            break;
        }//from  w  w  w . java  2s. c om

    System.out.println("Unicode block = " + Character.UnicodeBlock.of(c));
}

From source file:Classify.java

public static void main(String[] args) throws java.io.IOException {
    char c = '\u0beb'; // Tamil digit.

    System.out.println("Character = " + (int) c);
    System.out.println("Defined = " + Character.isDefined(c));
    System.out.println("Digit = " + Character.isDigit(c));
    System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c));
    System.out.println("ISO control = " + Character.isISOControl(c));
    System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c));
    System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c));
    System.out.println("Letter = " + Character.isLetter(c));
    System.out.println("Letter or digit = " + Character.isLetterOrDigit(c));
    System.out.println("Lowercase = " + Character.isLowerCase(c));
    System.out.println("Space = " + Character.isSpaceChar(c));
    System.out.println("Titlecase = " + Character.isTitleCase(c));
    System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c));
    System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c));
    System.out.println("Uppercase = " + Character.isUpperCase(c));
    System.out.println("White space = " + Character.isWhitespace(c));

    byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL,
            Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER,
            Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER,
            Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL,
            Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER,
            Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL,
            Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR,
            Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED,
            Character.UPPERCASE_LETTER };

    String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol",
            "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format",
            "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol",
            "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol",
            "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate",
            "Titlecase letter", "Unassigned", "Uppercase letter" };

    int type = Character.getType(c);

    for (int i = 0; i < types.length; i++)
        if (type == types[i]) {
            System.out.println("Type name = " + typeNames[i]);
            break;
        }/*from w  w  w  . j a va2s .c  om*/

    System.out.println("Unicode block = " + Character.UnicodeBlock.of(c));
}

From source file:Utils.java

/**
 * Determine whether the supplied string represents a well-formed fully-qualified Java classname. This utility method enforces
 * no conventions (e.g., packages are all lowercase) nor checks whether the class is available on the classpath.
 * /*from  w  ww.  jav a 2s. com*/
 * @param classname
 * @return true if the string is a fully-qualified class name
 */
public static boolean isFullyQualifiedClassname(String classname) {
    if (classname == null)
        return false;
    String[] parts = classname.split("[\\.]");
    if (parts.length == 0)
        return false;
    for (String part : parts) {
        CharacterIterator iter = new StringCharacterIterator(part);
        // Check first character (there should at least be one character for each part) ...
        char c = iter.first();
        if (c == CharacterIterator.DONE)
            return false;
        if (!Character.isJavaIdentifierStart(c) && !Character.isIdentifierIgnorable(c))
            return false;
        c = iter.next();
        // Check the remaining characters, if there are any ...
        while (c != CharacterIterator.DONE) {
            if (!Character.isJavaIdentifierPart(c) && !Character.isIdentifierIgnorable(c))
                return false;
            c = iter.next();
        }
    }
    return true;
}

From source file:com.exalttech.trex.ui.views.streams.viewer.PacketParser.java

/**
 * Format payload/*w  w  w .ja va2  s.  c o  m*/
 *
 * @param payLoad
 * @return
 */
static String formatPayLoad(String payLoad) {
    int line = 0;
    String dim;
    StringBuilder finalHex = new StringBuilder();
    char[] arr = payLoad.toCharArray();

    for (int i = 0; i < arr.length; i++) {
        line++;
        dim = "";
        if (line == 16) {
            dim = "\n";
            line = 0;
        }
        int nVal = (int) arr[i];
        // Is character ISO control
        boolean bISO = Character.isISOControl(arr[i]);
        // Is Ignorable identifier
        boolean bIgnorable = Character.isIdentifierIgnorable(arr[i]);
        // Remove tab and other unwanted characters..
        if (nVal == 9 || bISO || bIgnorable) {
            arr[i] = '.';
        } else if (nVal > 255) {
            arr[i] = '.';
        }
        if (arr[i] == '\n' || arr[i] == '\r' || arr[i] == ' ' || arr[i] == '\0') {
            finalHex.append('.').append(dim);
        } else {
            finalHex.append(arr[i]).append(dim);
        }
    }
    return finalHex.toString();
}

From source file:com.jlgranda.fede.ejb.mail.reader.EmailHelper.java

protected static String sanitizeString(String dirtyString) {
    StringBuilder sb = new StringBuilder(dirtyString.length());
    for (int i = 0; i < dirtyString.length(); i++) {
        if (!Character.isIdentifierIgnorable(dirtyString.charAt(i))) {
            sb.append(dirtyString.charAt(i));
        }//from  w  ww.j  ava 2s.c  om
    }
    return sb.toString();
}

From source file:org.jivesoftware.community.util.StringUtils.java

public static String removeIgnorableCharacters(String input) {
    if (input == null)
        return input;
    StringBuffer buf = new StringBuffer();
    char chars[] = input.toCharArray();
    int i = 0;/*from   w  w w  . jav a2  s . co m*/
    for (int n = input.length(); i < n; i++)
        if (!Character.isIdentifierIgnorable(chars[i]))
            buf.append(chars[i]);

    return buf.toString();
}

From source file:org.talend.core.model.metadata.MetadataToolHelper.java

/**
 * wzhang Comment method "checkSchema"./* w ww .jav a 2  s.co  m*/
 */
public static void checkSchema(Shell shell, KeyEvent event) {
    if ((!Character.isIdentifierIgnorable(event.character)) && (event.character == ' ')) {
        event.doit = false;
        MessageDialog.openError(shell, Messages.getString("MetadataTool.invalidChar"), //$NON-NLS-1$
                Messages.getString("MetadataTool.errorMessage")); //$NON-NLS-1$
    }
}

From source file:org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.java

/**
 * Main Fields addControls./*w w w.j  av a 2  s . com*/
 */
@Override
protected void addFieldsListeners() {
    // common Listener to force the choice of dbCombo
    Listener listener = new Listener() {

        @Override
        public void handleEvent(final Event e) {
            if (isContextMode()) {
                //
            } else {
                if (dbTypeCombo.getSelectionIndex() == -1) {
                    dbTypeCombo.forceFocus();
                }
                setPropertiesFormEditable(dbTypeCombo.getSelectionIndex() > -1);
                urlConnectionStringText.setEditable(false);
            }
        }
    };

    usernameText.addListener(SWT.FocusIn, listener);
    passwordText.addListener(SWT.FocusIn, listener);
    serverText.addListener(SWT.FocusIn, listener);
    portText.addListener(SWT.FocusIn, listener);
    sidOrDatabaseText.addListener(SWT.FocusIn, listener);
    datasourceText.addListener(SWT.FocusIn, listener);
    schemaText.addListener(SWT.FocusIn, listener);
    additionParamText.addListener(SWT.FocusIn, listener);
    urlConnectionStringText.addListener(SWT.FocusIn, listener);
    mappingFileText.addListener(SWT.FocusIn, listener);

    // serverText : Event modifyText
    serverText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setServerName(serverText.getText());
                    modifyFieldValue();
                }
            }
        }
    });

    // portText : Event modifyText
    portText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setPort(portText.getText());
                    modifyFieldValue();
                }
                // Check port
                boolean b = true;
                String databaseType = getConnection().getDatabaseType();
                if (databaseType != null) {
                    if (databaseType.equals("Ingres")) { //$NON-NLS-1$
                        b = Pattern.matches(Messages.getString("DatabaseForm.ingresDBRegex"), //$NON-NLS-1$
                                portText.getText());
                    } else {
                        b = Pattern.matches(Messages.getString("DatabaseForm.otherDBRegex"), //$NON-NLS-1$
                                portText.getText());
                    }
                }
                if (b) {
                    b = portText.getText().length() <= 5;
                }
                evaluateTextField(b);
            }
        }
    });

    // portText : Event Key
    portText.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (!Character.isLetterOrDigit(e.character) && !Character.isIdentifierIgnorable(e.character)) {
                e.doit = false;
            }
        }
    });

    // usernameText : Event modifyText
    usernameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setUsername(usernameText.getText());
                    getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USERNAME,
                            usernameText.getText());
                }
            }
        }
    });

    // passwordText : Event modifyText
    passwordText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setRawPassword(passwordText.getText());
                }
            }
        }
    });

    // sidOrDatabaseText : Event modifyText
    sidOrDatabaseText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setSID(sidOrDatabaseText.getText());
                    modifyFieldValue();
                }
            }
        }
    });

    // datasourceText : Event modifyText
    datasourceText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setDatasourceName(datasourceText.getText());
                    modifyFieldValue();
                }
            }
        }
    });

    // schemaText : Event modifyText
    schemaText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setUiSchema(schemaText.getText());
                    modifyFieldValue();
                }
            }
        }

    });
    // MOD yyin 20121203 TDQ-6485: when the url or schema changed, will need reload db. if neither of them changed,
    // doNOT popup the reload dialog(no need to reload)
    // check setURL only when the schema is changed.
    schemaText.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
        }

        @Override
        public void focusLost(FocusEvent e) {
            if (!isContextMode()) {
                if (originalUischema != null) {
                    if (!originalUischema.equalsIgnoreCase(schemaText.getText())) {
                        ConnectionHelper.setIsConnNeedReload(getConnection(), Boolean.TRUE);
                    } else {
                        checkURLIsChanged();
                    }
                }
            }
        }
    });

    // Db version
    dbVersionCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                EDatabaseVersion4Drivers version = EDatabaseVersion4Drivers
                        .indexOfByVersionDisplay(dbVersionCombo.getText());
                if (version != null) {
                    getConnection().setDbVersionString(version.getVersionValue());
                }
                urlConnectionStringText.setText(getStringConnection());
                checkFieldsValue();
            }
        }
    });
    hideDbVersion();

    // additional parameters: Event modifyText
    additionParamText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setAdditionalParams(additionParamText.getText());
                    modifyFieldValue();
                }
            }
        }
    });
    // standardButton parameters: Event modifyText
    standardButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!isContextMode()) {
                getConnection().setStandardSQL(standardButton.getSelection());
                getConnection().setSystemSQL(systemButton.getSelection());
            }
        }

    });
    // systemButton parameters: Event modifyText
    systemButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!isContextMode()) {
                getConnection().setStandardSQL(standardButton.getSelection());
                getConnection().setSystemSQL(systemButton.getSelection());
            }
        }

    });
    // button1 parameter:Event modifyText
    button1.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!isContextMode()) {
                getConnection().setSQLMode(button1.getSelection());
            }
        }
    });
    // button2 parameter:Event modifyText
    button2.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!isContextMode()) {
                getConnection().setSQLMode(!button2.getSelection());
            }
        }
    });
    // Event dbTypeCombo
    dbTypeCombo.addModifyListener(new ModifyListener() {

        // Event Modify
        @Override
        public void modifyText(final ModifyEvent e) {
            getConnection().getParameters().clear();
            urlConnectionStringText.setEditable(false);
            authenticationGrpForImpala.setVisible(false);
            authenticationGrpForImpala.getParent().layout();
            // add for bug 12649
            clearFiledsForDiffDbTypes();
            boolean isGeneralJDBC = isGeneralJDBC();
            if (isGeneralJDBC) {
                if (generalJdbcUrlText != null) {
                    generalJdbcUrlText.setText(""); //$NON-NLS-1$
                }
                if (generalJdbcUserText != null) {
                    generalJdbcUserText.setText(""); //$NON-NLS-1$
                }
                if (generalJdbcPasswordText != null) {
                    generalJdbcPasswordText.setText(""); //$NON-NLS-1$
                }

            } else if (isHiveDBConnSelected()) {
                // Added by Marvin Wang on Oct. 15, 2012 for bug TDI-23235.
                if (urlConnectionStringText != null) {
                    urlConnectionStringText.setText(""); //$NON-NLS-1$
                }
                if (usernameText != null) {

                    usernameText.setText(""); //$NON-NLS-1$
                }
                if (passwordText != null) {
                    passwordText.setText(""); //$NON-NLS-1$
                }
                initHiveInfo();
            } else if (isDBTypeSelected(EDatabaseConnTemplate.HBASE)) {
                initHBaseSettings();
            } else if (isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
                initImpalaSettings();
                getConnection().setDbVersionString("");
            } else {
                if (urlConnectionStringText != null) {
                    urlConnectionStringText.setText(""); //$NON-NLS-1$
                }
                if (usernameText != null) {

                    usernameText.setText(""); //$NON-NLS-1$
                }
                if (passwordText != null) {
                    passwordText.setText(""); //$NON-NLS-1$
                }
            }
            if (schemaText != null) {
                schemaText.setText(""); //$NON-NLS-1$
            }
            if (serverText != null) {
                serverText.setText(""); //$NON-NLS-1$
            }
            if (sidOrDatabaseText != null) {
                sidOrDatabaseText.setText(""); //$NON-NLS-1$
            }
            if (portText != null && portText.getText() != null) {
                portText.setText(""); //$NON-NLS-1$
            }
            if (fileField != null) {
                fileField.setText(""); //$NON-NLS-1$
            }
            if (datasourceText != null) {
                datasourceText.setText(""); //$NON-NLS-1$
            }
            if (additionParamText != null) {
                additionParamText.setText(""); //$NON-NLS-1$
            }
            if (generalJdbcClassNameText != null) {
                generalJdbcClassNameText.setText(""); //$NON-NLS-1$
            }
            if (generalJdbcDriverjarText != null) {
                generalJdbcDriverjarText.setText(""); //$NON-NLS-1$
            }
            if (additionParamText != null) {
                additionParamText.setText(""); //$NON-NLS-1$
            }
            if (mappingFileText != null) {
                mappingFileText.setText(""); //$NON-NLS-1$
            }

            boolean hiddenGeneral = !isGeneralJDBC();

            // change controls
            switchBetweenTypeandGeneralDB(!isGeneralJDBC());

            if (!isContextMode()) {
                getConnection().setDatabaseType(dbTypeCombo.getText());

                EDatabaseConnTemplate template = EDatabaseConnTemplate
                        .indexOfTemplate(getConnection().getDatabaseType());
                if (template != null) {
                    portText.setText(template.getDefaultPort());
                }
                final String product = EDatabaseTypeName
                        .getTypeFromDisplayName(getConnection().getDatabaseType()).getProduct();
                getConnection().setProductId(product);

                String mapping = null;

                if (product == null || product.equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
                    mapping = generalMappingFileText.getText();
                } else {
                    if (MetadataTalendType.getDefaultDbmsFromProduct(product) != null) {
                        mapping = MetadataTalendType.getDefaultDbmsFromProduct(product).getId();
                    }
                }
                if (mapping == null) {
                    mapping = "mysql_id"; // default value //$NON-NLS-1$
                }
                getConnection().setDbmsId(mapping);

                setPropertiesFormEditable(true);

                additionParamText.setText(EDatabaseConnTemplate.getAdditionProperty(dbTypeCombo.getText()));
                if (dbTypeCombo.getText().equals(EDatabaseConnTemplate.INFORMIX.getDBDisplayName())) {
                    datasourceText.setLabelText(Messages.getString("DatabaseForm.informixInstance")); //$NON-NLS-1$
                }
                checkAndSetIniSQLModel();
                checkAS400SpecificCase();
                checkFieldsValue();
                hideDbVersion();
                // see bug 0005237: Create DB Connection issue.
                if (!schemaText.getEditable()) {
                    schemaText.setText(""); //$NON-NLS-1$
                }
                if (isHiveDBConnSelected()) {
                    doHiveDBTypeSelected();
                    fillDefaultsWhenHiveVersionChanged();
                    fillDefaultsWhenHiveModeChanged(isHiveEmbeddedMode());
                } else {
                    doHiveDBTypeNotSelected();
                }

                if (isHBaseDBConnSelected()) {
                    fillDefaultsWhenHBaseVersionChanged();
                }
                if (isImpalaDBConnSelected()) {
                    fillDefaultsWhenImpalaVersionChanged();
                }
            }

            // Added by Marvin Wang on Oct. 22, 2012 just for show the scrolled bar when a hive DB type is selected.
            // It is not the better way to do this, if the code of DB part is required to refactor, this code could
            // be removed.
            if (isHiveDBConnSelected()) {
                scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            } else if (isImpalaDBConnSelected()) {
                scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, 550));
            } else {
                checkScrolledCompositeSize();
            }

            if (!isDBTypeSelected(EDatabaseConnTemplate.HBASE) && !isDBTypeSelected(EDatabaseConnTemplate.HIVE)
                    && !isDBTypeSelected(EDatabaseConnTemplate.IMPALA)) {
                clearHadoopRelatedParameters();
            }
        }

    });

    // removed for bug TDI-14797 on 26 July, 2013. for support search by keyboard's letter.
    // When the DbType is selected, disabled the action of keyboard's letter
    // to modify the combo
    // utils when the user use the keyboard to write the connection string
    // dbTypeCombo.addKeyListener(new KeyAdapter() {
    //
    // @Override
    // public void keyPressed(KeyEvent e) {
    // if (dbTypeCombo.getSelectionIndex() > -1) {
    // if (Character.isLetterOrDigit(e.character)) {
    // e.doit = false;
    // }
    // }
    // }
    // });

    // Event fileField
    fileField.addListener(SWT.FocusIn, new Listener() {

        // Event FocusIn
        @Override
        public void handleEvent(final Event e) {
            if (!isContextMode()) {
                if (dbTypeCombo.getSelectionIndex() == -1) {
                    dbTypeCombo.forceFocus();
                } else {
                    EDatabaseConnTemplate template = EDatabaseConnTemplate
                            .indexOfTemplate(getConnection().getDatabaseType());
                    EDatabaseVersion4Drivers version = EDatabaseVersion4Drivers
                            .indexOfByVersionDisplay(getConnection().getDbVersionString());
                    if (template != null && template.getUrlTemplate(version)
                            .contains(EDatabaseConnVar.FILENAME.getVariable())) {
                        setPropertiesFormEditable(true);
                        urlConnectionStringText.setEditable(false);
                    }
                    getConnection().setFileFieldName(PathUtils.getPortablePath(fileField.getText()));
                }
            }
        }
    });
    // Event Modify
    fileField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    getConnection().setFileFieldName(fileField.getText());
                    modifyFieldValue();
                }
            }
        }
    });

    directoryField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                if (!urlConnectionStringText.getEditable()) {
                    String text = directoryField.getText();
                    getConnection().setDBRootPath(text);
                    checkFieldsValue();
                }
            }
        }
    });
    // sqlSyntaxText : Event modifyText
    sqlSyntaxCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                getConnection().setSqlSynthax(sqlSyntaxCombo.getText());
            }
        }
    });

    // nullCharText : Event modifyText
    nullCharText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                getConnection().setNullChar(nullCharText.getText());
            }
        }
    });

    // stringQuoteText : Event modifyText
    stringQuoteText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!isContextMode()) {
                getConnection().setStringQuote(stringQuoteText.getText());
            }
        }
    });

    addGeneralDbFieldsListeners();

    addHBaseSettingFieldsListeners();

    addImpalaSettingFieldsListeners();

    // Registers listeners for the combos of Hive, including distribution, hive mode and hive version.
    // regHiveCombosListener();

    // Registers all listeners of hive widgets.
    regHiveRelatedWidgetsListeners();

    if (canLinkToHadoopCluster()) {
        addHadoopClusterLinkListeners();
    }
}