KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > bridge > ImportElement


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.bridge;
21
22 import org.openide.src.*;
23 import org.openide.nodes.*;
24 import java.beans.*;
25 import java.util.*;
26
27 /**
28  *
29  * @author sdedic
30  * @version
31  */

32 public class ImportElement extends Element {
33     SourceElement source;
34
35     public ImportElement(ImportElement.Impl impl, SourceElement source) {
36         super(impl);
37         this.source = source;
38     }
39
40     public SourceElement getSource() {
41         return source;
42     }
43
44     public Import getImport() {
45         return ((ImportElement.Impl)impl).getImport();
46     }
47     
48     public void setImport(Import im) throws SourceException {
49         ((ImportElement.Impl)impl).setImport(im);
50     }
51     
52     /** Print this element (and all its subelements) into an element printer.
53      * @param printer the element printer
54      * @exception ElementPrinterInterruptException if the printer canceled the printing
55      */

56     public void print(ElementPrinter printer) throws ElementPrinterInterruptException {
57         Impl i = (Impl)super.impl;
58         printer.print(i.getImport().toString());
59         printer.print(";"); // NOI18N
60
}
61     
62     public interface Impl extends Element.Impl {
63         public Import getImport();
64         public void setImport(Import imp) throws SourceException;
65     }
66     
67     public static class MemoryImpl implements Impl {
68         
69         private Import imp;
70         
71         public Import getImport () {
72             return imp;
73         }
74         
75         public void setImport(Import imp) throws SourceException {
76             this.imp = imp;
77         }
78         
79         public Object JavaDoc readResolve() {
80             return null;
81         }
82         
83         public void markCurrent(boolean beforeAfter) {
84         }
85         
86         public void removePropertyChangeListener(PropertyChangeListener l) {
87         }
88         
89         public void attachedToElement(Element el) {
90         }
91         
92         public void addPropertyChangeListener(PropertyChangeListener l) {
93         }
94         
95         public Node.Cookie getCookie(Class JavaDoc type) {
96             return null;
97         }
98         
99     }
100     
101 }
102
Popular Tags