-
Notifications
You must be signed in to change notification settings - Fork 1
DevFaqExplorerViewsInMantisse
There is an open RFE [1] to include explorer views in the GUI designer palettes by default, but until it is implemented, you can follow the following procedure. (digested from the mailing list)
As suggested in several articles [2]/[3], adding the .jar file to the palette exposes the containers. Here the exact procedure to add the containers to the palette
-
Right click in the Matisse palette
-
"Add from JAR…"
-
Navigate to the org-openide-explorer.jar file, click "Next". On my system this is C:\Program\ Files\NetBeans\8.0.1\platform\modules\org-openide-explorer.jar
-
Select available components, "Next"
-
Select the destination palette category in which to add the explorer containers, "Finish"
After all that, the containers are all listed in the palette.
(originally by Eirik Bakke)
I use explorer views in matisse all the time. You can add them to the matisse palette (via Palette Manager) or add any arbitrary class, including your own, using the "Beans→Add Bean" icon in the palette. If you make your own JComponents, they have to conform to the JavaBean conventions, i.e. have a public no-arg constructor.
For explorer views to work correctly, there must be an ExplorerManager.Provider in the component hierarchy. I use a simple custom JPanel for this purpose, see https://gist.github.com/anonymous/402e6d9956a77feaac60 (feel free to use). This "ExplorerManagerProviderPanel" can also be added to the hierarchy using Matisse.
import javax.swing.ActionMap;
import javax.swing.JPanel;
import javax.swing.text.DefaultEditorKit;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils;
import org.openide.util.Lookup;
public class ExplorerManagerProviderPanel extends JPanel
implements ExplorerManager.Provider, Lookup.Provider
{
private final ExplorerManager explorerManager = new ExplorerManager();
private final Lookup lookup;
public ExplorerManagerProviderPanel() {
ActionMap map = this.getActionMap();
map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(explorerManager));
map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(explorerManager));
map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(explorerManager));
map.put("delete", ExplorerUtils.actionDelete(explorerManager, true));
lookup = ExplorerUtils.createLookup(explorerManager, map);
}
@Override
public final ExplorerManager getExplorerManager() {
return explorerManager;
}
@Override
public final Lookup getLookup() {
return lookup;
}
}
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqExplorerViewsInMantisse , that was last modified by NetBeans user Markiewb on 2014-11-23T11:36:09Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.