summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.gui
diff options
context:
space:
mode:
authorSelvasundaram <selvam@gluster.com>2011-07-14 20:40:29 +0530
committerSelvasundaram <selvam@gluster.com>2011-07-14 20:40:29 +0530
commit4a85ffe9e19f1880f4e00468fdee56191babc818 (patch)
treea88061820614de7d36d408569c9ea7dcf0c4c2d9 /src/com.gluster.storage.management.gui
parent0c8eaa743eecf409e299a82080c629b744c44592 (diff)
Export SSH keys feature
Diffstat (limited to 'src/com.gluster.storage.management.gui')
-rw-r--r--src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.pngbin0 -> 1194 bytes
-rw-r--r--src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.pngbin0 -> 1998 bytes
-rw-r--r--src/com.gluster.storage.management.gui/plugin.xml32
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ExportSshKeysAction.java77
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ImportSshKeysAction.java17
5 files changed, 125 insertions, 1 deletions
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
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/icons/tango/32x32/export-keys.png
Binary files 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
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/icons/tango/32x32/import-keys.png
Binary files 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="&amp;Change Password"
menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
mode="FORCE_TEXT"
@@ -998,6 +998,36 @@
style="push"
tooltip="Change password">
</action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.ExportSshKeysAction"
+ definitionId="com.gluster.storage.management.gui.commands.ExportSshKeys"
+ icon="icons/tango/32x32/export-keys.png"
+ id="com.gluster.storage.management.gui.actions.ExportSshKeysAction"
+ label="&amp;Export Keys"
+ menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ tooltip="Export SSH keys">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.ImportSshKeysAction"
+ definitionId="com.gluster.storage.management.gui.commands.ImportSshKeys"
+ icon="icons/tango/32x32/import-keys.png"
+ id="com.gluster.storage.management.gui.actions.ImportSshKeysAction"
+ label="&amp;Import Keys"
+ menubarPath="com.gluster.storage.management.gui.menu.edit/edit"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ tooltip="Import SSH keys">
+ </action>
<menu
id="com.gluster.storage.management.gui.menu.edit"
label="&amp;Edit"
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ExportSshKeysAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ExportSshKeysAction.java
new file mode 100644
index 00000000..86f44d8e
--- /dev/null
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ExportSshKeysAction.java
@@ -0,0 +1,77 @@
+/**
+ * ExportSshKeysAction.java
+ *
+ * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
+ * 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
+ * <http://www.gnu.org/licenses/>.
+ */
+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() {
+ }
+
+}