KickJava   Java API By Example, From Geeks To Geeks.

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


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

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