|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.java.ui; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JToolBar; import org.openide.loaders.DataFolder; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; import org.openide.loaders.FolderInstance; import org.openide.filesystems.FileObject; import org.openide.filesystems.Repository; import org.openide.util.actions.CallableSystemAction; import org.netbeans.modules.java.ui.actions.NavigateAction; /** * * @author sdedic * @version */ public class JEditorToolbar /* extends FolderInstance */ { JToolBar toolBar; JEditorToolbar(DataFolder f) { toolBar = new javax.swing.JToolBar(); toolBar.setFloatable(false); toolBar.setLayout(new javax.swing.BoxLayout(toolBar, javax.swing.BoxLayout.X_AXIS)); toolBar.setBorder(new javax.swing.border.EmptyBorder(6, 6, 5, 5)); initComponents(); } private void initComponents() { CallableSystemAction ac = (CallableSystemAction)CallableSystemAction.findObject(NavigateAction.class, true); toolBar.add(ac.getToolbarPresenter()); } public static JToolBar createToolBar(String folderName) { FileObject f = Repository.getDefault().getDefaultFileSystem(). findResource(folderName); if (f == null) { return null; } DataObject d; try { d = DataObject.find(f); } catch (DataObjectNotFoundException ex) { return null; } DataFolder contentFolder = (DataFolder)d.getCookie(DataFolder.class); if (contentFolder == null) { System.err.println("the target is not a folder"); // NOI18N return null; } JEditorToolbar tb = new JEditorToolbar(contentFolder); return tb.getToolBar(); } public JToolBar getToolBar() { return toolBar; } /* protected Object createInstance(InstanceCookie[] cookies) { } public Class instanceClass() { return getToolBar().getClass(); } public InstanceCookie acceptDataObject(DataObject d) { InstanceCookie ic = super. } */ } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.