KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > ui > nodes > BridgeSource2Element


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
20 package org.netbeans.modules.java.ui.nodes;
21
22 import org.openide.src.*;
23 import org.openide.nodes.Node;
24 import org.netbeans.jmi.javamodel.*;
25
26 /**
27  * Bridges {@link SourceNodeFactory} to {@link org.openide.src.nodes.ElementNodeFactory}
28  */

29 final class BridgeSource2Element implements ExElementNodeFactory {
30
31     private final SourceNodeFactory delegate;
32
33     public BridgeSource2Element(SourceNodeFactory delegate) {
34         this.delegate = delegate;
35     }
36
37     public Node createConstructorNode(ConstructorElement element) {
38         Constructor constr = (Constructor) BridgeUtils.getJavaObject(element);
39         return delegate.createConstructorNode(constr);
40     }
41
42     public Node createMethodNode(MethodElement element) {
43         Method method = (Method) BridgeUtils.getJavaObject(element);
44         return delegate.createMethodNode(method);
45     }
46
47     public Node createFieldNode(FieldElement element) {
48         Field field = (Field) BridgeUtils.getJavaObject(element);
49         return delegate.createFieldNode(field);
50     }
51
52     public Node createInitializerNode(InitializerElement element) {
53         Initializer init = (Initializer) BridgeUtils.getJavaObject(element);
54         return delegate.createInitializerNode(init);
55     }
56
57     public Node createClassNode(ClassElement element) {
58         JavaClass jo = null;
59         if (element != null) {
60             jo = (JavaClass) BridgeUtils.getJavaObject(element);
61         }
62         return delegate.createClassNode(jo);
63     }
64
65     public Node createWaitNode() {
66         return delegate.createWaitNode();
67     }
68
69     public Node createErrorNode() {
70         return delegate.createErrorNode();
71     }
72
73     public Node createEnumNode(JavaEnum element) {
74         return delegate.createEnumNode(element);
75     }
76
77     public Node createEnumConstantNode(EnumConstant element) {
78         return delegate.createEnumConstantNode(element);
79     }
80
81     public Node createAnnotationTypeNode(AnnotationType element) {
82         return delegate.createAnnotationTypeNode(element);
83     }
84
85     public Node createAnnotationTypeMethodNode(Attribute element) {
86         return delegate.createAnnotationTypeMethodNode(element);
87     }
88 }
89
Popular Tags