Page 1 of 1

hiding views

Posted: Mon Nov 02, 2020 2:38 pm
by vishwavaranasi
Hello team , am using the PAI to hide the views in Oxygen Editor , the following lines of code added to our

xxxxxWorkspaceAccessPluginExtensionimplements WorkspaceAccessPluginExtension


public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {

//hiding views
pluginWorkspaceAccess.hideView("Outline");
pluginWorkspaceAccess.hideView("Attributes");


}


this is not hiding the views ?

would you please help us to achieve the same.


Thanks,
vishwa

Re: hiding views

Posted: Mon Nov 02, 2020 3:12 pm
by Radu
Hi,

The "applicationStarted" API is called very early when the application has not yet loaded and positioned its toolbars and side views.
One way to approach what you want would be something like this:

Code: Select all

    @Override
    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
      JFrame mainFrame = (JFrame) pluginWorkspaceAccess.getParentFrame();
      mainFrame.addWindowListener(new WindowAdapter() {
        /**
         * @see java.awt.event.WindowAdapter#windowOpened(java.awt.event.WindowEvent)
         */
        @Override
        public void windowOpened(WindowEvent e) {
          pluginWorkspaceAccess.hideView("Outline");
        }
      });
    }
but we also have a special plugin extension called a Components Validator plugin extension:

https://www.oxygenxml.com/doc/versions/ ... lugin.html

which has a "validateComponent" Java callback that can be used to remove side views completely from Oxygen (so that they can no longer be opened). There is a sample implementation here:

https://github.com/oxygenxml/oxygen-com ... ter-plugin

As a third approach you can also load a complete custom views/toolbars layout on the "applicationStarted" callback using the API ro.sync.exml.workspace.api.options.GlobalOptionsStorage.importGlobalOptions(File) API. I can give you mor details about this if you want.

Regards,
Radu

Re: hiding views

Posted: Mon Nov 02, 2020 3:59 pm
by vishwavaranasi
Thanks Radu ..that worked for me.

is this same applicable to hiding toolbar also?
pluginWorkspaceAccess.hideToolbar("Project");?


Thanks,
vishwa

Re: hiding views

Posted: Mon Nov 02, 2020 4:02 pm
by Radu
Hi,

You should be able to hide a global toolbar. If you want to hide the internal toolbar which appears inside the Project view, it cannot be hidden using the API.

Regards,
Radu