KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > treeeditor > ImportFolderNode


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20
21 package org.netbeans.modules.xml.wsdl.ui.view.treeeditor;
22
23 import java.util.Collection JavaDoc;
24
25 import org.netbeans.modules.xml.wsdl.model.Definitions;
26 import org.netbeans.modules.xml.wsdl.model.Import;
27 import org.netbeans.modules.xml.wsdl.ui.cookies.AddChildWSDLElementCookie;
28 import org.netbeans.modules.xml.wsdl.ui.view.treeeditor.newtype.ImportWSDLNewType;
29 import org.openide.util.NbBundle;
30 import org.openide.util.datatransfer.NewType;
31
32
33 /**
34  *
35  * @author Ritesh Adval
36  *
37  */

38 public class ImportFolderNode extends FolderNode {
39     
40     private Definitions mDef = null;
41     
42     public ImportFolderNode(Definitions element) {
43         super(new ImportFolderChildren(element), element, Import.class);
44         mDef = element;
45         this.setDisplayName(NbBundle.getMessage(ImportFolderNode.class,
46         "IMPORT_FOLDER_NODE_NAME"));
47         getLookupContents().add(new AddChildWSDLElementCookie(element));
48         this.addNodeListener(new WSDLNodeListener(this));
49     }
50     
51     public Object JavaDoc getWSDLConstruct() {
52         return mDef;
53     }
54     
55     public static final class ImportFolderChildren extends GenericWSDLComponentChildren {
56         public ImportFolderChildren(Definitions definitions) {
57             super(definitions);
58         }
59         
60         @Override JavaDoc
61         protected Collection JavaDoc getKeys() {
62             Definitions def = (Definitions) getWSDLComponent();
63             return def.getImports();
64         }
65     }
66     
67     @Override JavaDoc
68     public final NewType[] getNewTypes()
69     {
70         if (isEditable()) {
71             return new NewType[] {
72                     //new ImportSchemaNewType(mDef),
73
new ImportWSDLNewType(mDef),
74             };
75         }
76         return new NewType[] {};
77     }
78
79     @Override JavaDoc
80     public Class JavaDoc getType() {
81         return Import.class;
82     }
83     
84 }
85
Popular Tags