Source:
<code>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>(); <START> if (getEntity() != null) { <END> getAttachStorageCommand().setIsExecutionAllowed(true); } boolean isMasterPresent = false; boolean isISOPresent = false; boolean isBackupPresent = false; for (StorageDomain domain : items) { if (isDomainMasterAndActive(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)); }</code><technical_language>If if, do need if anymore</technical_language>

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>(); getAttachStorageCommand().setIsExecutionAllowed(true); boolean isMasterPresent = false; boolean isISOPresent = false; boolean isBackupPresent = false; for (StorageDomain domain : items) { if (isDomainMasterAndActive(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)); }