Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "File > Save Project As...". #273

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/main/java/org/mastodon/mamut/io/ProjectActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public static void installGlobalActions( final Actions actions, final Context co
*/
public static void installAppActions( final Actions actions, final ProjectModel appModel, final Frame parentComponent )
{
final RunnableAction saveProjectAction = new RunnableAction( SAVE_PROJECT, () -> ProjectSaver.saveProject( appModel, parentComponent ) );
final RunnableAction saveProjectAsAction = new RunnableAction( SAVE_PROJECT_AS, () -> ProjectSaver.saveProjectAs( appModel, parentComponent ) );
final RunnableAction saveProjectAction = new RunnableAction( SAVE_PROJECT, runInNewThread( () -> ProjectSaver.saveProject( appModel, parentComponent ) ) );
final RunnableAction saveProjectAsAction = new RunnableAction( SAVE_PROJECT_AS, runInNewThread( () -> ProjectSaver.saveProjectAs( appModel, parentComponent ) ) );
final RunnableAction importTgmmAction = new RunnableAction( IMPORT_TGMM, () -> ProjectImporter.importTgmmDataWithDialog( appModel, parentComponent ) );
final RunnableAction importSimiAction = new RunnableAction( IMPORT_TGMM, () -> ProjectImporter.importSimiDataWithDialog( appModel, parentComponent ) );
final RunnableAction exportMamutAction = new RunnableAction( EXPORT_MAMUT, () -> ProjectExporter.exportMamut( appModel, parentComponent ) );
Expand All @@ -123,6 +123,22 @@ public static void installAppActions( final Actions actions, final ProjectModel
actions.namedAction( exportMamutAction, EXPORT_MAMUT_KEYS );
}

private static Runnable runInNewThread( Runnable o )
{
return () -> {
new Thread( () -> {
try
{
o.run();
}
catch ( Throwable t )
{
t.printStackTrace();
}
} ).start();
};
}

/*
* Command descriptions for all provided commands
*/
Expand Down
Loading