diff options
| author | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-06-28 02:33:06 -0700 |
|---|---|---|
| committer | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-06-28 02:33:06 -0700 |
| commit | cc69aaa3d4bce99ccd795296dd6bed8311c24fc8 (patch) | |
| tree | 7a2b3988e9c82d9c457f71824214ed8ebdcf5c05 /src/com.gluster.storage.management.gui | |
| parent | 0aa85e9e8b67492fbf26e761f54ca282539116e8 (diff) | |
| parent | eb58d91bb775a897c39ac7303993b361b48f35a9 (diff) | |
Merge pull request #83 from Dhandapani/master
Story #1: Rebalance Volume
Diffstat (limited to 'src/com.gluster.storage.management.gui')
| -rw-r--r-- | src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RebalanceVolumeAction.java | 37 |
1 files changed, 35 insertions, 2 deletions
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..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 @@ -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().rebalanceStart(volume.getName(), false, false, false); + showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] rebalance started successfully!"); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Volume rebalance could not be 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 |
