blob: c5397aa6d92b7fc5786c33670cbcde6a3f132319 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= How do I hide and show toolbars the way the debugger does?
:page-layout: wikidev
:page-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqHideShowToolbar
:description: Apache NetBeans wiki DevFaqHideShowToolbar
:toc: left
:toc-title:
:page-syntax: true
:page-wikidevsection: _actions_how_to_add_things_to_files_folders_menus_toolbars_and_more
:page-position: 25
To hide/show a toolbar dynamically in the NetBeans Platform, you should predefine a toolbar configuration first, then activate it.
1. Define toolbar configuration files alongside the module's layer:
`Standard.xml`:
[source,xml]
----
<?xml version="1.0"?>
<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration>
<Row>
<Toolbar name="View" />
<Toolbar name="Control" />
<Toolbar name="Indicator" />
<Toolbar name="Draw" />
<Toolbar name="Memory" />
</Row>
<Row>
<Toolbar name="File" position="2" visible="false" />
<Toolbar name="Edit" position="2" visible="false" />
<Toolbar name="Build" position="2" visible="false" />
<Toolbar name="Debug" position="2" visible="false" />
<Toolbar name="Versioning" position="2" visible="false" />
</Row>
</Configuration>
----
`Developing.xml`:
[source,xml]
----
<?xml version="1.0"?>
<!DOCTYPE Configuration PUBLIC "-//NetBeans IDE//DTD toolbar//EN"
"http://www.netbeans.org/dtds/toolbar.dtd">
<Configuration>
<Row>
<Toolbar name="View" />
<Toolbar name="Control" />
<Toolbar name="Indicator" />
<Toolbar name="Draw" />
<Toolbar name="Memory" />
</Row>
<Row>
<Toolbar name="File" position="2" />
<Toolbar name="Edit" position="2" />
<Toolbar name="Build" position="2" />
<Toolbar name="Debug" position="2" visible="false" />
<Toolbar name="Versioning" position="2" visible="false" />
</Row>
</Configuration>
----
[start=2]
. Register the configuration files in `layer.xml`:
[source,xml]
----
<?xml version="1.0"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN"
"http://www.netbeans.org/dtds/filesystem-1_0.dtd">
<filesystem>
<folder name="Toolbars">
<file name="Standard.xml" url="Standard.xml"/>
<file name="Developing.xml" url="Developing.xml"/>
</folder>
</filesystem>
----
[start=3]
. At runtime, set the toolbar configuration that you want:
[source,java]
----
ToolbarPool.getDefault().setConfiguration("Developing");
----