mastodon-sc / mastodon-tomancak

BSD 2-Clause "Simplified" License
1 stars 5 forks source link

Fix "File > Merge Two Projects..." #53

Closed maarzt closed 8 months ago

maarzt commented 8 months ago

The Mastodon plugin "File > Merge Two Projects..." is broken since the changes of 1.0.0-27-SNAPSHOT. The problem can be reproduced by installing Mastodon from the Mastodon-Dev update site and trying to use the "Merge Two Projects..." menu entry. The plugin will fail with in exception.

But there are actually two problems:

1. Problem This line fails with an exception: https://github.com/mastodon-sc/mastodon-tomancak/blob/641411b81332b777027f3477435bf1808b09469d/src/main/java/org/mastodon/mamut/tomancak/merging/MergingUtil.java#L75

The method tryCreate was recently changed https://github.com/mastodon-sc/mastodon/commit/9f0f71c1691a8ec15b2f2383896cb3609b6fea02 and this code was never updated.

1. Solution

The code that calls tryCreate can be drastically simplified. There is no need to call the method anymore.

2. Problem

The code for showing the result of the merge operation was recently changed: https://github.com/mastodon-sc/mastodon-tomancak/blob/641411b81332b777027f3477435bf1808b09469d/src/main/java/org/mastodon/mamut/tomancak/TomancakPlugins.java#L401-L403 with the consequence that the results of the merge operation are no longer shown to the user. The user has simply can not access the merged project.

2. Solution The "File > Merge Two Projects..." now closes the currently open Mastodon instance, and opens a new instance with the new merged project.

stefanhahmann commented 8 months ago

@maarzt

FYI: the max timepoint method is now available in the core as well: https://github.com/mastodon-sc/mastodon/pull/274#event-11490204591

You could replace the method in Dataset now: https://github.com/mastodon-sc/mastodon-tomancak/blob/1c2c684cd209bc8db7d75e0183674cf010434a2e/src/main/java/org/mastodon/mamut/tomancak/merging/Dataset.java#L63