Page 1 of 1
The default File Open location from oxygen editor
Posted: Mon Oct 10, 2022 8:11 pm
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
Re: The default File Open location from oxygen editor
Posted: Tue Oct 11, 2022 7:28 am
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
Re: The default File Open location from oxygen editor
Posted: Tue Oct 11, 2022 9:31 am
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?
Re: The default File Open location from oxygen editor
Posted: Tue Oct 11, 2022 9:33 am
by Radu
Hi,
Can you give me examples of places where you do File->Open?
Regards,
Radu
Re: The default File Open location from oxygen editor
Posted: Tue Oct 11, 2022 9:53 am
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
Re: The default File Open location from oxygen editor
Posted: Tue Oct 11, 2022 11:45 am
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