File Chooser That Understands oXygen Preferences
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 6
- Joined: Sat Apr 28, 2012 12:25 am
File Chooser That Understands oXygen Preferences
We have a lot of customizations in oXygen that require writers to choose files or directories, and our writers would like consistency with how the file browser works for default oXygen tools.
Right now we are just using a simple JFileChooser dialog for file/directory selection. Is there a way to call a file or directory chooser that is more 'oXygen aware'? In particular, one that will know whether the writer has set their preferences to open in the same directory as the current open file or to open in the last chose directory, and automatically do the right thing?
If not, is there some way to determine how the user has set this preference, so that my manually created JFileChooser can try to mimic it?
Right now we are just using a simple JFileChooser dialog for file/directory selection. Is there a way to call a file or directory chooser that is more 'oXygen aware'? In particular, one that will know whether the writer has set their preferences to open in the same directory as the current open file or to open in the last chose directory, and automatically do the right thing?
If not, is there some way to determine how the user has set this preference, so that my manually created JFileChooser can try to mimic it?
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: File Chooser That Understands oXygen Preferences
Post by alex_jitianu »
Hello,
You could use one of the "choose" methods inside WorkspaceUtilities, like chooseFile. If you are working with plugin API, PluginWorkspace implements WorkspaceUtilities. If you are using framework level API, you can use AuthorAccess.getWorkspaceAccess.
Best regards,
Alex
You could use one of the "choose" methods inside WorkspaceUtilities, like chooseFile. If you are working with plugin API, PluginWorkspace implements WorkspaceUtilities. If you are using framework level API, you can use AuthorAccess.getWorkspaceAccess.
Best regards,
Alex
-
- Posts: 6
- Joined: Sat Apr 28, 2012 12:25 am
Re: File Chooser That Understands oXygen Preferences
When I was initially asking for help with this, I was working on a plug-in. I was able to get the file browser working, with some experimentation. Now I am working in a framework, and I am having a problem I don't understand. I need to restrict the user to choosing a directory, not a file. I'm using AuthorAccess.getWorkspaceAccess() to get AuthorWorkspaceAccess, and that interface should have a chooseDirectory() method, according to the JavaDoc. But when I do this, all I can get are the chooseFile() methods. I really need a directory chooser. I can't figure out why, or what I am doing wrong, to onely get chooseFile and not chooseDirectory. Any ideas? Is it a bug in the API javadoc, or am I missing something?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: File Chooser That Understands oXygen Preferences
Hi,
The API ro.sync.exml.workspace.api.WorkspaceUtilities.chooseDirectory() was added in Oxygen 15.0 (the AuthorWorkspaceAccess interface extends the WorkspaceUtilities interface) so if you cannot find it you are probably using an older Oxygen version (or an older version of the Oxygen JARs to compile your plugin).
Anyway, even if you cannot upgrade and use the API you can create directly a Java Swing javax.swing.JFileChooser, set to it using the method javax.swing.JFileChooser.setFileSelectionMode(int) a mode in which only directories can be chosen and present it to the user.
Regards,
Radu
The API ro.sync.exml.workspace.api.WorkspaceUtilities.chooseDirectory() was added in Oxygen 15.0 (the AuthorWorkspaceAccess interface extends the WorkspaceUtilities interface) so if you cannot find it you are probably using an older Oxygen version (or an older version of the Oxygen JARs to compile your plugin).
Anyway, even if you cannot upgrade and use the API you can create directly a Java Swing javax.swing.JFileChooser, set to it using the method javax.swing.JFileChooser.setFileSelectionMode(int) a mode in which only directories can be chosen and present it to the user.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service