From 4a85ffe9e19f1880f4e00468fdee56191babc818 Mon Sep 17 00:00:00 2001 From: Selvasundaram Date: Thu, 14 Jul 2011 20:40:29 +0530 Subject: Export SSH keys feature --- .../icons/tango/32x32/export-keys.png | Bin 0 -> 1194 bytes .../icons/tango/32x32/import-keys.png | Bin 0 -> 1998 bytes src/com.gluster.storage.management.gui/plugin.xml | 32 ++++++++- .../gui/actions/ExportSshKeysAction.java | 77 +++++++++++++++++++++ .../gui/actions/ImportSshKeysAction.java | 17 +++++ 5 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.png create mode 100644 src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.png create mode 100644 src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ExportSshKeysAction.java create mode 100644 src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ImportSshKeysAction.java (limited to 'src/com.gluster.storage.management.gui') diff --git a/src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.png b/src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.png new file mode 100644 index 00000000..16d47578 Binary files /dev/null and b/src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.png differ diff --git a/src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.png b/src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.png new file mode 100644 index 00000000..d7f0d0c3 Binary files /dev/null and b/src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.png differ diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml index e410b4b8..4f2ad2af 100644 --- a/src/com.gluster.storage.management.gui/plugin.xml +++ b/src/com.gluster.storage.management.gui/plugin.xml @@ -988,7 +988,7 @@ class="com.gluster.storage.management.gui.actions.ChangePasswordAction" definitionId="com.gluster.storage.management.gui.commands.ChangePassword" icon="icons/tango/32x32/change-password.png" - id="com.gluster.storage.management.gui.actions.AddServerAction" + id="com.gluster.storage.management.gui.actions.ChangePasswordAction" label="&Change Password" menubarPath="com.gluster.storage.management.gui.menu.edit/edit" mode="FORCE_TEXT" @@ -998,6 +998,36 @@ style="push" tooltip="Change password"> + + + + + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * . + */ +package com.gluster.storage.management.gui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; + +import com.gluster.storage.management.client.KeysClient; + +/** + * @author root + * + */ +public class ExportSshKeysAction extends AbstractActionDelegate { + + @Override + protected void performAction(IAction action) { + final KeysClient client = new KeysClient(); + final Runnable exportKeysThread = new Runnable() { + + @Override + public void run() { + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setFilterNames(new String[] {"Tar (*.tar)"}); + dialog.setFilterExtensions(new String[] {"*.tar"}); + String filePath = dialog.open(); + + if(filePath == null) { + return; + } + + String title = "Export SSH Keys"; + try { + client.exportSshKeys(filePath); + showInfoDialog(title, "SSH keys exported successfully to [" + filePath + "]"); + } catch(Exception e) { + showErrorDialog(title, e.getMessage()); + } + } + }; + + BusyIndicator.showWhile(Display.getDefault(), new Runnable() { + + @Override + public void run() { + Display.getDefault().asyncExec(exportKeysThread); + } + }); + } + + + @Override + public void dispose() { + } + +} diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ImportSshKeysAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ImportSshKeysAction.java new file mode 100644 index 00000000..8cedc920 --- /dev/null +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ImportSshKeysAction.java @@ -0,0 +1,17 @@ +package com.gluster.storage.management.gui.actions; + +import org.eclipse.jface.action.IAction; + +public class ImportSshKeysAction extends AbstractActionDelegate { + + + @Override + protected void performAction(IAction action) { + + } + + @Override + public void dispose() { + } + +} -- cgit