Search in sources :

Example 1 with CommonPropertyDialog

use of org.jcryptool.crypto.keystore.ui.dialogs.CommonPropertyDialog in project core by jcryptool.

the class ShowPropertiesHandler method execute.

/*
     * (non-Javadoc)
     * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
     */
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    Object selectedNode = ((IStructuredSelection) selection).getFirstElement();
    CommonPropertyDialog keyDialog = null;
    if (selectedNode instanceof SecretKeyNode) {
        keyDialog = new ShowSecretKeyDialog(HandlerUtil.getActiveShell(event), (SecretKeyNode) selectedNode);
    } else if (selectedNode instanceof PrivateKeyNode) {
        keyDialog = new ShowSecretKeyDialog(HandlerUtil.getActiveShell(event), (PrivateKeyNode) selectedNode);
    } else if (selectedNode instanceof CertificateNode) {
        keyDialog = new ShowCertificateDialog(HandlerUtil.getActiveShell(event), (CertificateNode) selectedNode);
    } else {
        LogUtil.logError(KeyStorePlugin.PLUGIN_ID, "unsupported key node type");
        return null;
    }
    keyDialog.create();
    keyDialog.open();
    return null;
}
Also used : ShowSecretKeyDialog(org.jcryptool.crypto.keystore.ui.dialogs.ShowSecretKeyDialog) ShowCertificateDialog(org.jcryptool.crypto.keystore.ui.dialogs.ShowCertificateDialog) CommonPropertyDialog(org.jcryptool.crypto.keystore.ui.dialogs.CommonPropertyDialog) CertificateNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.CertificateNode) ISelection(org.eclipse.jface.viewers.ISelection) PrivateKeyNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.PrivateKeyNode) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SecretKeyNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.SecretKeyNode)

Aggregations

ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 CommonPropertyDialog (org.jcryptool.crypto.keystore.ui.dialogs.CommonPropertyDialog)1 ShowCertificateDialog (org.jcryptool.crypto.keystore.ui.dialogs.ShowCertificateDialog)1 ShowSecretKeyDialog (org.jcryptool.crypto.keystore.ui.dialogs.ShowSecretKeyDialog)1 CertificateNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.CertificateNode)1 PrivateKeyNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.PrivateKeyNode)1 SecretKeyNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.SecretKeyNode)1