<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration>
<Row>
<Toolbar name="File" />
<Toolbar name="Edit" />
<Toolbar name="Build" />
<Toolbar name="Debug" visible="false" />
<Toolbar name="Memory" visible="false" />
<Toolbar name="Versioning" visible="false" />
</Row>
</Configuration>
Notice that the Debug toolbar and the Memory toolbar are both set to not be visible. In Debugging.xml, both of these are visible.
So all you need to do, after registering the XML files in the module layer file as described in the FAQ referenced above (which you do not need to do for Coding.xml and Debugging.xml, because these are part of the distribution), is say: "Now I want to use Coding.xml" (or Debugging.xml, depending which one you want). And you do that by simply coding this line:
ToolbarPool.getDefault().setConfiguration("Coding");
You'd use that line of code whenever you want a certain toolbar configuration to be displayed, such as when you open a window component group, for example. Here's a very simple example -- a new toolbar where I can click a radiobutton to show or hide a configuration:
Hi,
unfortunately the link to FAQ "How to hide and show ..." is gone.
best regards
Oliver
The FAQ entry is gone. I think http://wiki.netbeans.org/DevFaqHideShowToolbar replaces it
Dear Geertjan,
I tried to make some of my toolbars to be dynamic based on the topComponent's existence or absence. I created my own customToolbarConfig.xml and change the default Standard.xml to change the visibility of some of my custom-made toolbars to be false so i can let em visible after the required components being active or inactive. My standard.xml file is defined as follows (as if i have a custom created toolbar named MyToolbar) :
<?xml version="1.0"?>
<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration>
<Row>
<Toolbar name="File"/>
<Toolbar name="Edit"/>
<Toolbar name="Clipboard" visible="false"/>
<Toolbar name="Undo/Redo" visible="false"/>
<Toolbar name="Memory" visible="true"/>
<Toolbar name="MyToolbar" visible="false"/>
</Row>
</Configuration>
The problem : First time it works some how ok ( sometimes ). By using ToolbarPool.getDefault().setConfiguration("Standard");
ToolbarPool.getDefault().setConfiguration("customToolbarConfig");
in the componentactivate or componentdeactivate methods of myTopComponent, i can control the visibility or invisibility of my targeted toolbars.
After quiting the application and re executing it, it seems the platform doesn't following the standard.xml i have created, and reading from some plain or default standard configurations. It only shows FILE , UNDO/REDO and MYTOOLBAR which are not the things i have defined in my standard.xml.
the result is the same if create a new toolbar which i wanted to be invisible by changing the standard.xml. The platform doesn't pay attention to the XML file and shows the newly created toolbar. Do you have any idea about this problem ?
Send your questions here instead: dev at platform dot netbeans dot org
Hi Geertjan,
I am trying to access the save button in the toolbar.
I need to over ride the operation done by the save button on the toolbar by my custom code.
Is there any way to do that?
Yes, of course. https://blogs.oracle.com/geertjan/entry/bye_savecookie_hello_org_netbeans