KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > util > datatransfer > NewType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.openide.util.datatransfer;
20
21 import org.openide.util.HelpCtx;
22 import org.openide.util.NbBundle;
23
24 import java.io.IOException JavaDoc;
25
26
27 /** Describes a type that can be created anew. Used by <a HREF="@org-openide-nodes/org/openide/nodes.Node#getNewTypes">Node.getNewTypes</a>.
28 *
29 * @author Jaroslav Tulach
30 */

31 public abstract class NewType extends Object JavaDoc implements HelpCtx.Provider {
32     /** Display name for the creation action. This should be
33     * presented as an item in a menu.
34     *
35     * @return the name of the action
36     */

37     public String JavaDoc getName() {
38         return NbBundle.getBundle(NewType.class).getString("Create");
39     }
40
41     /** Help context for the creation action.
42     * @return the help context
43     */

44     public HelpCtx getHelpCtx() {
45         return org.openide.util.HelpCtx.DEFAULT_HELP;
46     }
47
48     /** Create the object.
49     * @exception IOException if something fails
50     */

51     public abstract void create() throws IOException JavaDoc;
52
53     /* JST: Originally designed for dnd and it now uses getDropType () of a node.
54     *
55     * Create the object at a specific position.
56     * The default implementation simply calls {@link #create()}.
57     * Subclasses may
58     * allow pastes to a specific index in their
59     * children list (if the object has children indexed by integer).
60     *
61     * @param indx index to insert into, can be ignored if not supported
62     * @throws IOException if something fails
63     *
64     public void createAt (int indx) throws IOException {
65       create ();
66     }
67     */

68 }
69
Popular Tags