Source:
private void updateActionAvailability() { ArrayList<StorageDomain> items = getItems() != null ? Linq.<StorageDomain> cast(getItems()) : new ArrayList<StorageDomain>(); ArrayList<StorageDomain> selectedItems = getSelectedItems() != null ? Linq.<StorageDomain> cast(getSelectedItems()) : new ArrayList<StorageDomain>(); if (getEntity() != null) { getAttachStorageCommand().setIsExecutionAllowed(!getEntity().isLocal()); } boolean isMasterPresents = false; boolean isISOPresents = false; boolean isBackupPresents = false; for (StorageDomain domain : items) { if (isMasterDomain(domain)) { isMasterPresents = true; } else if (domain.getStorageDomainType() == StorageDomainType.ISO) { isISOPresents = true; } else if (domain.getStorageDomainType() == StorageDomainType.ImportExport) { isBackupPresents = true; } if (isMasterPresents && isISOPresents && isBackupPresents) { break; } } getAttachISOCommand().setIsExecutionAllowed(false); getAttachISOCommand().setIsExecutionAllowed(items.size() > 0 && isMasterPresents && !isISOPresents); getAttachBackupCommand().setIsExecutionAllowed(items.size() > 0 && isMasterPresents && !isBackupPresents); getDetachCommand().setIsExecutionAllowed(selectedItems.size() > 0 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.DetachStorageDomainFromPool)); getActivateCommand().setIsExecutionAllowed(selectedItems.size() == 1 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.ActivateStorageDomain)); getMaintenanceCommand().setIsExecutionAllowed(selectedItems.size() == 1 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.DeactivateStorageDomainWithOvfUpdate)); }

Target:
private void updateActionAvailability() { ArrayList<StorageDomain> items = getItems() != null ? Linq.<StorageDomain> cast(getItems()) : new ArrayList<StorageDomain>(); ArrayList<StorageDomain> selectedItems = getSelectedItems() != null ? Linq.<StorageDomain> cast(getSelectedItems()) : new ArrayList<StorageDomain>(); if (getEntity() != null) { getAttachStorageCommand().setIsExecutionAllowed(!getEntity().isLocal()); } boolean isMasterPresent = false; boolean isISOPresent = false; boolean isBackupPresent = false; for (StorageDomain domain : items) { if (isMasterDomain(domain)) { isMasterPresent = true; } else if (domain.getStorageDomainType() == StorageDomainType.ISO) { isISOPresent = true; } else if (domain.getStorageDomainType() == StorageDomainType.ImportExport) { isBackupPresent = true; } if (isMasterPresent && isISOPresent && isBackupPresent) { break; } } getAttachISOCommand().setIsExecutionAllowed(false); getAttachISOCommand().setIsExecutionAllowed(items.size() > 0 && isMasterPresent && !isISOPresent); getAttachBackupCommand().setIsExecutionAllowed(items.size() > 0 && isMasterPresent && !isBackupPresent); getDetachCommand().setIsExecutionAllowed(selectedItems.size() > 0 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.DetachStorageDomainFromPool)); getActivateCommand().setIsExecutionAllowed(selectedItems.size() == 1 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.ActivateStorageDomain)); getMaintenanceCommand().setIsExecutionAllowed(selectedItems.size() == 1 && VdcActionUtils.canExecute(selectedItems, StorageDomain.class, VdcActionType.DeactivateStorageDomainWithOvfUpdate)); }