List of usage examples for org.eclipse.jface.dialogs IMessageProvider NONE
int NONE
To view the source code for org.eclipse.jface.dialogs IMessageProvider NONE.
Click Source Link
From source file:org.jcryptool.crypto.xml.ui.sign.PageAlgorithms.java
License:Open Source License
/** * Determines the (error) message for the missing field. *//*from ww w . ja va 2s.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 w w w . jav a2s .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 (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.PageCreateKey.java
License:Open Source License
/** * Handles the events from this wizard page. * * @param e The triggered event/*from w ww .j a va2 s .c o m*/ */ public void handleEvent(final Event e) { if (e.widget == bOpen) { openKeystore(); } else if (e.widget == bGenerate) { try { createKey(); updateStatus(null, IMessageProvider.NONE); } catch (Exception e1) { updateStatus(Messages.keyGenerationFailed, IMessageProvider.ERROR); } } else if (e.widget == bEchoKeystorePassword || e.widget == bEchoKeyPassword) { echoPassword(e); } }
From source file:org.jcryptool.crypto.xml.ui.sign.PageCreateKey.java
License:Open Source License
/** * Generates the key based on the entered data and displays the user an * information message about the generation result. * * @throws Exception to indicate any exceptional condition *///ww w . j a va 2 s.c o m private void createKey() throws Exception { HashMap<String, String> certificateData = new HashMap<String, String>(); certificateData.put("CN", tCommonName.getText()); //$NON-NLS-1$ certificateData.put("OU", tOrganizationalUnit.getText()); //$NON-NLS-1$ certificateData.put("O", tOrganization.getText()); //$NON-NLS-1$ certificateData.put("L", tLocation.getText()); //$NON-NLS-1$ certificateData.put("ST", tState.getText()); //$NON-NLS-1$ certificateData.put("C", tCountry.getText()); //$NON-NLS-1$ try { keystore = new Keystore(tKeystore.getText(), tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE); keystore.load(); KeyPair kp = keystore.generateKeyPair(cKeyAlgorithm.getText(), 512); // X500Principal subjectDN = Principal.generatePrincipal(certificateData); Certificate[] certs = new Certificate[1]; // certs[0] = new XmlSecurityCertificate(kp.getPublic(), subjectDN); generated = keystore.insertPrivateKey(tKeyName.getText(), tKeyPassword.getText().toCharArray(), kp.getPrivate(), certs); keystore.store(); } catch (NoSuchAlgorithmException ex) { generated = false; lResult.setText(Messages.keyGenerationFailed); } if (generated) { lResult.setText(NLS.bind(Messages.keyGenerated, keystoreName)); 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. */// w ww . j a v a 2s . 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 (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.PageCreateKeystore.java
License:Open Source License
/** * Handles the events from this wizard page. * * @param e The triggered event//from w w w . j a v a 2 s. c om */ public void handleEvent(final Event e) { if (e.widget == bGenerate) { createKeystore(); updateStatus(null, IMessageProvider.NONE); } else if (e.widget == bEchoKeystorePassword || e.widget == bEchoKeyPassword) { echoPassword(e); } }
From source file:org.jcryptool.crypto.xml.ui.sign.PageCreateKeystore.java
License:Open Source License
/** * Generates the keystore and the key/certificate based on the entered data and shows the user * an information text about the result. *//*from w ww. ja va 2 s . c o m*/ private void createKeystore() { HashMap<String, String> certificateData = new HashMap<String, String>(); certificateData.put("CN", tCommonName.getText()); //$NON-NLS-1$ certificateData.put("OU", tOrganizationalUnit.getText()); //$NON-NLS-1$ certificateData.put("O", tOrganization.getText()); //$NON-NLS-1$ certificateData.put("L", tLocation.getText()); //$NON-NLS-1$ certificateData.put("ST", tState.getText()); //$NON-NLS-1$ certificateData.put("C", tCountry.getText()); //$NON-NLS-1$ try { keystore = new Keystore(keystorePath, tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE); keystore.store(); keystore.load(); KeyPair kp = keystore.generateKeyPair(cKeyAlgorithm.getText(), 512); // X500Principal subjectDN = Principal.generatePrincipal(certificateData); Certificate[] certs = new Certificate[1]; // certs[0] = new XmlSecurityCertificate(kp.getPublic(), subjectDN); generated = keystore.insertPrivateKey(tKeyName.getText(), tKeyPassword.getText().toCharArray(), kp.getPrivate(), certs); keystore.store(); } catch (NoSuchAlgorithmException ex) { generated = false; lResult.setText(Messages.keyGenerationFailed); } catch (Exception ex) { Utils.logError(ex, "Signature keystore generation failed"); //$NON-NLS-1$ generated = false; lResult.setText(Messages.keystoreGenerationFailed); } if (generated) { lResult.setText(NLS.bind(Messages.keystoreGenerated, new Object[] { keystoreName, DirectoryService.getUserHomeDir() })); 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. */// w w w .j ava 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); }
From source file:org.jcryptool.crypto.xml.ui.sign.PageOpenKey.java
License:Open Source License
/** * Determines the (error) message for the missing field. *//*from w ww.j a va 2 s. c om*/ private void dialogChanged() { if (tKeystore.getText().length() == 0) { updateStatus(Messages.selectKeyFile, 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); boolean loaded = keystore.load(); if (loaded) { if (keystore.containsKey(tKeyName.getText())) { if (keystore.getPrivateKey(tKeyName.getText(), tKeyPassword.getText().toCharArray()) == null) { updateStatus(Messages.verifyKeyPassword, IMessageProvider.ERROR); return; } } else { updateStatus(Messages.verifyKeyName, IMessageProvider.ERROR); return; } } else { updateStatus(Messages.verifyKeystorePassword, 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.sign.PageResource.java
License:Open Source License
/** * Determines the (error) message for the missing field. *//*from w w w .j av a2s .c o m*/ private void dialogChanged() { if (globalError) { return; } if (bXpath.getSelection() && tXpath.getText().isEmpty()) { updateStatus(Messages.enterXPath, IMessageProvider.INFORMATION); return; } else if (bXpath.getSelection() && !tXpath.getText().isEmpty()) { 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().isEmpty()) { updateStatus(Messages.detachedFile, IMessageProvider.INFORMATION); return; } else if (bDetached.getSelection() && !tDetachedFile.getText().isEmpty()) { File tempFile = new File(tDetachedFile.getText()); if (!tempFile.exists()) { updateStatus(Messages.verifyDetachedFile, IMessageProvider.ERROR); return; } } updateStatus(null, IMessageProvider.NONE); }