The default File Open location from oxygen editor

Post here questions and problems related to oXygen frameworks/document types.
vishwavaranasi
Posts: 168
Joined: Fri Feb 28, 2020 4:02 pm

The default File Open location from oxygen editor

Post by vishwavaranasi »

Hello Team , when we do the File -> Open from oxygen , we wanted to open our local storage location by default , how to achieve this using plugin API?
image.png
You do not have the required permissions to view the files attached to this post.
Thanks,
vishwa
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: The default File Open location from oxygen editor

Post by Radu »

Hi,
Assuming you have a Workspace Access plugin type, on the "applicationStarted" callback you can customize the top level menu:

Code: Select all

    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
     pluginWorkspaceAccess.addMenuBarCustomizer(new MenuBarCustomizer() {
      
      @Override
      public void customizeMainMenu(JMenuBar mainMenu) {
        //Maybe remove the File->Open action here and replace it with your own
      }
    });
    }
You can try to add your own Swing action to the File menu which shows a swing JFileChooser and after the user chooses a file you use our pluginWorkspaceAccess.open(url) API to open the file in Oxygen.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
vishwavaranasi
Posts: 168
Joined: Fri Feb 28, 2020 4:02 pm

Re: The default File Open location from oxygen editor

Post by vishwavaranasi »

Thanks Radu , may be my question was wrong.

we are not customizing the File -> Open

but whenever we want to do the File -> Open , the open should show by default our own defined local windows path , is that possible?
Thanks,
vishwa
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: The default File Open location from oxygen editor

Post by Radu »

Hi,

Can you give me examples of places where you do File->Open?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
vishwavaranasi
Posts: 168
Joined: Fri Feb 28, 2020 4:02 pm

Re: The default File Open location from oxygen editor

Post by vishwavaranasi »

here is the case

as soon i open my Oxygen Editor , which is completely blank
image.png
and my previous day working files are saved some default location on my windows machine

now when i do File -> Open , the should open my default location
You do not have the required permissions to view the files attached to this post.
Thanks,
vishwa
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: The default File Open location from oxygen editor

Post by Radu »

Hi,

Just to see if I understand, you start Oxygen, use File->"Open" which shows the file chooser. And you want the file chooser to be set to a certain folder which you control, right?
I'm afraid we do not have official API for this.
When your plugin's "applicationStarted" callback is received you could try to do this:

Code: Select all

ro.sync.ui.FileChooserSingleton.getFileChooserInstance().setCurrentDirectory(new File("/..."))
If that does not work, you could try to create your own "Custom File Open" action, add it to the toolbar or to the main menu, show a Swing JFileChooser and precisely control the operation in your code.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply