hiding views

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

hiding views

Post by vishwavaranasi » Mon Nov 02, 2020 2:38 pm

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
Thanks,
vishwa

Radu
Posts: 7529
Joined: Fri Jul 09, 2004 5:18 pm

Re: hiding views

Post by Radu » Mon Nov 02, 2020 3:12 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

vishwavaranasi
Posts: 37
Joined: Fri Feb 28, 2020 4:02 pm

Re: hiding views

Post by vishwavaranasi » Mon Nov 02, 2020 3:59 pm

Thanks Radu ..that worked for me.

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


Thanks,
vishwa
Thanks,
vishwa

Radu
Posts: 7529
Joined: Fri Jul 09, 2004 5:18 pm

Re: hiding views

Post by Radu » Mon Nov 02, 2020 4:02 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply