Page 1 of 1

how to select folders with ${ask()} editor variable

Posted: Thu Oct 23, 2014 5:40 pm
by Ron Van den Branden
Hi,

For a transformation scenario I'm developing in a project, I am looking for an elegant way to ask which files or folders to transform. The most user-friendly option would be a combo box that is populated by a dynamic lookup of the subfolders in a given folder (since more subfolders may be added in the course of time). Yet, I'm aware this might be a very specific use case that is not covered by Oxygen. Another issue is that the available ${ask()} variable types don't allow for multiple answers (radio and combo box only allow a single selection).

The next best option I could find for asking the path to the user, is the ${ask()} variable of type 'url'. This presents the user a with dialog window that allows for manual input of a path, or selection of a file:

Image

Yet, the "Browse for local file" option only allows for the selection of a file. Of course, after a file has been selected and its URL has been pasted in the "URL:" text field, the user could remove the file part and enter the URL of a parent folder. Yet, this is not the most user-friendly way for the non-technical users I'm developing the project for. Is there a way to add an option "Browse for local folder" to that dialog? Or is there a better way overall to let users select folders for a transformation scenario?

Best,

Ron

Re: how to select folders with ${ask()} editor variable

Posted: Tue Oct 28, 2014 4:09 pm
by Radu
Hi Ron,

Indeed ask editor variables have their limitations.
About these questions:
Is there a way to add an option "Browse for local folder" to that dialog?
I will add an improvement request for this. Just to see if I understand, the ask editor variable is used as a parameter to an XSLT-based scenario which is then read in the XSLT and the XSLT iterates resources.
Or is there a better way overall to let users select folders for a transformation scenario?
Also a possibility. We also have plenty of Java-based API, for example if you have Java knowledge you can implement a plugin to add a custom toolbar action which shows a custom dialog asking the user for certain things, then use our API to create an XSLT transformer and transform with it.

Regards,
Radu

Re: how to select folders with ${ask()} editor variable

Posted: Wed Oct 29, 2014 1:03 am
by Ron Van den Branden
Hi Radu,

Thanks for your thoughts.
I will add an improvement request for this. Just to see if I understand, the ask editor variable is used as a parameter to an XSLT-based scenario which is then read in the XSLT and the XSLT iterates resources.
Indeed; in this case it is used in an ANT transformation scenario which invokes the XSLT (besides doing some extra stuff like creating and cleaning up temporary files).

Maybe another suggestion (if I may): it could be helpful to be able to specify a default location for the file dialog, so that it opens at the specified location. If it would be possible to e.g. pass this with a parameter to the 'url' ${ask()} editor variable, it could help the users if the dialog always opens in the current project folder.
We also have plenty of Java-based API, for example if you have Java knowledge you can implement a plugin to add a custom toolbar action which shows a custom dialog asking the user for certain things, then use our API to create an XSLT transformer and transform with it.
Thanks for the suggestion. Not much Java knowledge here, unfortunately, but this motivates me to continue that Java MOOC and discover Oxygen's gems in full glory...

Best,

Ron

Re: how to select folders with ${ask()} editor variable

Posted: Wed Oct 29, 2014 10:23 am
by Radu
Hi Ron,

The third parameter which can be given to the ask editor variable is a default location like:

Code: Select all

${ask("test?", url, "file:/c:/eclipse")}
but we would also need to support an url_directory type of ask editor variable which would allow you to choose only folders and return the value of a folder. As I said, I've already added an improvement request for this.

Regards,
Radu

Re: how to select folders with ${ask()} editor variable

Posted: Wed Oct 29, 2014 12:08 pm
by Ron Van den Branden
Hi Radu,
The third parameter which can be given to the ask editor variable is a default location
Sorry; I had overlooked that due to the fact that I had to work around the current limitation that ${ask()} editor variables are evaluated too early in ANT tasks (as I reported in another thread http://www.oxygenxml.com/forum/topic11025.html). Currently, ${ask("test?", url, ${pdu})} doesn't work, but as you said in that thread, this will be fixed in a next Oxygen release.

Providing a literal URL as default location does work indeed.

Best,

Ron

Re: how to select folders with ${ask()} editor variable

Posted: Wed Oct 29, 2014 12:12 pm
by Radu
Hi Ron,

Yes, Oxygen 17.0 will evaluate the ask editor variable used in scenario parameters after all other variables have been evaluated.

Regards,
Radu

Re: how to select folders with ${ask()} editor variable

Posted: Thu Mar 09, 2017 3:51 am
by jtakeda
Hi there,

I am wondering about the status of the directory option of the ${ask()} variable. I am a similar position as above, where I am creating a downloadable package that uses ANT and XSLT to run a suite of tools against a user's project. These users are likely to be non-technical.

Best,
Joey

Re: how to select folders with ${ask()} editor variable

Posted: Thu Mar 09, 2017 9:31 am
by Radu
Hi Joey,

Funny that in the same day we get two questions from two different people about a feature which has not been requested very often.
Please see my reply here:

viewtopic.php?f=1&t=14223&p=41890#p41894

Regards,
Radu