Hey George!
Thanks a lot for the quick feedback!
I'm afraid though that I did not get some of the answers I needed:
3) How do you get the current resource (@Current as of Forge 1)? Is it context.getInitialSelection().get()? How can I check that it is of any particular type (e.g. GitIgnoreResource)?
[George]: Yes, the current resource is always retrieved using UIContext.getInitialSelection, which can be safely assigned to a UISelection<Resource<?>> variable.
[Ivan]: I did not get how can I check whether a file resource is of GitIgnoreResource type. What I can think of: check whether the current resource is file and that its name is GitIgnoreResource.RESOURCE_NAME. I'm afraid that instanceof will not work. What I am not sure is how Forge knows that a certain resource is of certain type (or more precisely: of certain subtype of FileResource)
7) How did you migrate existing completers? I see that the completer interface has changed. I am afraid I can't figure out how I can rework complete methods from Forge 1, that were using CommandCompleterState parameter. I couldn't find samples
[George]: In the UICommand.initializeUI method, you call setCompleter for the desired injected input
[Ivan]: Yes, I found how to assign a completer to an input. However I was not sure how to adapt an already existing completer, which received as parameter a CommandCompleterState object. The existing completers used that object and I don't know how to rework them to use the UIContext interface for the same purpose
2) I see that in javaee-impl you have implemented an abstract command class that exposes a class that returns the current project (or null): org.jboss.forge.addon.javaee.ui.AbstractProjectUICommand. I copy-pasted the getSelectedProject method to an abstract Git UI command class that I created just becayse I saw that addon-ui does not have access to the project API (outherwise I would put it in the AbstractUICommand class). Can we find a better place for this code? In Forge 1 we just @Inject-ed a Project instance, but now I am not sure what to do
[George]: Make your addon depend on the projects addon and you shall access these classes normally
[Ivan]: Actually I did what you proposed. But now we have one and the same "protected Project getSelectedProject(UIContext context)" method in org.jboss.forge.addon.javaee.ui.AbstractProjectUICommand and in org.jboss.forge.addon.git.ui.AbstractGitCommand. Can we find a better place for a class like AbstractProjecUICommand that is accessible from anywhere where we develop commands relying on a context of a project? Maybe in projects-impl? Both javaee and git depend on that.
And one additional question:
8) In Forge 1 every plugin had a short name that we entered on the command line. Now I see that commands have some long strings as names (e.g. "JPA: New Entity"). What does the user have to enter in the shell if they want to create a new entity?
Thanks,
Ivan