private void onRemove() { RemoveDiskModel model = (RemoveDiskModel) getWindow(); ArrayList<VdcActionParametersBase> paramerterList = new ArrayList<>(); for (Object item : getSelectedItems()) { DiskImage disk = (DiskImage) item; VdcActionParametersBase parameters = new RemoveDiskParameters(disk.getId(), getEntity().getId()); paramerterList.add(parameters); } model.startProgress(); Frontend.getInstance() .runMultipleAction( VdcActionType.RemoveDisk, paramerterList, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { StorageDiskListModel localModel = (StorageDiskListModel) result.getState(); localModel.stopProgress(); cancel(); } }, this); }
private void remove() { if (getWindow() != null) { return; } RemoveDiskModel model = new RemoveDiskModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().removeDisksTitle()); model.setHelpTag(HelpTag.remove_disk); model.setHashName("remove_disk"); // $NON-NLS-1$ model.getLatch().setIsAvailable(false); ArrayList<DiskModel> items = new ArrayList<>(); for (Object item : getSelectedItems()) { DiskImage disk = (DiskImage) item; DiskModel diskModel = new DiskModel(); diskModel.setDisk(disk); items.add(diskModel); } model.setItems(items); UICommand onRemoveCommand = UICommand.createDefaultOkUiCommand("OnRemove", this); // $NON-NLS-1$ model.getCommands().add(onRemoveCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this); // $NON-NLS-1$ model.getCommands().add(cancelCommand); }