use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultEditMenuItemConfiguration method jumpToBeginningOfCurrentClipMenuItem.
@Bean
@Order(1906)
public SelectableMenuContribution jumpToBeginningOfCurrentClipMenuItem(UiTimelineManager uiTimelineManager, TimelineManagerAccessor timelineManager, SelectedNodeRepository selectedNodeRepository) {
KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("jumpToClipBeginning", new KeyCodeCombination(KeyCode.COMMA, KeyCombination.CONTROL_DOWN), "Jump to beginning of selected clip").getCombination();
return new DefaultMenuContribution(List.of(EDIT_ROOT, JUMP_ROOT, "Jump to beginning of selected clip"), event -> {
Optional<String> primaryClip = selectedNodeRepository.getPrimarySelectedClip();
if (primaryClip.isPresent()) {
Optional<TimelineClip> clip = timelineManager.findClipById(primaryClip.get());
uiTimelineManager.jumpAbsolute(clip.get().getInterval().getStartPosition().getSeconds());
}
}, combination);
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultEditMenuItemConfiguration method addOutpointMenuItem.
@Bean
@Order(1941)
public SelectableMenuContribution addOutpointMenuItem(AlertDialogFactory dialogFactory, TimelineState timelineState, MarkerRepository markerRepository) {
String name = "Add outpoint";
KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey(name, new KeyCodeCombination(KeyCode.O, KeyCodeCombination.CONTROL_DOWN, KeyCombination.SHIFT_DOWN), name).getCombination();
return new DefaultMenuContribution(List.of(EDIT_ROOT, MARKER, name), event -> {
TimelinePosition position = timelineState.getPlaybackPosition();
markerRepository.addMarker(position, new OutpointMarker());
}, combination);
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultFileMenuItemConfiguration method exitContributionMenuItem.
@Bean
@Order(200)
public SelectableMenuContribution exitContributionMenuItem(ExitWithSaveService exitWithSaveService) {
KeyCodeCombination combination = hotKeyRepository.registerOrGetHotKey("quit", new KeyCodeCombination(KeyCode.Q, KeyCodeCombination.CONTROL_DOWN), "Exit").getCombination();
return new DefaultMenuContribution(List.of(FILE_ROOT, "E_xit"), event -> {
exitWithSaveService.optionallySaveAndThenRun(() -> {
Platform.exit();
System.exit(0);
});
}, combination);
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultViewMenuItemConfiguration method fullScreenWindowContributionMenuItem.
@Bean
@Order(1800)
public SelectableMenuContribution fullScreenWindowContributionMenuItem(MessagingService messagingService) {
return new DefaultMenuContribution(List.of(VIEW_ROOT, "Full screen"), e -> {
stage.setFullScreen(true);
stage.setFullScreenExitHint("Hit escape to exit fullscreen");
stage.setFullScreenExitKeyCombination(new KeyCodeCombination(KeyCode.ESCAPE));
});
}
use of com.helospark.lightdi.annotation.Order in project tactview by helospark.
the class DefaultWindowMenuItemConfiguration method saveLayoutMenuItem.
@Bean
@Order(3997)
public SelectableMenuContribution saveLayoutMenuItem(MessagingService messagingService, QuerySaveFilenameService querySaveFilenameService, @Value("${tactview.homedirectory}") String homeDirectory, AlertDialogFactory alertDialogFactory) {
return new DefaultMenuContribution(List.of(WINDOW_MENU_ITEM, "Save layout"), e -> {
QuerySaveFileNameRequest request = QuerySaveFileNameRequest.builder().withInitialDirectory(homeDirectory).withTitle("Save layout file").build();
Optional<String> optionalFileName = querySaveFilenameService.queryUserAboutFileName(request);
if (optionalFileName.isPresent()) {
try {
String fileName = optionalFileName.get();
if (!fileName.endsWith("." + TACTVIEW_LAYOUT_EXTENSION)) {
fileName += ("." + TACTVIEW_LAYOUT_EXTENSION);
}
DetachableTabPaneLoadModel data = dockableTabRepository.extractLoadModel();
String result = objectMapper.writeValueAsString(data);
try (FileOutputStream fos = new FileOutputStream(new File(fileName))) {
fos.write(result.getBytes(StandardCharsets.UTF_8));
}
} catch (Exception e1) {
alertDialogFactory.showExceptionDialog("Unable to save layout", e1);
LOGGER.error("Unable to save layout", e1);
}
}
});
}
Aggregations