Call OpenFileAction programmatically
I would like to invoke the OpenFileAction just like it is done from the 'File-> Open...' menu.
This does not seem to work as it opens the file chooser, but no files appear inside it and the message 'Nothing to show' appears whilst progressbar spins indefinitely.
I have consulted the CheckboxAction example as suggested in the FAQ, but this does not fix this.
new AnActionEvent(null, dataContext,
ActionPlaces.UNKNOWN, CheckboxAction.this.getTemplatePresentation(),
ActionManager.getInstance(), 0));
Any ideas?
Please sign in to leave a comment.
You need to make sure that you are not in a write action when you invoke the open file dialog. The dialog requires a read action to fill the UI, and it will not be able to do so if you're holding a write action.
Thank you!