From b51fce37009145f91f0345b428eb297ad4691563 Mon Sep 17 00:00:00 2001 From: Dhandapani Date: Mon, 27 Jun 2011 16:21:16 +0530 Subject: Story #1: Rebalance Volume --- .../gui/actions/RebalanceVolumeAction.java | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'src/com.gluster.storage.management.gui') diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java index 5339beb0..9b55e70a 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java @@ -19,11 +19,44 @@ package com.gluster.storage.management.gui.actions; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Display; + +import com.gluster.storage.management.client.VolumesClient; +import com.gluster.storage.management.core.model.Volume; public class RebalanceVolumeAction extends AbstractActionDelegate { + private Volume volume; + + @Override + protected void performAction(final IAction action) { + + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + final String actionDesc = action.getDescription(); + try { + new VolumesClient().rebalanceVolume(volume.getName(), false, false, false); + showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] rebalance started successfully!"); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Volume rebalance cannot started on [" + volume.getName() + "]! Error: [" + e.getMessage() + "]"); + } + + } + }); + } + @Override - protected void performAction(IAction action) { - System.out.println("Running [" + this.getClass().getSimpleName() + "]"); + public void selectionChanged(IAction action, ISelection selection) { + super.selectionChanged(action, selection); + + action.setEnabled(false); + if (selectedEntity instanceof Volume) { + volume = (Volume) selectedEntity; + action.setEnabled(true); + } } @Override -- cgit From eb58d91bb775a897c39ac7303993b361b48f35a9 Mon Sep 17 00:00:00 2001 From: Dhandapani Date: Mon, 27 Jun 2011 16:21:16 +0530 Subject: Story #1: Rebalance Volume --- .../gluster/storage/management/gui/actions/RebalanceVolumeAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/com.gluster.storage.management.gui') diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java index 9b55e70a..33ca0e5b 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java @@ -37,11 +37,11 @@ public class RebalanceVolumeAction extends AbstractActionDelegate { public void run() { final String actionDesc = action.getDescription(); try { - new VolumesClient().rebalanceVolume(volume.getName(), false, false, false); + new VolumesClient().rebalanceStart(volume.getName(), false, false, false); showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] rebalance started successfully!"); } catch (Exception e) { showErrorDialog(actionDesc, - "Volume rebalance cannot started on [" + volume.getName() + "]! Error: [" + e.getMessage() + "]"); + "Volume rebalance could not be started on [" + volume.getName() + "]! Error: [" + e.getMessage() + "]"); } } -- cgit