embl-cba / imagej-utils

BSD 2-Clause "Simplified" License
2 stars 4 forks source link

Remove "Project" from ij-utils? #48

Open tischi opened 3 years ago

tischi commented 3 years ago

@K-Meech

there is this:

    public static String selectPathFromProjectOrFileSystem(String directory, String objectName) throws IOException {
        FileUtils.FileLocation fileLocation = null;
        if (directory != null) {
            GenericDialog gd = new GenericDialog("Choose source");
            gd.addChoice("Load from", new String[]{FileUtils.FileLocation.Project.toString(), FileUtils.FileLocation.FileSystem.toString()}, FileUtils.FileLocation.Project.toString());

I forgot: why is there this "Project" thing? 🤔 Feels like this this something that should only live in the MoBIE repo? I know, this is a mess anyway, but ideally long-term ij-utils should only contain things that also could be used outside MoBIE. What's a "Project"? Maybe we mean GitHub? Otherwise we should just move this to MoBIE.

K-Meech commented 3 years ago

I think this is used for loading additional tables, and for loading additional bookmarks? So we needed a way to get information from a mobie project (s3, github etc...), or from an arbitrary location on the file system (for tables / bookmarks that people have saved elsewhere on their computer). I agree though - it should move into MoBIE!! I don't think it has any use outside of this.

K-Meech commented 3 years ago

I need this for the project creation stuff, so I'll move it as part of that PR

K-Meech commented 3 years ago

Currently this code is used by TableRowsTableView here: https://github.com/tischi/imagej-utils/blob/075b1a77311b24fa705cd1fa29f9541ab5d86af2/src/main/java/de/embl/cba/tables/view/TableRowsTableView.java#L500

Is this still needed? Or is it legacy code?

tischi commented 3 years ago

Is this still needed?

In MoBIE2 we do not use TableRowsTableView anymore, but maybe it is used by other code. Thus I would not delete the selectPathFromProjectOrFileSystem function from imagej-utils, but also not use it in MoBIE2.

K-Meech commented 3 years ago

Ok - we can keep selectPathFromProjectOrFileSystem in imagej-utils. We do need something very similar for MoBIE though.... Both loading extra table columns, and extra bookmarks needs the option to load from the project (i.e. set locations from a github, s3 or local project), or from an arbitrary location on the file system (i.e. just opening a file browser). Should I just copy the bits of code I need over to MoBIE?

tischi commented 3 years ago

We can also keep things in IJ utils, but let's try to get rid of the "Project" terminology and of Bookmarks which are both very specific to MoBIE.

We (ping @constantinpape) have the FileAndUrlUtils in imagej-utils. I think this offers very nice general purpose functionality for dealing with files and object stores. Then we have GitHubUtils which is also generally useful.

I think we should try to separate the code that anything (including small dialogs) that help loading general stuff from Files, Object Stores, or GitHub, should be in in imagej-utils. Anything that deals with Views/Bookmark/Projects should be in MoBIE.