use of com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand in project tactview by helospark.
the class StandardClipContextMenuChainItemConfiguration method deleteAllEffectsMenuItem.
@Bean
@Order(102)
public ClipContextMenuChainItem deleteAllEffectsMenuItem(CopyPasteRepository copyPasteRepository, UiCommandInterpreterService commandInterpreter, TimelineManagerAccessor timelineManager) {
return alwaysSupportedContextMenuItem(request -> {
MenuItem deleteEffectsFromClipMenuItem = new MenuItem("Delete all effects");
deleteEffectsFromClipMenuItem.setOnAction(e -> {
List<RemoveEffectCommand> removeEffectsCommand = request.getPrimaryClip().getEffects().stream().map(effect -> new RemoveEffectCommand(timelineManager, effect.getId())).collect(Collectors.toList());
commandInterpreter.sendWithResult(new CompositeCommand(removeEffectsCommand));
});
if (request.getPrimaryClip().getEffects().isEmpty()) {
deleteEffectsFromClipMenuItem.setDisable(true);
}
return deleteEffectsFromClipMenuItem;
});
}
use of com.helospark.tactview.ui.javafx.commands.impl.RemoveEffectCommand in project tactview by helospark.
the class RemoveEffectService method removeEffects.
public void removeEffects(Collection<String> effectIds) {
List<RemoveEffectCommand> commands = effectIds.stream().filter(a -> timelineManager.findEffectById(a).isPresent()).map(a -> new RemoveEffectCommand(timelineManager, a)).collect(Collectors.toList());
if (commands.size() > 0) {
CompositeCommand compositeCommand = new CompositeCommand(commands);
commandInterpreterService.synchronousSend(compositeCommand);
}
}
Aggregations