ExplorerUtils.java | Class | Helper methods to embed ExplorerManager s and explorer views
into Swing component trees.
To create a component that displays the content of an
ExplorerManager you
should make your component implement
ExplorerManager.Provider and
org.openide.util.Lookup.Provider and register actions in your component's
ActionMap :
public class YourComponent extends TopComponent
implements ExplorerManager.Provider, Lookup.Provider {
private ExplorerManager manager;
public YourComponent() {
this.manager = new ExplorerManager();
ActionMap map = this.getActionMap ();
map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
map.put("delete", ExplorerUtils.actionDelete(manager, true));
associateLookup (ExplorerUtils.createLookup (manager, map));
}
public ExplorerManager getExplorerManager() {
return manager;
}
|