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.encrypt.PageAlgorithms.java
License:Open Source License
/** * Determines the (error) message for the missing field. */// www . j a v a 2s. 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 ww w . j a v a 2s .co 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.PageCreateKey.java
License:Open Source License
/** * Handles the events from this wizard page. * * @param e The triggered event/*from w w w.j ava 2 s . c o m*/ */ public void handleEvent(final Event e) { if (e.widget == bOpen) { openKeystore(); } else if (e.widget == bGenerate) { createKey(); updateStatus(null, IMessageProvider.NONE); } else if (e.widget == bEchoKeystorePassword) { echoPassword(e); } else if (e.widget == bEchoKeyPassword) { echoPassword(e); } else if (e.widget == cKeyAlgorithm) { // Combo Private Key Algorithm if (cKeyAlgorithm.getText().equalsIgnoreCase("AES")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_AES); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_AES[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("Blowfish")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_BLOWFISH); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_BLOWFISH[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("DES")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_DES); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_DES[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("DESede")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_DESEDE); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_DESEDE[0]); } else { cKeyAlgorithmSize.setItems(IAlgorithms.ENCRYPTION_KEY_ALGORITHMS_SIZES); cKeyAlgorithmSize.setText(IAlgorithms.ENCRYPTION_KEY_ALGORITHMS_SIZES[0]); } } }
From source file:org.jcryptool.crypto.xml.ui.encrypt.PageCreateKey.java
License:Open Source License
/** * Generates the key based on the entered data, inserts this key into the selected keystore * and shows the user an information notice about the result. *//* w w w. j a va 2 s .c om*/ private void createKey() { try { keystore = new Keystore(tKeystore.getText(), tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE); keystore.load(); SecretKey key = keystore.generateSecretKey(cKeyAlgorithm.getText(), Integer.parseInt(cKeyAlgorithmSize.getText())); generated = keystore.insertSecretKey(tKeyName.getText(), tKeyPassword.getText().toCharArray(), key); keystore.store(); } catch (NoSuchAlgorithmException ex) { generated = false; lResult.setText(Messages.keyGenerationFailed); } catch (Exception ex) { generated = false; lResult.setText(Messages.keyInsertionFailed); } if (generated) { String keystoreName = tKeystore.getText() .substring(tKeystore.getText().lastIndexOf(File.separator) + 1); lResult.setText(NLS.bind(Messages.keyGenerated, new Object[] { tKeyName.getText(), keystoreName })); 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 ww .j av a2s. com 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.PageCreateKeystore.java
License:Open Source License
/** * Handles the events from this wizard page. * * @param e The triggered event/*from ww w . j av a 2 s. co m*/ */ public void handleEvent(final Event e) { if (e.widget == bGenerate) { createKeystore(); updateStatus(null, IMessageProvider.NONE); } else if (e.widget == bEchoKeystorePassword) { echoPassword(e); } else if (e.widget == bEchoKeyPassword) { echoPassword(e); } else if (e.widget == cKeyAlgorithm) { // Combo Key Algorithm if (cKeyAlgorithm.getText().equalsIgnoreCase("AES")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_AES); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_AES[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("Blowfish")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_BLOWFISH); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_BLOWFISH[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("DES")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_DES); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_DES[0]); } else if (cKeyAlgorithm.getText().equalsIgnoreCase("DESede")) { //$NON-NLS-1$ cKeyAlgorithmSize.setItems(IAlgorithms.KEY_SIZES_DESEDE); cKeyAlgorithmSize.setText(IAlgorithms.KEY_SIZES_DESEDE[0]); } else { cKeyAlgorithmSize.setItems(IAlgorithms.ENCRYPTION_KEY_ALGORITHMS_SIZES); cKeyAlgorithmSize.setText(IAlgorithms.ENCRYPTION_KEY_ALGORITHMS_SIZES[0]); } } }
From source file:org.jcryptool.crypto.xml.ui.encrypt.PageCreateKeystore.java
License:Open Source License
/** * Generates the keystore and the key based on the entered data and shows the user an * information notice about the result.//from w w w . ja va2s . c o m */ private void createKeystore() { try { keystore = new Keystore(keystorePath, tKeystorePassword.getText(), IGlobals.KEYSTORE_TYPE); SecretKey key = keystore.generateSecretKey(cKeyAlgorithm.getText(), Integer.parseInt(cKeyAlgorithmSize.getText())); keystore.store(); keystore.load(); generated = keystore.insertSecretKey(tKeyName.getText(), tKeyPassword.getText().toCharArray(), key); keystore.store(); } catch (NoSuchAlgorithmException ex) { generated = false; lResult.setText(Messages.keyGenerationFailed); } catch (Exception ex) { Utils.logError(ex, "Encryption keystore generation failed"); //$NON-NLS-1$ generated = false; lResult.setText(Messages.keystoreGenerationFailed); } if (generated) { lResult.setText( NLS.bind(Messages.keystoreGenerated, new Object[] { tKeyName.getText(), keystoreName })); 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 ww .ja va 2 s.c o 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 ww .j a va2 s .c o m 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. *///ww w . j a v a2s .c o m 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); }