Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.