Example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION

List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageAlgorithms.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *///from   w w  w . j  a  va 2 s.  c  o m
private void dialogChanged() {
    if (cEncryptionAlgorithm.getText().equals("")) {
        updateStatus(Messages.selectEncryptionAlgorithm, IMessageProvider.INFORMATION);
        return;
    }
    if (cKeyWrapAlgorithm.getText().equals("")) {
        updateStatus(Messages.selectKeyWrapAlgorithm, IMessageProvider.INFORMATION);
        return;
    }
    if (!tID.getText().equals("")) {
        if (ids != null && ids.length > 0) {
            boolean uniqueId = Utils.ensureIdIsUnique(tID.getText(), ids);

            if (!uniqueId) {
                updateStatus(Messages.ambiguousEncryptionId, IMessageProvider.ERROR);
                return;
            }
        }
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageCreateKey.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *//*from  w  w w  .jav a 2s  .  c o  m*/
private void dialogChanged() {
    if (tKeystore.getText().length() == 0) {
        updateStatus(Messages.selectKeystoreFileToExtend, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystorePassword.getText().length() == 0) {
        updateStatus(Messages.enterKeystorePassword, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyName.getText().length() < IGlobals.KEY_NAME_MIN_SIZE
            || tKeyName.getText().length() > IGlobals.KEY_NAME_MAX_SIZE) {
        updateStatus(Messages.enterNewKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() < IGlobals.KEY_PASSWORD_MIN_SIZE
            || tKeyPassword.getText().length() > IGlobals.KEY_PASSWORD_MAX_SIZE) {
        updateStatus(Messages.enterNewKeyPassword, IMessageProvider.INFORMATION);
        return;
    }

    try {
        keystore = new Keystore(tKeystore.getText(), tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE);
        keystore.load();

        if (keystore.containsKey(tKeyName.getText())) {
            updateStatus(Messages.existingKeyName, IMessageProvider.NONE);
            return;
        }
    } catch (Exception ex) {
        updateStatus(Messages.verifyAll, IMessageProvider.NONE);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageCreateKeystore.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *//*w  w w . j  a va  2s  . c om*/
private void dialogChanged() {
    if (tKeystore.getText().length() > 0) {
        keystoreName = tKeystore.getText() + IGlobals.KEYSTORE_EXTENSION;
        keystorePath = DirectoryService.getUserHomeDir() + System.getProperty("file.separator") + keystoreName; //$NON-NLS-1$

        File tempFile = new File(keystorePath);
        if (tempFile.exists()) {
            updateStatus(Messages.keystoreAlreadyExists, IMessageProvider.ERROR);
            return;
        }
    } else {
        updateStatus(Messages.enterNewKeystoreName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystorePassword.getText().length() < IGlobals.KEYSTORE_PASSWORD_MIN_SIZE) {
        updateStatus(Messages.enterNewKeystorePassword, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyName.getText().length() < IGlobals.KEY_NAME_MIN_SIZE
            || tKeyName.getText().length() > IGlobals.KEY_NAME_MAX_SIZE) {
        updateStatus(Messages.enterNewKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() < IGlobals.KEY_PASSWORD_MIN_SIZE
            || tKeyPassword.getText().length() > IGlobals.KEY_PASSWORD_MAX_SIZE) {
        updateStatus(Messages.enterNewKeyPassword, IMessageProvider.INFORMATION);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageKey.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *///  w  w w .ja v  a  2s .co  m
private void dialogChanged() {
    if (tKeyName.getText().length() == 0) {
        updateStatus(Messages.enterKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() == 0) {
        updateStatus(Messages.enterKeyPassword, IMessageProvider.INFORMATION);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageOpenKey.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *//*from  w  w  w.  j a  v  a  2 s . c  om*/
private void dialogChanged() {
    if (tKeystore.getText().length() == 0) {
        updateStatus(Messages.selectKeystoreFile, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystorePassword.getText().length() == 0) {
        updateStatus(Messages.enterKeystorePassword, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyName.getText().length() == 0) {
        updateStatus(Messages.enterKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() == 0) {
        updateStatus(Messages.enterKeyPassword, IMessageProvider.INFORMATION);
        return;
    }
    if (new File(tKeystore.getText()).exists()) {
        try {
            keystore = new Keystore(tKeystore.getText(), tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE);
            keystore.load();
            if (!keystore.containsKey(tKeyName.getText())) {
                updateStatus(Messages.verifyKeyName, IMessageProvider.ERROR);
                return;
            }

            if (keystore.getSecretKey(tKeyName.getText(), tKeyPassword.getText().toCharArray()) == null) {
                updateStatus(Messages.verifyKeyPassword, IMessageProvider.ERROR);
                return;
            }
        } catch (Exception ex) {
            updateStatus(Messages.verifyAll, IMessageProvider.ERROR);
            return;
        }
    } else {
        updateStatus(Messages.keystoreNotFound, IMessageProvider.ERROR);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.encrypt.PageResource.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *///  w w w. j av a  2  s  .com
private void dialogChanged() {
    if (globalError) {
        return;
    }

    if (bXpath.getSelection() && tXpath.getText().length() == 0) {
        updateStatus(Messages.enterXPath, IMessageProvider.INFORMATION);
        return;
    } else if (bXpath.getSelection() && tXpath.getText().length() > 0) {
        String xpathValidator = Utils.validateXPath(doc, tXpath.getText());
        if (xpathValidator.equals("none")) { //$NON-NLS-1$
            updateStatus(Messages.xpathNoElement, IMessageProvider.ERROR);
            return;
        } else if (xpathValidator.equals("multiple")) { //$NON-NLS-1$
            updateStatus(Messages.xpathMultipleElements, IMessageProvider.ERROR);
            return;
        } else if (xpathValidator.equals("attribute")) { //$NON-NLS-1$
            updateStatus(Messages.xpathAttribute, IMessageProvider.ERROR);
            return;
        }
    }
    if (bDetached.getSelection() && tDetachedFile.getText().length() == 0) {
        updateStatus(Messages.detachedFile, IMessageProvider.INFORMATION);
        return;
    } else if (bDetached.getSelection() && tDetachedFile.getText().length() > 0) {
        File tempFile = new File(tDetachedFile.getText());
        if (!tempFile.exists()) {
            updateStatus(Messages.verifyDetachedFile, IMessageProvider.ERROR);
            return;
        }
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.sign.PageAlgorithms.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 */// ww w .  ja  v a2 s .  c o  m
private void dialogChanged() {
    if (cCanon.getText().equals("")) { //$NON-NLS-1$
        updateStatus(Messages.selectCanonicalization, IMessageProvider.INFORMATION);
        return;
    } else if (cTransform.getText().equals("")) { //$NON-NLS-1$
        updateStatus(Messages.selectTransformation, IMessageProvider.INFORMATION);
        return;
    } else if (cMDA.getText().equals("")) { //$NON-NLS-1$
        updateStatus(Messages.selectMessageDigest, IMessageProvider.INFORMATION);
        return;
    } else if (cSign.getText().equals("")) { //$NON-NLS-1$
        updateStatus(Messages.selectSignature, IMessageProvider.INFORMATION);
        return;
    }
    if (!tId.getText().equals("")) {
        if (ids != null && ids.length > 0) {
            boolean uniqueId = Utils.ensureIdIsUnique(tId.getText(), ids);

            if (!uniqueId) {
                updateStatus(Messages.ambiguousSignatureId, IMessageProvider.ERROR);
                return;
            }
        }
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.sign.PageCreateKey.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *///from   ww  w.j av a 2  s  .c  o  m
private void dialogChanged() {
    if (tCommonName.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText()); //$NON-NLS-1$
    } else {
        lPreview.setText(""); //$NON-NLS-1$
        updateStatus(Messages.enterCommonName, IMessageProvider.INFORMATION);
        return;
    }
    if (tOrganizationalUnit.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText()); //$NON-NLS-2$
    }
    if (tOrganization.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-2$
                + ", O=" + tOrganization.getText()); //$NON-NLS-1$
    }
    if (tLocation.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-2$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText()); //$NON-NLS-2$
    }
    if (tState.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-1$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText() //$NON-NLS-1$
                + ", ST=" + tState.getText()); //$NON-NLS-1$
    }
    if (tCountry.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-1$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText() //$NON-NLS-1$
                + ", ST=" + tState.getText() //$NON-NLS-1$
                + ", C=" + tCountry.getText()); //$NON-NLS-1$
    }
    if (tKeyName.getText().length() < IGlobals.KEY_NAME_MIN_SIZE) {
        updateStatus(Messages.enterNewKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() < IGlobals.KEY_PASSWORD_MIN_SIZE) {
        updateStatus(Messages.enterNewKeyPassword, IMessageProvider.INFORMATION);
        return;
    }
    if (cKeyAlgorithm.getSelectionIndex() < 0) {
        updateStatus(Messages.selectKeyAlgorithm, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystore.getText().length() == 0) {
        updateStatus(Messages.selectKeystoreForInsert, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystorePassword.getText().length() == 0) {
        updateStatus(Messages.enterKeystorePassword, IMessageProvider.INFORMATION);
        return;
    }

    if (tKeystore.getText().length() > 0 && tKeystorePassword.getText().length() > 0
            && tKeyName.getText().length() > 0) {
        String file = tKeystore.getText();
        keystoreName = file.substring(file.lastIndexOf(System.getProperty("file.separator")) + 1);

        try {
            keystore = new Keystore(file, tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE);
            boolean loaded = keystore.load();

            if (loaded) {
                if (keystore.containsKey(tKeyName.getText())) {
                    updateStatus(Messages.keyExistsInKeystore, IMessageProvider.ERROR);
                    return;
                }
            } else {
                updateStatus(Messages.verifyKeystorePassword, IMessageProvider.ERROR);
                return;
            }
        } catch (Exception e) {
            updateStatus(Messages.verifyAll, IMessageProvider.ERROR);
            return;
        }
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.sign.PageCreateKeystore.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *///  ww  w.j  ava 2  s  .  c om
private void dialogChanged() {
    if (tCommonName.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText()); //$NON-NLS-1$
    } else {
        lPreview.setText(""); //$NON-NLS-1$
        updateStatus(Messages.enterCommonName, IMessageProvider.INFORMATION);
        return;
    }
    if (tOrganizationalUnit.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText()); //$NON-NLS-2$
    }
    if (tOrganization.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-2$
                + ", O=" + tOrganization.getText()); //$NON-NLS-1$
    }
    if (tLocation.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-2$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText()); //$NON-NLS-2$
    }
    if (tState.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-1$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText() //$NON-NLS-1$
                + ", ST=" + tState.getText()); //$NON-NLS-1$
    }
    if (tCountry.getText().length() > 0) {
        lPreview.setText("CN=" + tCommonName.getText() //$NON-NLS-1$
                + ", OU=" + tOrganizationalUnit.getText() //$NON-NLS-1$
                + ", O=" + tOrganization.getText() //$NON-NLS-1$
                + ", L=" + tLocation.getText() //$NON-NLS-1$
                + ", ST=" + tState.getText() //$NON-NLS-1$
                + ", C=" + tCountry.getText()); //$NON-NLS-1$
    }
    if (tKeyName.getText().length() < IGlobals.KEY_NAME_MIN_SIZE) {
        updateStatus(Messages.enterNewKeyName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeyPassword.getText().length() < IGlobals.KEY_PASSWORD_MIN_SIZE) {
        updateStatus(Messages.enterNewKeyPassword, IMessageProvider.INFORMATION);
        return;
    }
    if (cKeyAlgorithm.getSelectionIndex() < 0) {
        updateStatus(Messages.selectKeyAlgorithm, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystoreName.getText().length() > 0) {
        keystoreName = tKeystoreName.getText() + ".jks"; //$NON-NLS-1$
        keystorePath = DirectoryService.getUserHomeDir() + System.getProperty("file.separator") + keystoreName; //$NON-NLS-1$

        File tempFile = new File(keystorePath);
        if (tempFile.exists()) {
            updateStatus(Messages.keystoreAlreadyExists, IMessageProvider.ERROR);
            return;
        }
    } else {
        updateStatus(Messages.enterNewKeystoreName, IMessageProvider.INFORMATION);
        return;
    }
    if (tKeystorePassword.getText().length() < IGlobals.KEYSTORE_PASSWORD_MIN_SIZE) {
        updateStatus(Messages.enterNewKeystorePassword, IMessageProvider.INFORMATION);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}

From source file:org.jcryptool.crypto.xml.ui.sign.PageKey.java

License:Open Source License

/**
 * Determines the (error) message for the missing field.
 *//*from  w w w  .  java  2 s . co m*/
private void dialogChanged() {
    if (keyAlias.getText().length() == 0) {
        updateStatus(Messages.selectKey, IMessageProvider.INFORMATION);
        return;
    }
    if (keyPassword.getText().length() == 0) {
        updateStatus(Messages.enterKeyPassword, IMessageProvider.INFORMATION);
        return;
    }

    updateStatus(null, IMessageProvider.NONE);
}