Skip to content

Conversation

@acardona
Copy link
Collaborator

@acardona acardona commented Dec 6, 2018

Adds a JTree that shows nested folders from the file system; in a collapsible panel.
Top-level folders can be added and removed with the (+) and (-) buttons.
The "Edit - Save preferences" will store which top folders the user had listed.
Double-click on a leaf (a file) will open it in a Tab of the Script Editor.

Builds on top of the other PR #27 that added the incremental evaluation and REPL.

@acardona
Copy link
Collaborator Author

acardona commented Dec 6, 2018

All the "errors" are very old issues with the documentation of methods in Script Editor classes.

…pt engine.

Adds a checkbox next to the "Run", "Kill", "Batch" buttons to enable
incremental script interpretation.

The workflows:
 A. Execute selected chunks, and persist that execution.
 B. Execute a whole script, fails at some point, everything prior to
    that error remains evaluted. So script execution can continue from
    there by selecting the text (after fixing it!).
when the 'incremental' checkbox is selected.
hasn't been selected yet, and handle properly the printing
of the prompt command into the output screen, and manage
properly the index of the command when navigating with page up and page down,
in addition to properly blanking the prompt when appropriate.
rather than below. Fits better with modern screens which are much
wider than higher.
Offers:
 * adding any numbertop-level directories: button (+)
 * ability to remove them: when selected, use button (-)
 * dynamic: inspects files and directories on demand.
 * double-click a file to open it in the Script Editor
 * collapsible if not wanted
 * persistent: list of top-level directories is stored
   when using "Edit - Save Preferences".
@ctrueden
Copy link
Member

ctrueden commented Dec 8, 2018

Thanks for working on this! I will try to go through this PR as well as #27 on Sunday or Monday.

a help message dialog, and a checkbox to enable using up/down arrows
for navigating the command history.
And when arrows are enabled for history navigation, shift+arrow
will navigate within the prompt.
@acardona
Copy link
Collaborator Author

acardona commented Dec 8, 2018

Thanks @ctrueden .

Just pushed a few more edits to make things look nicer and easier.

Also: it would be nice to open images in ImageJ/Fiji from the FileSystemTree by double-click. How would you do that without introducing a dependency on ImageJ? I'm happy to enable it via reflection by discovering classes at run time, but perhaps there is a better way.

@imagejan
Copy link
Member

imagejan commented Dec 8, 2018

@acardona wrote:

All the "errors" are very old issues

Maven is a bit misleading here, as all those [ERROR] lines except one are merely Javadoc warning:s, and wouldn't break the build unless there was this single Javadoc error:

/home/travis/build/scijava/script-editor/src/main/java/org/scijava/ui/swing/script/FileSystemTree.java:245: error: no tag name after @

* @param checkIfChild If true, and the {@param dir} is a child of an existing root,


How would you do that without introducing a dependency on ImageJ?

I guess you could use SciJava's IOService to do that.

@imagejan
Copy link
Member

imagejan commented Dec 8, 2018

I quickly tested this, and it looks really nice! However, the fact that the output pane on the right cannot shrink smaller than the width of the button bar is a bit inhibiting on small(ish) screens:

screen shot 2018-12-08 at 22 10 50

Also a suggestion, how about allowing drag-and-drop to add the path of a file in the tree into the currently open script, at the position where the file is being dropped?

ctrueden and others added 4 commits December 8, 2018 23:01
The file path is inserted wherever the caret is.
A nice side consequence is that dragging files from the FileSystemTree
onto the ImageJ toolbar will attempt to open them in ImageJ.
@acardona
Copy link
Collaborator Author

acardona commented Feb 4, 2019

Hi @ctrueden, any update? I did see you merged master into this branch.

@ctrueden
Copy link
Member

ctrueden commented Feb 4, 2019

@acardona Working on it today! All I want to do before merging is to add toggles for the new panes to the menus, which are remembered with the preferences.

Do you think it makes sense to split out the portion of the Edit menu controlling fonts and such—i.e. the UI preferences—to a new View or Window menu? Or should I just add the pane toggles to Edit also? I am leaning toward a new menu.

@acardona
Copy link
Collaborator Author

acardona commented Feb 4, 2019

Thanks!

If I understand you correctly, you are referring to the 4th subsection of the Edit menu. While this is not really part of this PR, indeed, moving it to a "Format" menu would make sense.

@acardona
Copy link
Collaborator Author

acardona commented Feb 4, 2019

Or a "Style" menu.

They did not really belong in "Edit".
And we will add more things to this menu shortly.
This may cause the Script Editor settings to be reset. But only once.
@ctrueden
Copy link
Member

ctrueden commented Feb 4, 2019

I worked on this for a couple of hours. I split out the options-related Edit menu items into a new Options menu, intended to add some toggles for the various UI components. However, after further consideration, I think it is unnecessary to add any new menu items, since all the UI components are nicely one-click collapsable. So now all I have to add is persistence of the split pane states. I have to go AFK now but will try to finish that later tonight or tomorrow.

@acardona
Copy link
Collaborator Author

acardona commented Feb 5, 2019

Thanks. A comment on lambdas: why use them? The old code is explicit about which events are used. The lambdas code isn't. Doesn't seem to add anything in these particular instances other than obfuscation.

@ctrueden
Copy link
Member

ctrueden commented Feb 5, 2019

Regarding lambdas: it's more about what they remove than what they add: 100 fewer lines of code in classes that are long and bulky. I personally find them easier to read since there is less nesting, and I doubt I am the only one. Sorry you find them more obfuscated.

And avoid non-ASCII characters, in favor of Unicode sequences.
And dump any exceptions that occur to the debug log.
Soon, that logic will need more UI elements to be defined.
This fixes a bug where resizing the tab's JSplitPane divider to make the
output pane taller instead results in the REPL "emerging" while in
non-persistent mode. This was happening because the screenAndPromptSplit
prioritized keeping its JSplitPane divider at the same integer value,
resulting in the output pane height staying constant and the REPL pane's
height increasing. By setting the REPL pane to invisible, the resizing
logic now instead gives the extra space to the output pane, as desired.
@ctrueden
Copy link
Member

ctrueden commented Feb 5, 2019

I fixed some bugs, and added persistence of the split pane dividers. Will merge now.

@ctrueden ctrueden merged commit 1ea839f into scijava:master Feb 5, 2019
@acardona
Copy link
Collaborator Author

acardona commented Feb 6, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants