Source:
private void updateActionAvailability() { GlusterVolumeEntity volumeEntity = getEntity(); boolean allowRemove = true; boolean allowReplace = true; boolean allowAdvanced = true; boolean allowAdd = true; if (volumeEntity == null || volumeEntity.getVolumeType().isDispersedType() || !volumeEntity.getVolumeType().isSupported()) { allowRemove = false; allowAdd = false; } if (volumeEntity == null || getSelectedItems() == null || getSelectedItems().size() == 0) { allowRemove = false; allowReplace = false; allowAdvanced = false; } else { GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); if (volumeTask != null && (volumeTask.getStatus() == JobExecutionStatus.STARTED || volumeTask.getType() == GlusterTaskType.REMOVE_BRICK && volumeTask.getStatus() == JobExecutionStatus.FINISHED)) { allowRemove = false; } else if (volumeEntity.getVolumeType() == GlusterVolumeType.STRIPE || getSelectedItems().size() == volumeEntity.getBricks().size()) { allowRemove = false; } else if (volumeEntity.getVolumeType() == GlusterVolumeType.REPLICATE && (volumeEntity.getBricks().size() == VolumeListModel.REPLICATE_COUNT_DEFAULT || getSelectedItems().size() > 1)) { allowRemove = false; } if (getSelectedItems().size() == 1) { allowReplace = true; allowAdvanced = volumeEntity.isOnline() && getSelectedItems().get(0).isOnline(); } else { allowReplace = false; allowAdvanced = false; } } getRemoveBricksCommand().setIsExecutionAllowed(allowRemove); getReplaceBrickCommand().setIsExecutionAllowed(allowReplace); getBrickAdvancedDetailsCommand().setIsExecutionAllowed(allowAdvanced); getAddBricksCommand().setIsExecutionAllowed(allowAdd); }

Target:
private void updateActionAvailability() { GlusterVolumeEntity volumeEntity = getEntity(); boolean allowRemove = true; boolean allowReplace = true; boolean allowAdvanced = true; boolean allowAdd = true; if (volumeEntity == null || volumeEntity.getVolumeType().isDispersedType() || !volumeEntity.getVolumeType().isSupported()) { allowRemove = false; allowAdd = false; } if (volumeEntity == null || getSelectedItems() == null || getSelectedItems().size() == 0) { allowRemove = false; allowReplace = false; allowAdvanced = false; } else { GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); if (volumeTask != null && (volumeTask.getStatus() == JobExecutionStatus.STARTED || volumeTask.getType() == GlusterTaskType.REMOVE_BRICK && volumeTask.getStatus() == JobExecutionStatus.FINISHED)) { allowRemove = false; allowReplace = false; } else if (volumeEntity.getVolumeType() == GlusterVolumeType.STRIPE || getSelectedItems().size() == volumeEntity.getBricks().size()) { allowRemove = false; } else if (volumeEntity.getVolumeType() == GlusterVolumeType.REPLICATE && (volumeEntity.getBricks().size() == VolumeListModel.REPLICATE_COUNT_DEFAULT || getSelectedItems().size() > 1)) { allowRemove = false; } if (getSelectedItems().size() == 1) { allowReplace = true; allowAdvanced = volumeEntity.isOnline() && getSelectedItems().get(0).isOnline(); } else { allowReplace = false; allowAdvanced = false; } } getRemoveBricksCommand().setIsExecutionAllowed(allowRemove); getReplaceBrickCommand().setIsExecutionAllowed(allowReplace); getBrickAdvancedDetailsCommand().setIsExecutionAllowed(allowAdvanced); getAddBricksCommand().setIsExecutionAllowed(allowAdd); }