diff options
| author | Selvasundaram <selvam@gluster.com> | 2011-07-01 19:01:12 +0530 |
|---|---|---|
| committer | Selvasundaram <selvam@gluster.com> | 2011-07-04 19:04:45 +0530 |
| commit | 45ca89a241e826d80802d9e3e93d28f8cd026316 (patch) | |
| tree | 18c55746975a6369f404a07d1c1045643bfa0b4b /src/com.gluster.storage.management.gui | |
| parent | 2c4ea3418784160bdf4f186b2488e974465161e7 (diff) | |
Task updates in UI
Diffstat (limited to 'src/com.gluster.storage.management.gui')
23 files changed, 238 insertions, 357 deletions
diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml index 5b18421f..b0dfa9a9 100644 --- a/src/com.gluster.storage.management.gui/plugin.xml +++ b/src/com.gluster.storage.management.gui/plugin.xml @@ -476,7 +476,7 @@ visible="false"> <action allowLabelUpdate="false" - class="com.gluster.storage.management.gui.actions.MigrateDiskAction" + class="com.gluster.storage.management.gui.actions.MigrateBrickAction" definitionId="com.gluster.storage.management.gui.commands.MigrateDisk" icon="icons/disk-migrate.png" id="com.gluster.storage.management.gui.actions.MigrateDiskAction" @@ -593,7 +593,7 @@ </action> <action allowLabelUpdate="false" - class="com.gluster.storage.management.gui.actions.RemoveDiskAction" + class="com.gluster.storage.management.gui.actions.RemoveBrickAction" definitionId="com.gluster.storage.management.gui.commands.RemoveDisk" icon="icons/disk.png" id="com.gluster.storage.management.gui.actions.RemoveDiskAction" @@ -609,7 +609,7 @@ </action> <action allowLabelUpdate="false" - class="com.gluster.storage.management.gui.actions.AddDiskAction" + class="com.gluster.storage.management.gui.actions.AddBrickAction" definitionId="com.gluster.storage.management.gui.commands.AddDisk" icon="icons/disk.png" id="com.gluster.storage.management.gui.actions.AddDiskAction" @@ -659,7 +659,7 @@ definitionId="com.gluster.storage.management.gui.commands.Commit" icon="icons/stop.png" id="com.gluster.storage.management.gui.actions.Commit" - label="&Commit TaskTask" + label="&Commit Task" menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster" mode="FORCE_TEXT" pulldown="false" @@ -1206,7 +1206,7 @@ objectClass="com.gluster.storage.management.core.model.Volume"> <action allowLabelUpdate="false" - class="com.gluster.storage.management.gui.actions.MigrateDiskAction" + class="com.gluster.storage.management.gui.actions.MigrateBrickAction" definitionId="com.gluster.storage.management.gui.commands.MigrateDisk" enablesFor="1" icon="icons/disk-migrate.png" diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AbstractActionDelegate.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AbstractActionDelegate.java index 859d76db..6498d902 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AbstractActionDelegate.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AbstractActionDelegate.java @@ -18,8 +18,6 @@ *******************************************************************************/ package com.gluster.storage.management.gui.actions; -import java.util.Set; - import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; @@ -31,13 +29,13 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.internal.UIPlugin; import com.gluster.storage.management.core.model.Entity; -import com.gluster.storage.management.gui.utils.GUIHelper; /** * All action delegates in the application should extend from this class. It provides common functionality of grabbing * the Window object on initialization and extracting the selected entity in case of selection change on the navigation * tree. */ +@SuppressWarnings("restriction") public abstract class AbstractActionDelegate implements IWorkbenchWindowActionDelegate { protected IWorkbenchWindow window; @@ -56,7 +54,7 @@ public abstract class AbstractActionDelegate implements IWorkbenchWindowActionDe }); } - abstract protected void performAction(IAction action); + abstract protected void performAction(final IAction action); @Override public void selectionChanged(IAction action, ISelection selection) { diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddDiskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddBrickAction.java index cc57c541..e86164ec 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddDiskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddBrickAction.java @@ -1,5 +1,5 @@ /** - * AddDiskAction.java + * AddBrickAction.java * * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> * This file is part of Gluster Management Console. @@ -24,53 +24,33 @@ package com.gluster.storage.management.gui.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.core.model.Volume; -import com.gluster.storage.management.gui.dialogs.AddDiskWizard; +import com.gluster.storage.management.gui.dialogs.AddBrickWizard; -public class AddDiskAction extends AbstractActionDelegate { +public class AddBrickAction extends AbstractActionDelegate { private Volume volume; private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() - */ @Override public void dispose() { window = null; } - /* (non-Javadoc) - * @see com.gluster.storage.management.gui.actions.AbstractActionDelegate#performAction(org.eclipse.jface.action.IAction) - */ @Override protected void performAction(IAction action) { - //TODO: open a dialog box - // MessageDialog.openInformation(getShell(), "Action captured", action.getDescription() + "\n" + volume.getName()); - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - AddDiskWizard wizard = new AddDiskWizard(volume); // Also add single page - - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.create(); - dialog.getShell().setSize(1024, 600); - dialog.open(); - } - }); + // TODO: open a dialog box + // MessageDialog.openInformation(getShell(), "Action captured", action.getDescription() + "\n" + + // volume.getName()); + AddBrickWizard wizard = new AddBrickWizard(volume); // Also add single page + + WizardDialog dialog = new WizardDialog(getShell(), wizard); + dialog.create(); + dialog.getShell().setSize(1024, 600); + dialog.open(); } - - /* - * (non-Javadoc) - * - * @see - * com.gluster.storage.management.gui.actions.AbstractActionDelegate#selectionChanged(org.eclipse.jface.action.IAction - * , org.eclipse.jface.viewers.ISelection) - */ @Override public void selectionChanged(IAction action, ISelection selection) { super.selectionChanged(action, selection); diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddServerAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddServerAction.java index 4d1a87c9..0e6cd6b2 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddServerAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/AddServerAction.java @@ -30,8 +30,6 @@ import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.client.GlusterServersClient; import com.gluster.storage.management.core.constants.CoreConstants; import com.gluster.storage.management.core.model.Server; -import com.gluster.storage.management.core.model.Status; -import com.gluster.storage.management.core.response.GlusterServerResponse; import com.gluster.storage.management.gui.utils.GUIHelper; public class AddServerAction extends AbstractActionDelegate { @@ -52,37 +50,24 @@ public class AddServerAction extends AbstractActionDelegate { String partErrMsg = ""; for (Server server : selectedServers) { guiHelper.setStatusMessage("Adding server [" + server.getName() + "]..."); - + try { glusterServersClient.addServer(server); modelManager.removeDiscoveredServer(server); modelManager.addGlusterServer(glusterServersClient.getGlusterServer(server.getName())); successServers.add(server); - } catch(Exception e) { + } catch (Exception e) { // TODO: Handle error conditions } - -// Status status = response.getStatus(); -// if (status.isSuccess()) { -// modelManager.removeDiscoveredServer(server); -// modelManager.addGlusterServer(response.getGlusterServer()); -// successServers.add(server); -// } else if (status.isPartSuccess()) { -// modelManager.removeDiscoveredServer(server); -// modelManager.addGlusterServer(response.getGlusterServer()); -// partSuccessServers.add(server); -// partErrMsg += "[" + server.getName() + "] : " + status; -// } else { -// errMsg += "[" + server.getName() + "] : " + status; -// } } guiHelper.clearStatusMessage(); - showStatusMessage(action.getDescription(), selectedServers, successServers, partSuccessServers, errMsg, partErrMsg); + showStatusMessage(action.getDescription(), selectedServers, successServers, partSuccessServers, errMsg, + partErrMsg); } }; - - BusyIndicator.showWhile(Display.getDefault(), new Runnable() { + + BusyIndicator.showWhile(Display.getDefault(), new Runnable() { @Override public void run() { Display.getDefault().asyncExec(addServerThread); diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ClearTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ClearTaskAction.java index f1eb8a94..6fff4f44 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ClearTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ClearTaskAction.java @@ -2,7 +2,6 @@ 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.GlusterDataModelManager; import com.gluster.storage.management.client.TasksClient; @@ -15,23 +14,15 @@ public class ClearTaskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); - - try { - new TasksClient().resumeTask(taskInfo.getName()); - // TODO Update taskInfo in the model - // modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); - modelManager.removeTask(taskInfo); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Task [" + taskInfo.getName() + "] could not be cleared! Error: [" + e.getMessage() + "]"); - } - } - }); + final String actionDesc = action.getDescription(); + + try { + new TasksClient().resumeTask(taskInfo.getName()); + modelManager.removeTask(taskInfo); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Task [" + taskInfo.getName() + "] could not be cleared! Error: [" + e.getMessage() + "]"); + } } @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java index 9655b2b3..86e3032e 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java @@ -2,13 +2,14 @@ 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.GlusterDataModelManager; import com.gluster.storage.management.client.TasksClient; +import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Status; import com.gluster.storage.management.core.model.TaskInfo; import com.gluster.storage.management.core.model.TaskStatus; +import com.gluster.storage.management.core.model.Volume; public class CommitTaskAction extends AbstractActionDelegate { private TaskInfo taskInfo; @@ -16,23 +17,20 @@ public class CommitTaskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); - - try { - new TasksClient().commitTask(taskInfo.getName()); - taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_SUCCESS, taskInfo.getName() - + " is commited"))); - modelManager.updateTask(taskInfo); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Task [" + taskInfo.getName() + "] could not be Stopped! Error: [" + e.getMessage() + "]"); - } - } - }); + final String actionDesc = action.getDescription(); + try { + new TasksClient().commitTask(taskInfo.getName()); + taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_SUCCESS, "Committed"))); + modelManager.removeTask(taskInfo); + Volume volume = (new VolumesClient()).getVolume(taskInfo.getReference()); + modelManager.updateVolumeBricks(modelManager.getModel().getCluster().getVolume(taskInfo.getReference()), + volume.getBricks()); + + showInfoDialog(actionDesc, "Commit successful"); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Task [" + taskInfo.getName() + "] could not be Committed! Error: [" + e.getMessage() + "]"); + } } @Override @@ -41,7 +39,7 @@ public class CommitTaskAction extends AbstractActionDelegate { action.setEnabled(false); if (selectedEntity instanceof TaskInfo) { taskInfo = (TaskInfo) selectedEntity; - action.setEnabled(taskInfo.canCommit() + action.setEnabled(taskInfo.getCommitSupported() && taskInfo.getStatus().getCode() == Status.STATUS_CODE_COMMIT_PENDING); } } @@ -50,5 +48,4 @@ public class CommitTaskAction extends AbstractActionDelegate { public void dispose() { } - } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java index 1b412617..2cfa0916 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java @@ -33,27 +33,21 @@ import com.gluster.storage.management.gui.dialogs.CreateVolumeWizard; public class CreateVolumeAction extends AbstractActionDelegate { @Override protected void performAction(IAction action) { - Display.getDefault().asyncExec(new Runnable() { - + CreateVolumeWizard wizard = new CreateVolumeWizard(); + + WizardDialog dialog = new WizardDialog(getShell(), wizard) { @Override - public void run() { - CreateVolumeWizard wizard = new CreateVolumeWizard(); - - WizardDialog dialog = new WizardDialog(getShell(), wizard) { - @Override - protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { - Button button = super.createButton(parent, id, label, defaultButton); - if(id == IDialogConstants.FINISH_ID) { - button.setText("&Create"); - } - return button; - } - }; - dialog.create(); - dialog.getShell().setSize(500, 550); - dialog.open(); + protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { + Button button = super.createButton(parent, id, label, defaultButton); + if (id == IDialogConstants.FINISH_ID) { + button.setText("&Create"); + } + return button; } - }); + }; + dialog.create(); + dialog.getShell().setSize(500, 550); + dialog.open(); } @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java index eca8e789..0d61b21f 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java @@ -21,11 +21,9 @@ package com.gluster.storage.management.gui.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.widgets.Display; import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.client.VolumesClient; -import com.gluster.storage.management.core.model.Status; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; import com.gluster.storage.management.gui.IImageKeys; @@ -37,66 +35,57 @@ public class DeleteVolumeAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { + final String actionDesc = action.getDescription(); - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - - final String actionDesc = action.getDescription(); + String warningMessage; + if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { + warningMessage = "Are you sure to delete the Volume[" + volume.getName() + "] ?"; + } else { + warningMessage = "Volume [" + volume.getName() + "] is online, \nAre you sure to continue?"; + } - String warningMessage; - if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { - warningMessage = "Are you sure to delete the Volume[" + volume.getName() + "] ?"; - } else { - warningMessage = "Volume [" + volume.getName() + "] is online, \nAre you sure to continue?"; - } + Integer deleteOption = new MessageDialog(getShell(), "Delete Volume", GUIHelper.getInstance().getImage( + IImageKeys.VOLUME), warningMessage, MessageDialog.QUESTION, new String[] { "Cancel", + "Delete volume and data", "Delete volume, keep data" }, -1).open(); + if (deleteOption <= 0) { // By Cancel button(0) or Escape key(-1) + return; + } - Integer deleteOption = new MessageDialog(getShell(), "Delete Volume", GUIHelper.getInstance().getImage( - IImageKeys.VOLUME), warningMessage, MessageDialog.QUESTION, new String[] { "Cancel", - "Delete volume and data", "Delete volume, keep data" }, -1).open(); - if (deleteOption <= 0) { // By Cancel button(0) or Escape key(-1) - return; - } + VolumesClient client = new VolumesClient(); - VolumesClient client = new VolumesClient(); + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // To stop the volume service, if running + try { + client.stopVolume(volume.getName()); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Volume [" + volume.getName() + "] could not be stopped! Error: [" + e.getMessage() + "]"); + return; + } + } - Status status; - if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // To stop the volume service, if running - try { - client.stopVolume(volume.getName()); - } catch(Exception e) { - showErrorDialog(actionDesc, "Volume [" + volume.getName() + "] could not be stopped! Error: [" - + e.getMessage() + "]"); - return; - } - } + boolean confirmDelete = false; + if (deleteOption == 1) { + confirmDelete = true; + } - boolean confirmDelete = false; - if (deleteOption == 1) { - confirmDelete = true; - } + try { + client.deleteVolume(volume, confirmDelete); + showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] deleted successfully!"); + modelManager.deleteVolume(volume); + } catch (Exception e) { + showErrorDialog(actionDesc, e.getMessage()); - try { - client.deleteVolume(volume, confirmDelete); - showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] deleted successfully!"); - modelManager.deleteVolume(volume); - } catch(Exception e) { - showErrorDialog(actionDesc, e.getMessage()); - - // there is a possibility that the error was in post-delete operation, which means - // volume was deleted, but some other error happened. check if this is the case, - // and if so, update the model manager - if(client.volumeExists(volume.getName())) { - showErrorDialog(actionDesc, "Volume [" + volume.getName() + "] could not be deleted! Error: [" - + e.getMessage() + "]"); - } else { - modelManager.deleteVolume(volume); - showWarningDialog(actionDesc, "Volume deleted, but following error(s) occured: " + e.getMessage()); - } - } + // there is a possibility that the error was in post-delete operation, which means + // volume was deleted, but some other error happened. check if this is the case, + // and if so, update the model manager + if (client.volumeExists(volume.getName())) { + showErrorDialog(actionDesc, + "Volume [" + volume.getName() + "] could not be deleted! Error: [" + e.getMessage() + "]"); + } else { + modelManager.deleteVolume(volume); + showWarningDialog(actionDesc, "Volume deleted, but following error(s) occured: " + e.getMessage()); } - }); + } } @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java index d7f68646..226e4d00 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java @@ -34,20 +34,13 @@ import com.gluster.storage.management.gui.utils.GUIHelper; public class DownloadVolumeLogsAction extends AbstractActionDelegate { private GUIHelper guiHelper = GUIHelper.getInstance(); - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() - */ @Override public void dispose() { } - /* (non-Javadoc) - * @see com.gluster.storage.management.gui.actions.AbstractActionDelegate#performAction(org.eclipse.jface.action.IAction) - */ @Override protected void performAction(IAction action) { final VolumesClient client = new VolumesClient(); - final Runnable downloadLogsThread = new Runnable() { @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/MigrateDiskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/MigrateBrickAction.java index 56ea8179..41770d98 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/MigrateDiskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/MigrateBrickAction.java @@ -26,16 +26,16 @@ import org.eclipse.jface.wizard.WizardDialog; import com.gluster.storage.management.core.model.Brick; import com.gluster.storage.management.core.model.Volume; -import com.gluster.storage.management.gui.dialogs.MigrateDiskWizard; +import com.gluster.storage.management.gui.dialogs.MigrateBrickWizard; import com.gluster.storage.management.gui.utils.GUIHelper; -public class MigrateDiskAction extends AbstractActionDelegate { +public class MigrateBrickAction extends AbstractActionDelegate { private Volume volume; private Brick brick; @Override protected void performAction(IAction action) { - MigrateDiskWizard wizard = new MigrateDiskWizard(volume, brick); + MigrateBrickWizard wizard = new MigrateBrickWizard(volume, brick); WizardDialog dialog = new WizardDialog(window.getShell(), wizard); dialog.create(); @@ -61,7 +61,5 @@ public class MigrateDiskAction extends AbstractActionDelegate { @Override public void dispose() { - // TODO Auto-generated method stub - } } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/PauseTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/PauseTaskAction.java index b36b7855..e3a4b835 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/PauseTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/PauseTaskAction.java @@ -22,7 +22,6 @@ 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.GlusterDataModelManager; import com.gluster.storage.management.client.TasksClient; @@ -37,33 +36,25 @@ public class PauseTaskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); + final String actionDesc = action.getDescription(); - try { - new TasksClient().pauseTask(taskInfo.getName()); - taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_PAUSE, taskInfo.getName() - + " is Paused"))); - modelManager.updateTask(taskInfo); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Task [" + taskInfo.getName() + "] could not be Paused! Error: [" + e.getMessage() + "]"); - } - } - }); + try { + new TasksClient().pauseTask(taskInfo.getName()); + taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_PAUSE, "Paused"))); + modelManager.updateTask(taskInfo); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Task [" + taskInfo.getDescription() + "] could not be Paused! Error: [" + e.getMessage() + "]"); + } } - - + @Override public void selectionChanged(IAction action, ISelection selection) { super.selectionChanged(action, selection); action.setEnabled(false); if (selectedEntity instanceof TaskInfo) { taskInfo = (TaskInfo) selectedEntity; - action.setEnabled(taskInfo.canPause() && taskInfo.getStatus().getCode() == Status.STATUS_CODE_RUNNING); + action.setEnabled(taskInfo.getPauseSupported() && taskInfo.getStatus().getCode() == Status.STATUS_CODE_RUNNING); } } 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 33ca0e5b..a203dfb4 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 @@ -20,7 +20,6 @@ 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; @@ -30,22 +29,15 @@ public class RebalanceVolumeAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { + 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() + "]"); + } - 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 diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveDiskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveBrickAction.java index b79a4ee4..0f411a59 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveDiskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveBrickAction.java @@ -1,14 +1,12 @@ package com.gluster.storage.management.gui.actions; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Set; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchPart; @@ -16,15 +14,13 @@ import org.eclipse.ui.IWorkbenchPart; import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Brick; -import com.gluster.storage.management.core.model.GlusterServer; -import com.gluster.storage.management.core.model.Status; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.utils.StringUtil; import com.gluster.storage.management.gui.IImageKeys; import com.gluster.storage.management.gui.utils.GUIHelper; import com.gluster.storage.management.gui.views.VolumeBricksView; -public class RemoveDiskAction extends AbstractActionDelegate { +public class RemoveBrickAction extends AbstractActionDelegate { private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); private GUIHelper guiHelper = GUIHelper.getInstance(); private Set<Brick> bricks; @@ -33,48 +29,38 @@ public class RemoveDiskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { + final String actionDesc = action.getDescription(); + List<String> brickList = getBrickList(bricks); + Integer deleteOption = new MessageDialog(getShell(), "Remove Bricks(s)", GUIHelper.getInstance().getImage( + IImageKeys.VOLUME), "Are you sure you want to remove following bricks from volume [" + volume.getName() + + "] ? \n" + StringUtil.collectionToString(brickList, ", "), MessageDialog.QUESTION, new String[] { + "Cancel", "Remove bricks, delete data", "Remove bricks, keep data" }, -1).open(); + if (deleteOption <= 0) { // By Cancel button(0) or Escape key(-1) + return; + } - @Override + if (deleteOption == 1) { + confirmDelete = true; + } + BusyIndicator.showWhile(Display.getDefault(), new Runnable() { public void run() { + VolumesClient client = new VolumesClient(); + try { + client.removeBricks(volume.getName(), bricks, confirmDelete); + // Remove the bricks from the volume object + for (Brick brick : bricks) { + volume.removeBrick(brick); + } + // Update model with removed bricks in the volume + modelManager.removeBricks(volume, bricks); - final String actionDesc = action.getDescription(); - List<String> brickList = getBrickList(bricks); - Integer deleteOption = new MessageDialog(getShell(), "Remove Bricks(s)", GUIHelper.getInstance() - .getImage(IImageKeys.VOLUME), "Are you sure you want to remove following bricks from volume [" - + volume.getName() + "] ? \n" + StringUtil.collectionToString(brickList, ", "), - MessageDialog.QUESTION, new String[] { "Cancel", "Remove bricks, delete data", - "Remove bricks, keep data" }, -1).open(); - if (deleteOption <= 0) { // By Cancel button(0) or Escape key(-1) - return; - } - - if (deleteOption == 1) { - confirmDelete = true; + showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] bricks(s) removed successfully!"); + } catch (Exception e) { + showErrorDialog(actionDesc, "Volume [" + volume.getName() + + "] bricks(s) could not be removed! Error: [" + e.getMessage() + "]"); } - BusyIndicator.showWhile(Display.getDefault(), new Runnable() { - public void run() { - VolumesClient client = new VolumesClient(); - try { - client.removeBricks(volume.getName(), bricks, confirmDelete); - // Remove the bricks from the volume object - for (Brick brick : bricks) { - volume.removeBrick(brick); - } - // Update model with removed bricks in the volume - modelManager.removeBricks(volume, bricks); - - showInfoDialog(actionDesc, "Volume [" + volume.getName() - + "] bricks(s) removed successfully!"); - } catch (Exception e) { - showErrorDialog(actionDesc, "Volume [" + volume.getName() - + "] bricks(s) could not be removed! Error: [" + e.getMessage() + "]"); - } - } - }); } }); - } @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveServerAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveServerAction.java index 911c57a8..4862b7b1 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveServerAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/RemoveServerAction.java @@ -29,16 +29,12 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.PlatformUI; import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.client.GlusterServersClient; import com.gluster.storage.management.core.constants.CoreConstants; import com.gluster.storage.management.core.model.GlusterServer; -import com.gluster.storage.management.core.model.Status; import com.gluster.storage.management.gui.utils.GUIHelper; -import com.gluster.storage.management.gui.views.NavigationView; public class RemoveServerAction extends AbstractActionDelegate { private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ResumeTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ResumeTaskAction.java index fc80b04d..d8f1b955 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ResumeTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/ResumeTaskAction.java @@ -2,7 +2,6 @@ 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.GlusterDataModelManager; import com.gluster.storage.management.client.TasksClient; @@ -16,23 +15,16 @@ public class ResumeTaskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); - - try { - new TasksClient().resumeTask(taskInfo.getName()); - taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_RUNNING, taskInfo.getName() - + " is Resumed"))); - modelManager.updateTask(taskInfo); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Task [" + taskInfo.getName() + "] could not be Resumed! Error: [" + e.getMessage() + "]"); - } - } - }); + final String actionDesc = action.getDescription(); + + try { + new TasksClient().resumeTask(taskInfo.getName()); + taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_RUNNING, "Resumed"))); + modelManager.updateTask(taskInfo); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Task [" + taskInfo.getDescription() + "] could not be Resumed! Error: [" + e.getMessage() + "]"); + } } @Override @@ -47,9 +39,7 @@ public class ResumeTaskAction extends AbstractActionDelegate { @Override public void dispose() { - } - } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java index c259c661..322a87f9 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java @@ -53,13 +53,6 @@ public class StartVolumeAction extends AbstractActionDelegate { } - /* - * (non-Javadoc) - * - * @see - * com.gluster.storage.management.gui.actions.AbstractActionDelegate#selectionChanged(org.eclipse.jface.action.IAction - * , org.eclipse.jface.viewers.ISelection) - */ @Override public void selectionChanged(IAction action, ISelection selection) { super.selectionChanged(action, selection); diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopTaskAction.java index abde4e57..12d14b43 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopTaskAction.java @@ -16,22 +16,16 @@ public class StopTaskAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); - - try { - new TasksClient().resumeTask(taskInfo.getName()); - taskInfo.setStatus( new TaskStatus( new Status(Status.STATUS_CODE_SUCCESS, taskInfo.getName() + " is Stopped"))); - modelManager.updateTask(taskInfo); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Task [" + taskInfo.getName() + "] could not be Stopped! Error: [" + e.getMessage() + "]"); - } - } - }); + final String actionDesc = action.getDescription(); + + try { + new TasksClient().resumeTask(taskInfo.getName()); + taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_SUCCESS, "Stopped"))); + modelManager.updateTask(taskInfo); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Task [" + taskInfo.getDescription() + "] could not be Stopped! Error: [" + e.getMessage() + "]"); + } } @Override @@ -40,7 +34,7 @@ public class StopTaskAction extends AbstractActionDelegate { action.setEnabled(false); if (selectedEntity instanceof TaskInfo) { taskInfo = (TaskInfo) selectedEntity; - action.setEnabled(taskInfo.canStop() + action.setEnabled(taskInfo.getStopSupported() && (taskInfo.getStatus().getCode() == Status.STATUS_CODE_PAUSE || taskInfo.getStatus().getCode() == Status.STATUS_CODE_RUNNING)); } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java index d4e3d363..62c690e2 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java @@ -21,7 +21,6 @@ package com.gluster.storage.management.gui.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.widgets.Display; import com.gluster.storage.management.client.GlusterDataModelManager; import com.gluster.storage.management.client.VolumesClient; @@ -36,34 +35,28 @@ public class StopVolumeAction extends AbstractActionDelegate { @Override protected void performAction(final IAction action) { - Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - final String actionDesc = action.getDescription(); - if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { - showWarningDialog(actionDesc, "Volume [" + volume.getName() + "] is already offline!"); - return; // Volume already offline. Don't do anything. - } + final String actionDesc = action.getDescription(); + if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { + showWarningDialog(actionDesc, "Volume [" + volume.getName() + "] is already offline!"); + return; // Volume already offline. Don't do anything. + } - Integer deleteOption = new MessageDialog(getShell(), "Stop Volume", GUIHelper.getInstance().getImage( - IImageKeys.VOLUME), "Are you sure you want to stop the volume [" + volume.getName() + "] ?", - MessageDialog.QUESTION, new String[] { "No", "Yes" }, -1).open(); + Integer deleteOption = new MessageDialog(getShell(), "Stop Volume", GUIHelper.getInstance().getImage( + IImageKeys.VOLUME), "Are you sure you want to stop the volume [" + volume.getName() + "] ?", + MessageDialog.QUESTION, new String[] { "No", "Yes" }, -1).open(); - if (deleteOption <= 0) { - return; - } + if (deleteOption <= 0) { + return; + } - try { - new VolumesClient().stopVolume(volume.getName()); - showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] stopped successfully!"); - modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Volume [" + volume.getName() + "] could not be stopped! Error: [" + e.getMessage() + "]"); - } - } - }); + try { + new VolumesClient().stopVolume(volume.getName()); + showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] stopped successfully!"); + modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); + } catch (Exception e) { + showErrorDialog(actionDesc, + "Volume [" + volume.getName() + "] could not be stopped! Error: [" + e.getMessage() + "]"); + } } @Override diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddDiskPage.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddBrickPage.java index 48a46c84..961dca88 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddDiskPage.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddBrickPage.java @@ -39,7 +39,7 @@ import com.richclientgui.toolbox.duallists.IRemovableContentProvider; * @author root * */ -public class AddDiskPage extends WizardPage { +public class AddBrickPage extends WizardPage { private List<Disk> availableDisks = new ArrayList<Disk>(); private List<Disk> selectedDisks = new ArrayList<Disk>(); private Volume volume = null; @@ -51,7 +51,7 @@ public class AddDiskPage extends WizardPage { /** * @param pageName */ - protected AddDiskPage(Volume volume) { + protected AddBrickPage(Volume volume) { super(PAGE_NAME); this.volume = volume; setTitle("Add Brick"); diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddDiskWizard.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddBrickWizard.java index bb55ece1..bcb3ce3d 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddDiskWizard.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/AddBrickWizard.java @@ -38,18 +38,18 @@ import com.gluster.storage.management.core.utils.StringUtil; /** * */ -public class AddDiskWizard extends Wizard { - private AddDiskPage page; +public class AddBrickWizard extends Wizard { + private AddBrickPage page; private Volume volume; - public AddDiskWizard(Volume volume) { + public AddBrickWizard(Volume volume) { setWindowTitle("Gluster Management Console - Add Brick"); setHelpAvailable(false); // TODO: Introduce wizard help this.volume = volume; } public void addPages() { - page = new AddDiskPage(volume); + page = new AddBrickPage(volume); addPage(page); } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateDiskPage1.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickPage1.java index 4533ca23..f7ce744f 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateDiskPage1.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickPage1.java @@ -1,21 +1,24 @@ -/******************************************************************************* +/** + * MigrateBrickPage1.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 + * 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, + * + * 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.dialogs; import java.util.List; @@ -48,7 +51,7 @@ import com.gluster.storage.management.core.utils.NumberUtil; import com.gluster.storage.management.gui.TableLabelProviderAdapter; import com.gluster.storage.management.gui.utils.GUIHelper; -public class MigrateDiskPage1 extends WizardPage { +public class MigrateBrickPage1 extends WizardPage { private static final String PAGE_NAME = "migrate.disk.page.1"; private enum DISK_TABLE_COLUMN_INDICES { @@ -118,7 +121,7 @@ public class MigrateDiskPage1 extends WizardPage { /** * Create the wizard. */ - public MigrateDiskPage1(Volume volume, Brick brick) { + public MigrateBrickPage1(Volume volume, Brick brick) { super(PAGE_NAME); this.volume = volume; this.fromBrick = brick; diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateDiskWizard.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java index 2d65a869..4693726b 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateDiskWizard.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java @@ -30,12 +30,12 @@ import com.gluster.storage.management.core.model.Brick; import com.gluster.storage.management.core.model.TaskInfo; import com.gluster.storage.management.core.model.Volume; -public class MigrateDiskWizard extends Wizard { +public class MigrateBrickWizard extends Wizard { private Volume volume; private Brick brick; - private MigrateDiskPage1 page; + private MigrateBrickPage1 page; - public MigrateDiskWizard(Volume volume, Brick brick) { + public MigrateBrickWizard(Volume volume, Brick brick) { setWindowTitle("Gluster Management Console - Migrate Brick [" + volume.getName() + "]"); this.volume = volume; this.brick = brick; @@ -44,7 +44,7 @@ public class MigrateDiskWizard extends Wizard { @Override public void addPages() { - page = new MigrateDiskPage1(volume, brick); + page = new MigrateBrickPage1(volume, brick); addPage(page); } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java index ce68e22f..8d48af76 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java @@ -32,7 +32,10 @@ import org.eclipse.ui.IWorkbenchSite; import com.gluster.storage.management.core.model.ClusterListener; import com.gluster.storage.management.core.model.DefaultClusterListener; +import com.gluster.storage.management.core.model.Event; import com.gluster.storage.management.core.model.TaskInfo; +import com.gluster.storage.management.core.model.Volume; +import com.gluster.storage.management.core.model.Event.EVENT_TYPE; import com.gluster.storage.management.gui.TasksTableLabelProvider; public class TasksPage extends AbstractTableViewerPage<TaskInfo> { @@ -45,10 +48,9 @@ public class TasksPage extends AbstractTableViewerPage<TaskInfo> { private static final String[] TASK_TABLE_COLUMN_NAMES = new String[] { "Task", "Status"}; - @SuppressWarnings("unchecked") - public TasksPage(IWorkbenchSite site, Composite parent, int style, Object taskInfo) { + public TasksPage(IWorkbenchSite site, Composite parent, int style, List<TaskInfo> taskInfo) { super(site, parent, style, false, false, taskInfo); - this.taskInfoList = (List<TaskInfo>) taskInfo; + this.taskInfoList = taskInfo; } /* (non-Javadoc) @@ -67,10 +69,26 @@ public class TasksPage extends AbstractTableViewerPage<TaskInfo> { refreshViewer(); } + @Override + public void taskUpdated(TaskInfo taskInfo) { + refreshViewer(); + } + private void refreshViewer() { tableViewer.refresh(); parent.update(); } + + @Override + public void volumeChanged(Volume volume, Event event) { + super.volumeChanged(volume, event); + if (event.getEventType() == EVENT_TYPE.BRICK_REPLACED) { + if (!tableViewer.getControl().isDisposed()) { + tableViewer.refresh(); + } + } + } + }; } |
