Automated merge with http://hg.netbeans.org/main/contrib/
authorJesse Glick <jglick@netbeans.org>
Fri, 17 Sep 2010 18:38:20 -0400
changeset 1638188087e92b614
parent 16377 fb6708125ce4
parent 16380 9731dbe287cd
child 16382 7b1a1aed83e8
Automated merge with http://hg.netbeans.org/main/contrib/
apisupport.metainfservices/build.xml
apisupport.metainfservices/manifest.mf
apisupport.metainfservices/nbproject/project.properties
apisupport.metainfservices/nbproject/project.xml
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/Bundle.properties
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportAction.java
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportVisualPanel1.form
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportVisualPanel1.java
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportWizardIterator.java
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportWizardPanel1.java
apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/layer.xml
apisupport.metainfservices/test/unit/src/org/netbeans/modules/apisupport/metainfservices/ExportActionTest.java
clazz/build.xml
clazz/l10n.list
clazz/manifest.mf
clazz/nbproject/project.properties
clazz/nbproject/project.xml
clazz/src/org/netbeans/modules/clazz/Bundle.properties
clazz/src/org/netbeans/modules/clazz/ClassDataLoader.java
clazz/src/org/netbeans/modules/clazz/ClassDataLoaderBeanInfo.java
clazz/src/org/netbeans/modules/clazz/ClassDataNode.java
clazz/src/org/netbeans/modules/clazz/ClassDataObject.java
clazz/src/org/netbeans/modules/clazz/ClassElementImpl.java
clazz/src/org/netbeans/modules/clazz/ClassElementNodeFactory.java
clazz/src/org/netbeans/modules/clazz/ClassException.java
clazz/src/org/netbeans/modules/clazz/ClassJavaDocImpl.java
clazz/src/org/netbeans/modules/clazz/CompiledDataNode.java
clazz/src/org/netbeans/modules/clazz/CompiledDataObject.java
clazz/src/org/netbeans/modules/clazz/ConstructorElementImpl.java
clazz/src/org/netbeans/modules/clazz/ElementImpl.java
clazz/src/org/netbeans/modules/clazz/FieldElementImpl.java
clazz/src/org/netbeans/modules/clazz/LazySourceChildren.java
clazz/src/org/netbeans/modules/clazz/MemberElementImpl.java
clazz/src/org/netbeans/modules/clazz/MethodElementImpl.java
clazz/src/org/netbeans/modules/clazz/NodeFactoryPool.java
clazz/src/org/netbeans/modules/clazz/SerDataNode.java
clazz/src/org/netbeans/modules/clazz/SerDataObject.java
clazz/src/org/netbeans/modules/clazz/SerParser.java
clazz/src/org/netbeans/modules/clazz/SerStructureNode.java
clazz/src/org/netbeans/modules/clazz/SerTopChildren.java
clazz/src/org/netbeans/modules/clazz/SourceElementImpl.java
clazz/src/org/netbeans/modules/clazz/Util.java
clazz/src/org/netbeans/modules/clazz/resources/bean.gif
clazz/src/org/netbeans/modules/clazz/resources/bean32.gif
clazz/src/org/netbeans/modules/clazz/resources/beanMain.gif
clazz/src/org/netbeans/modules/clazz/resources/beanMain32.gif
clazz/src/org/netbeans/modules/clazz/resources/class.gif
clazz/src/org/netbeans/modules/clazz/resources/class32.gif
clazz/src/org/netbeans/modules/clazz/resources/classBr.gif
clazz/src/org/netbeans/modules/clazz/resources/classError.gif
clazz/src/org/netbeans/modules/clazz/resources/classError32.gif
clazz/src/org/netbeans/modules/clazz/resources/classMain.gif
clazz/src/org/netbeans/modules/clazz/resources/classMain32.gif
clazz/src/org/netbeans/modules/clazz/resources/interfaceBr.gif
clazz/src/org/netbeans/modules/clazz/resources/mf-layer.xml
clazz/src/org/netbeans/modules/clazz/resources/ser.gif
clazz/src/org/netbeans/modules/clazz/resources/ser32.gif
clazz/src/org/netbeans/modules/clazz/resources/serAlone.gif
clazz/src/org/netbeans/modules/clazz/resources/serError.gif
clazz/src/org/netbeans/modules/clazz/resources/serError32.gif
clazz/src/org/netbeans/modules/clazz/resources/serMain.gif
clazz/src/org/netbeans/modules/clazz/resources/serMain32.gif
clazz/sub.locale.xml
clazz/test/qa-functional/src/org/netbeans/test/ClazzTest$InnerClass.class
clazz/test/qa-functional/src/org/netbeans/test/ClazzTest$InnerInterface.class
clazz/test/qa-functional/src/org/netbeans/test/ClazzTest.class
clazz/test/qa-functional/src/org/netbeans/test/clazz/ClazzNodeTest.java
clazz/test/qa-functional/src/org/netbeans/test/clazz/ElementRecognitionTest.java
clazz/test/qa-functional/src/org/netbeans/test/clazz/SerNodeTest.java
clazz/test/qa-functional/src/org/netbeans/test/clazz/data/goldenfiles/SerNodeTest/testTree.pass
     1.1 --- a/apisupport.beanbrowser/manifest.mf	Wed Sep 15 11:58:07 2010 +0530
     1.2 +++ b/apisupport.beanbrowser/manifest.mf	Fri Sep 17 18:38:20 2010 -0400
     1.3 @@ -3,5 +3,5 @@
     1.4  OpenIDE-Module-Layer: org/netbeans/modules/apisupport/beanbrowser/layer.xml
     1.5  OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/apisupport/beanbrowser/Bundle.properties
     1.6  OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help
     1.7 -OpenIDE-Module-Specification-Version: 1.8
     1.8 +OpenIDE-Module-Specification-Version: 1.9
     1.9  
     2.1 --- a/apisupport.beanbrowser/nbproject/project.properties	Wed Sep 15 11:58:07 2010 +0530
     2.2 +++ b/apisupport.beanbrowser/nbproject/project.properties	Fri Sep 17 18:38:20 2010 -0400
     2.3 @@ -1,3 +1,3 @@
     2.4  javac.compilerargs=-Xlint -Xlint:-serial
     2.5 -javac.source=1.5
     2.6 +javac.source=1.6
     2.7  javahelp.hs=beanbrowser-hs.xml
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/Bundle.properties	Fri Sep 17 18:38:20 2010 -0400
     3.3 @@ -0,0 +1,44 @@
     3.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     3.5 +#
     3.6 +# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
     3.7 +#
     3.8 +# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
     3.9 +# Other names may be trademarks of their respective owners.
    3.10 +#
    3.11 +# The contents of this file are subject to the terms of either the GNU
    3.12 +# General Public License Version 2 only ("GPL") or the Common
    3.13 +# Development and Distribution License("CDDL") (collectively, the
    3.14 +# "License"). You may not use this file except in compliance with the
    3.15 +# License. You can obtain a copy of the License at
    3.16 +# http://www.netbeans.org/cddl-gplv2.html
    3.17 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    3.18 +# specific language governing permissions and limitations under the
    3.19 +# License.  When distributing the software, include this License Header
    3.20 +# Notice in each file and include the License file at
    3.21 +# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    3.22 +# particular file as subject to the "Classpath" exception as provided
    3.23 +# by Oracle in the GPL Version 2 section of the License file that
    3.24 +# accompanied this code. If applicable, add the following below the
    3.25 +# License Header, with the fields enclosed by brackets [] replaced by
    3.26 +# your own identifying information:
    3.27 +# "Portions Copyrighted [year] [name of copyright owner]"
    3.28 +#
    3.29 +# If you wish your version of this file to be governed by only the CDDL
    3.30 +# or only the GPL Version 2, indicate your decision by adding
    3.31 +# "[Contributor] elects to include this software in this distribution
    3.32 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
    3.33 +# single choice of license, a recipient has the option to distribute
    3.34 +# your version of this file under either the CDDL, the GPL Version 2 or
    3.35 +# to extend the choice of license to its licensees as provided above.
    3.36 +# However, if you add GPL Version 2 code and therefore, elected the GPL
    3.37 +# Version 2 license, then the option applies only if the new code is
    3.38 +# made subject to such option by the copyright holder.
    3.39 +#
    3.40 +# Contributor(s):
    3.41 +#
    3.42 +# Portions Copyrighted 2010 Sun Microsystems, Inc.
    3.43 +
    3.44 +# SerStructureNode
    3.45 +LBL_ser_stream=Serialized stream
    3.46 +# {0} - class name
    3.47 +LBL_instance_of=instance of {0}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/SerParser.java	Fri Sep 17 18:38:20 2010 -0400
     4.3 @@ -0,0 +1,576 @@
     4.4 +/*
     4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 + *
     4.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     4.8 + *
     4.9 + * The contents of this file are subject to the terms of either the GNU
    4.10 + * General Public License Version 2 only ("GPL") or the Common
    4.11 + * Development and Distribution License("CDDL") (collectively, the
    4.12 + * "License"). You may not use this file except in compliance with the
    4.13 + * License. You can obtain a copy of the License at
    4.14 + * http://www.netbeans.org/cddl-gplv2.html
    4.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    4.16 + * specific language governing permissions and limitations under the
    4.17 + * License.  When distributing the software, include this License Header
    4.18 + * Notice in each file and include the License file at
    4.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    4.20 + * particular file as subject to the "Classpath" exception as provided
    4.21 + * by Sun in the GPL Version 2 section of the License file that
    4.22 + * accompanied this code. If applicable, add the following below the
    4.23 + * License Header, with the fields enclosed by brackets [] replaced by
    4.24 + * your own identifying information:
    4.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    4.26 + *
    4.27 + * Contributor(s):
    4.28 + *
    4.29 + * The Original Software is NetBeans. The Initial Developer of the Original
    4.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    4.31 + * Microsystems, Inc. All Rights Reserved.
    4.32 + *
    4.33 + * If you wish your version of this file to be governed by only the CDDL
    4.34 + * or only the GPL Version 2, indicate your decision by adding
    4.35 + * "[Contributor] elects to include this software in this distribution
    4.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    4.37 + * single choice of license, a recipient has the option to distribute
    4.38 + * your version of this file under either the CDDL, the GPL Version 2 or
    4.39 + * to extend the choice of license to its licensees as provided above.
    4.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    4.41 + * Version 2 license, then the option applies only if the new code is
    4.42 + * made subject to such option by the copyright holder.
    4.43 + */
    4.44 +
    4.45 +package org.netbeans.modules.apisupport.beanbrowser.ser;
    4.46 +
    4.47 +import java.io.*;
    4.48 +import java.util.*;
    4.49 +import org.openide.util.NotImplementedException;
    4.50 +
    4.51 +/** Parser for Java serialization files.
    4.52 + * Does no classloading or per-class semantics, simply parses the
    4.53 + * raw serialization structure.
    4.54 + * @author Jesse Glick
    4.55 + */
    4.56 +public final class SerParser implements ObjectStreamConstants {
    4.57 +    
    4.58 +    private static final boolean DEBUG = Boolean.getBoolean("org.netbeans.modules.clazz.SerParser.DEBUG"); // NOI18N
    4.59 +    
    4.60 +    private final InputStream is;
    4.61 +    private int seq = 0;
    4.62 +    private final List refs = new ArrayList(100); // List<Object>
    4.63 +    
    4.64 +    public SerParser(InputStream is) {
    4.65 +        this.is = is;
    4.66 +    }
    4.67 +    
    4.68 +    private int makeRef(Object o) {
    4.69 +        refs.add(o);
    4.70 +        int i = seq;
    4.71 +        seq++;
    4.72 +        if (DEBUG) System.err.println("makeRef[" + i + "]=" + o); // NOI18N
    4.73 +        return i;
    4.74 +    }
    4.75 +    
    4.76 +    private Object getRef(int i) throws CorruptException {
    4.77 +        int idx = i - baseWireHandle;
    4.78 +        if (idx < 0 || idx >= seq) throw new CorruptException("Invalid reference: " + i); // NOI18N
    4.79 +        Object o = refs.get(idx);
    4.80 +        if (o == null) throw new CorruptException("Invalid reference: " + i); // NOI18N
    4.81 +        return o;
    4.82 +    }
    4.83 +    
    4.84 +    public Stream parse(String label) throws IOException, CorruptException {
    4.85 +        Stream s = new Stream(label);
    4.86 +        s.magic = readShort();
    4.87 +        s.version = readShort();
    4.88 +        if (s.magic != STREAM_MAGIC || s.version != STREAM_VERSION) {
    4.89 +           throw new CorruptException("stream version mismatch: " + hexify(s.magic) + " != " + hexify(STREAM_MAGIC) + " or " + hexify(s.version) + " != " +  hexify(STREAM_VERSION)); // NOI18N
    4.90 +        }
    4.91 +        s.contents = new ArrayList(10);
    4.92 +        while (peek() != -1) {
    4.93 +            s.contents.add(readContent());
    4.94 +        }
    4.95 +        if (DEBUG) System.err.println("parsed: " + s); // NOI18N
    4.96 +        return s;
    4.97 +    }
    4.98 +    
    4.99 +    public static final class CorruptException extends IOException {
   4.100 +        public CorruptException() {
   4.101 +        }
   4.102 +        public CorruptException(String m) {
   4.103 +            super(m);
   4.104 +        }
   4.105 +    }
   4.106 +    
   4.107 +    private int pushback = -1;
   4.108 +    private int rb() throws IOException {
   4.109 +        if (pushback != -1) {
   4.110 +            int c = pushback;
   4.111 +            pushback = -1;
   4.112 +            return c;
   4.113 +        }
   4.114 +        int c = is.read();
   4.115 +        if (DEBUG) System.err.println("read: " + Integer.toHexString(c)); // NOI18N
   4.116 +        if (c == -1) {
   4.117 +            throw new EOFException();
   4.118 +        } else {
   4.119 +            return c;
   4.120 +        }
   4.121 +    }
   4.122 +    private int peek() throws IOException {
   4.123 +        if (pushback != -1) throw new IllegalStateException("can only peek once"); // NOI18N
   4.124 +        pushback = is.read();
   4.125 +        if (DEBUG) System.err.println("read: " + Integer.toHexString(pushback)); // NOI18N
   4.126 +        return pushback;
   4.127 +    }
   4.128 +    
   4.129 +    static String hexify(byte b) {
   4.130 +        int i = b;
   4.131 +        if (i < 0) i += 256;
   4.132 +        String s = Integer.toHexString(i).toUpperCase(Locale.US);
   4.133 +        return "0x" + pad(s, 2); // NOI18N
   4.134 +    }
   4.135 +    static String hexify(short s) {
   4.136 +        int i = s;
   4.137 +        if (i < 0) i += 65536;
   4.138 +        String st = Integer.toHexString(i).toUpperCase(Locale.US);
   4.139 +        return "0x" + pad(st, 4); // NOI18N
   4.140 +    }
   4.141 +    static String hexify(int i) {
   4.142 +        String s = Integer.toHexString(i).toUpperCase(Locale.US);
   4.143 +        return "0x" + pad(s, 4); // NOI18N
   4.144 +    }
   4.145 +    static String hexify(long l) {
   4.146 +        String s1 = Integer.toHexString((int)((l & 0xFFFFFFFF00000000L) << 32)).toUpperCase(Locale.US);
   4.147 +        String s2 = Integer.toHexString((int)(l & 0x00000000FFFFFFFFL)).toUpperCase(Locale.US);
   4.148 +        return "0x" + pad(s1, 4) + pad(s2, 4); // NOI18N
   4.149 +    }
   4.150 +    static String hexify(byte[] b) {
   4.151 +        StringBuffer buf = new StringBuffer(2 + b.length * 2);
   4.152 +        buf.append("0x"); // NOI18N
   4.153 +        for (int i = 0; i < b.length; i++) {
   4.154 +            int x = b[i];
   4.155 +            if (x < 0) x += 256;
   4.156 +            buf.append(pad(Integer.toHexString(x).toUpperCase(Locale.US), 2));
   4.157 +        }
   4.158 +        return buf.toString();
   4.159 +    }
   4.160 +    private static String pad(String s, int size) {
   4.161 +        int i = s.length();
   4.162 +        if (i == size) {
   4.163 +            return s;
   4.164 +        } else {
   4.165 +            StringBuffer b = new StringBuffer(size);
   4.166 +            for (int k = 0; k < size - i; k++) {
   4.167 +                b.append('0'); // NOI18N
   4.168 +            }
   4.169 +            b.append(s);
   4.170 +            return b.toString();
   4.171 +        }
   4.172 +    }
   4.173 +    
   4.174 +    private long readLong() throws IOException {
   4.175 +        long x1 = rb();
   4.176 +        long x2 = rb();
   4.177 +        long x3 = rb();
   4.178 +        long x4 = rb();
   4.179 +        long x5 = rb();
   4.180 +        long x6 = rb();
   4.181 +        long x7 = rb();
   4.182 +        long x8 = rb();
   4.183 +        long l = (x1 << 56) + (x2 << 48) + (x3 << 40) + (x4 << 32) + (x5 << 24) + (x6 << 16) + (x7 << 8) + x8;
   4.184 +        if (DEBUG) System.err.println("readLong: " + l); // NOI18N
   4.185 +        return l;
   4.186 +    }
   4.187 +    
   4.188 +    private int readInt() throws IOException {
   4.189 +        int x1 = rb();
   4.190 +        int x2 = rb();
   4.191 +        int x3 = rb();
   4.192 +        int x4 = rb();
   4.193 +        int i = (x1 << 24) + (x2 << 16) + (x3 << 8) + x4;
   4.194 +        if (DEBUG) System.err.println("readInt: " + i); // NOI18N
   4.195 +        return i;
   4.196 +    }
   4.197 +    
   4.198 +    private short readShort() throws IOException {
   4.199 +        int x1 = rb();
   4.200 +        int x2 = rb();
   4.201 +        short s = (short)((x1 << 8) + x2);
   4.202 +        //System.err.println("x1=" + hexify(x1) + " x2=" + hexify(x2) + " s=" + hexify(s));
   4.203 +        //if (DEBUG) System.err.println("x1=" + x1 + " x2=" + x2 + " s=" + s);
   4.204 +        if (DEBUG) System.err.println("readShort: " + s); // NOI18N
   4.205 +        return s;
   4.206 +    }
   4.207 +    
   4.208 +    private byte readByte() throws IOException {
   4.209 +        return (byte)rb();
   4.210 +    }
   4.211 +    
   4.212 +    private String readUTF() throws IOException {
   4.213 +        short len = readShort();
   4.214 +        if (len < 0) throw new NotImplementedException();//XXX
   4.215 +        byte[] buf = new byte[len];
   4.216 +        for (int i = 0; i < len; i++) {
   4.217 +            buf[i] = readByte();
   4.218 +        }
   4.219 +        String s = new String(buf, "UTF-8"); // NOI18N
   4.220 +        if (DEBUG) System.err.println("readUTF: " + s); // NOI18N
   4.221 +        return s;
   4.222 +    }
   4.223 +    
   4.224 +    private String readLongUTF() throws IOException {
   4.225 +        long len = readLong();
   4.226 +        if (len < 0) throw new NotImplementedException();//XXX
   4.227 +        if (len > Integer.MAX_VALUE) throw new NotImplementedException();// XXX
   4.228 +        int ilen = (int)len;
   4.229 +        byte[] buf = new byte[ilen];
   4.230 +        for (int i = 0; i < ilen; i++) {
   4.231 +            buf[i] = readByte();
   4.232 +        }
   4.233 +        String s = new String(buf, "UTF-8"); // NOI18N
   4.234 +        if (DEBUG) System.err.println("readUTF: " + s); // NOI18N
   4.235 +        return s;
   4.236 +    }
   4.237 +    
   4.238 +    // See "Rules of the Grammar" in Java Object Serialization Specification
   4.239 +    // for explanation of all these objects.
   4.240 +    
   4.241 +    public static final class Stream /*extends Thing*/ {
   4.242 +        final String label;
   4.243 +        public Stream(String label) {
   4.244 +            this.label = label;
   4.245 +        }
   4.246 +        public short magic;
   4.247 +        public short version;
   4.248 +        public List contents; // List<Object>
   4.249 +
   4.250 +        public String toString() {
   4.251 +            return "Stream[" + label + ":" + contents + "]"; // NOI18N
   4.252 +        }
   4.253 +    }
   4.254 +    
   4.255 +    public static final Object NULL = "null"; // NOI18N
   4.256 +    
   4.257 +    private Object readContent() throws IOException {
   4.258 +        byte tc = readByte();
   4.259 +        switch (tc) {
   4.260 +        case TC_OBJECT:
   4.261 +            return readNewObject();
   4.262 +        case TC_CLASS:
   4.263 +            return readNewClass();
   4.264 +        case TC_ARRAY:
   4.265 +            return readNewArray();
   4.266 +        case TC_CLASSDESC:
   4.267 +            return readNewClassDesc();
   4.268 +        case TC_PROXYCLASSDESC:
   4.269 +            // XXX too complicated:
   4.270 +            throw new NotImplementedException("TC_PROXYCLASSDESC"); // NOI18N
   4.271 +            //return readNewProxyClassDesc();
   4.272 +        case TC_STRING:
   4.273 +            return readNewString();
   4.274 +        case TC_LONGSTRING:
   4.275 +            // XXX later
   4.276 +            throw new NotImplementedException("TC_LONGSTRING"); // NOI18N
   4.277 +            //return readNewLongString();
   4.278 +        case TC_REFERENCE:
   4.279 +            return readReference();
   4.280 +        case TC_NULL:
   4.281 +            return NULL;
   4.282 +        case TC_EXCEPTION:
   4.283 +            // XXX what is this??
   4.284 +            throw new NotImplementedException("TC_EXCEPTION"); // NOI18N
   4.285 +        case TC_RESET:
   4.286 +            // XXX what is this??
   4.287 +            throw new NotImplementedException("TC_RESET"); // NOI18N
   4.288 +        case TC_BLOCKDATA:
   4.289 +            return readBlockData();
   4.290 +        case TC_BLOCKDATALONG:
   4.291 +            return readBlockDataLong();
   4.292 +        default:
   4.293 +            throw new CorruptException("Unknown typecode: " + hexify(tc)); // NOI18N
   4.294 +        }
   4.295 +    }
   4.296 +    
   4.297 +    public static final class ObjectWrapper {
   4.298 +        public ClassDesc classdesc;
   4.299 +        public List data; // List<NameValue|Object>
   4.300 +        public String toString() {
   4.301 +            return "Object[class=" + classdesc.name + ",data=" + data + "]"; // NOI18N
   4.302 +        }
   4.303 +    }
   4.304 +    
   4.305 +    public static final class NameValue {
   4.306 +        public NameValue(FieldDesc name, Object value) {
   4.307 +            this.name = name;
   4.308 +            this.value = value;
   4.309 +        }
   4.310 +        public final FieldDesc name;
   4.311 +        public final Object value;
   4.312 +        public String toString() {
   4.313 +            return name.toString() + "=" + value.toString(); // NOI18N
   4.314 +        }
   4.315 +    }
   4.316 +    
   4.317 +    public static final class ClassDesc {
   4.318 +        public String name;
   4.319 +        public long svuid;
   4.320 +        public boolean writeMethod;
   4.321 +        public boolean blockData;
   4.322 +        public boolean serializable;
   4.323 +        public boolean externalizable;
   4.324 +        public List fields; // List<FieldDesc>
   4.325 +        public List annotation; // List<Object>
   4.326 +        public ClassDesc superclass;
   4.327 +        public String toString() {
   4.328 +            return "Class[name=" + name + "]"; // NOI18N
   4.329 +        }
   4.330 +    }
   4.331 +    
   4.332 +    private ObjectWrapper readNewObject() throws IOException {
   4.333 +        ObjectWrapper ow = new ObjectWrapper();
   4.334 +        ow.classdesc = readClassDesc();
   4.335 +        makeRef(ow);
   4.336 +        ow.data = new ArrayList (10);
   4.337 +        LinkedList hier = new LinkedList();
   4.338 +        for (ClassDesc cd = ow.classdesc; cd != null; cd = cd.superclass) {
   4.339 +            hier.addFirst(cd);
   4.340 +        }
   4.341 +        Iterator it = hier.iterator();
   4.342 +        while (it.hasNext()) {
   4.343 +            ClassDesc cd = (ClassDesc)it.next();
   4.344 +            if (cd.serializable) {
   4.345 +                ow.data.addAll(readNoWrClass(cd));
   4.346 +                if (cd.writeMethod) {
   4.347 +                    ow.data.addAll(readContents());
   4.348 +                }
   4.349 +            } else {
   4.350 +                if (cd.blockData) {
   4.351 +                    ow.data.addAll(readContents());
   4.352 +                } else {
   4.353 +                    // Old externalization. If this is not object content,
   4.354 +                    // the stream could now become corrupted. Oh well.
   4.355 +                    ow.data.add(readContent());
   4.356 +                }
   4.357 +            }
   4.358 +        }
   4.359 +        if (DEBUG) System.err.println("readNewObject: " + ow); // NOI18N
   4.360 +        return ow;
   4.361 +    }
   4.362 +    
   4.363 +    private ClassDesc readClassDesc() throws IOException {
   4.364 +        Object o = readContent();
   4.365 +        if (o instanceof ClassDesc) {
   4.366 +            return (ClassDesc)o;
   4.367 +        } else if (o == NULL) {
   4.368 +            return null;
   4.369 +        } else {
   4.370 +            throw new CorruptException("Expected class desc, got: " + o); // NOI18N
   4.371 +        }
   4.372 +    }
   4.373 +    
   4.374 +    private ClassDesc readNewClass() throws IOException {
   4.375 +        ClassDesc cd = readClassDesc();
   4.376 +        makeRef(cd);
   4.377 +        return cd;
   4.378 +    }
   4.379 +    
   4.380 +    private ClassDesc readNewClassDesc() throws IOException {
   4.381 +        ClassDesc cd = new ClassDesc();
   4.382 +        cd.name = readUTF();
   4.383 +        if (! cd.name.startsWith("[") && // NOI18N
   4.384 +                ! (cd.name.length() == 1 && "BSIJFDCZ".indexOf(cd.name) != -1) && // NOI18N
   4.385 +                ! cd.name.endsWith(";")) { // NOI18N
   4.386 +            // Canonicalize. It seems class names read normally need this; those
   4.387 +            // read as part of an array do not. ??
   4.388 +            cd.name = "L" + cd.name + ";"; // NOI18N
   4.389 +        }
   4.390 +        cd.svuid = readLong();
   4.391 +        makeRef(cd);
   4.392 +        byte cdf = readByte();
   4.393 +        cd.writeMethod = (cdf & SC_WRITE_METHOD) != 0;
   4.394 +        cd.blockData = (cdf & SC_BLOCK_DATA) != 0;
   4.395 +        cd.serializable = (cdf & SC_SERIALIZABLE) != 0;
   4.396 +        cd.externalizable = (cdf & SC_EXTERNALIZABLE) != 0;
   4.397 +        short count = readShort();
   4.398 +        cd.fields = new ArrayList(count);
   4.399 +        for (int i = 0; i < count; i++) {
   4.400 +            cd.fields.add(readFieldDesc());
   4.401 +        }
   4.402 +        cd.annotation = readContents();
   4.403 +        cd.superclass = readClassDesc();
   4.404 +        if (DEBUG) System.err.println("readNewClassDesc: " + cd); // NOI18N
   4.405 +        return cd;
   4.406 +    }
   4.407 +    
   4.408 +    public static class FieldDesc {
   4.409 +        public String name;
   4.410 +        public String type;
   4.411 +        public String toString() {
   4.412 +            return "Field[name=" + name + ",type=" + type + "]"; // NOI18N
   4.413 +        }
   4.414 +    }
   4.415 +    public static final class ObjFieldDesc extends FieldDesc {
   4.416 +        public boolean array;
   4.417 +        public String toString() {
   4.418 +            return "Field[name=" + name + ",type=" + type + (array ? "[]" : "") + "]"; // NOI18N
   4.419 +        }
   4.420 +    }
   4.421 +    
   4.422 +    private FieldDesc readFieldDesc() throws IOException {
   4.423 +        char tc = (char)readByte();
   4.424 +        FieldDesc fd;
   4.425 +        switch (tc) {
   4.426 +        case 'B':
   4.427 +        case 'C':
   4.428 +        case 'D':
   4.429 +        case 'F':
   4.430 +        case 'I':
   4.431 +        case 'J':
   4.432 +        case 'S':
   4.433 +        case 'Z':
   4.434 +            fd = new FieldDesc();
   4.435 +            fd.type = new String(new char[] {tc});
   4.436 +            break;
   4.437 +        case '[':
   4.438 +            fd = new ObjFieldDesc();
   4.439 +            ((ObjFieldDesc)fd).array = true;
   4.440 +            break;
   4.441 +        case 'L':
   4.442 +            fd = new ObjFieldDesc();
   4.443 +            ((ObjFieldDesc)fd).array = false;
   4.444 +            break;
   4.445 +        default:
   4.446 +            throw new CorruptException("Strange field type: " + tc); // NOI18N
   4.447 +        }
   4.448 +        fd.name = readUTF();
   4.449 +        if (fd instanceof ObjFieldDesc) {
   4.450 +            String clazz = (String)readContent();
   4.451 +            /*
   4.452 +            if (((ObjFieldDesc)fd).array) {
   4.453 +                if (! clazz.startsWith("[")) throw new CorruptException("Field type: " + clazz); // NOI18N
   4.454 +                clazz = clazz.substring(1, clazz.length());
   4.455 +            }
   4.456 +            if (! (clazz.startsWith("L") && clazz.endsWith(";"))) throw new CorruptException("Field type: " + clazz); // NOI18N
   4.457 +            fd.type = clazz.substring(1, clazz.length() - 1).replace('/', '.'); // NOI18N
   4.458 +             */
   4.459 +            fd.type = clazz;
   4.460 +        }
   4.461 +        if (DEBUG) System.err.println("readFieldDesc: " + fd); // NOI18N
   4.462 +        return fd;
   4.463 +    }
   4.464 +    
   4.465 +    private List readContents() throws IOException {
   4.466 +        List l = new ArrayList(10);
   4.467 +        while (peek() != TC_ENDBLOCKDATA) {
   4.468 +            l.add(readContent());
   4.469 +        }
   4.470 +        if (readByte() != TC_ENDBLOCKDATA) throw new IllegalStateException();
   4.471 +        if (DEBUG) System.err.println("readContents: " + l); // NOI18N
   4.472 +        return l;
   4.473 +    }
   4.474 +    
   4.475 +    public static final class ArrayWrapper {
   4.476 +        public ClassDesc classdesc;
   4.477 +        public List values;
   4.478 +        public String toString() {
   4.479 +            return classdesc.name + "{" + values + "}"; // NOI18N
   4.480 +        }
   4.481 +    }
   4.482 +    
   4.483 +    private ArrayWrapper readNewArray() throws IOException {
   4.484 +        ArrayWrapper aw = new ArrayWrapper();
   4.485 +        aw.classdesc = readClassDesc();
   4.486 +        makeRef(aw);
   4.487 +        int size = readInt();
   4.488 +        if (size < 0) throw new NotImplementedException();
   4.489 +        aw.values = new ArrayList(size);
   4.490 +        for (int i = 0; i < size; i++) {
   4.491 +            if (aw.classdesc.name.equals("[B")) { // NOI18N
   4.492 +                aw.values.add(new Byte(readByte()));
   4.493 +            } else if (aw.classdesc.name.equals("[S")) { // NOI18N
   4.494 +                aw.values.add(new Short(readShort()));
   4.495 +            } else if (aw.classdesc.name.equals("[I")) { // NOI18N
   4.496 +                aw.values.add(new Integer(readInt()));
   4.497 +            } else if (aw.classdesc.name.equals("[J")) { // NOI18N
   4.498 +                aw.values.add(new Long(readLong()));
   4.499 +            } else if (aw.classdesc.name.equals("[F")) { // NOI18N
   4.500 +                aw.values.add(new Float(Float.intBitsToFloat(readInt())));
   4.501 +            } else if (aw.classdesc.name.equals("[D")) { // NOI18N
   4.502 +                aw.values.add(new Double(Double.longBitsToDouble(readLong())));
   4.503 +            } else if (aw.classdesc.name.equals("[C")) { // NOI18N
   4.504 +                aw.values.add(new Character((char)readShort()));
   4.505 +            } else if (aw.classdesc.name.equals("[Z")) { // NOI18N
   4.506 +                aw.values.add(readByte() == 1 ? Boolean.TRUE : Boolean.FALSE);
   4.507 +            } else {
   4.508 +                aw.values.add(readContent());
   4.509 +            }
   4.510 +        }
   4.511 +        if (DEBUG) System.err.println("readNewArray: " + aw); // NOI18N
   4.512 +        return aw;
   4.513 +    }
   4.514 +    
   4.515 +    private String readNewString() throws IOException {
   4.516 +        String s = readUTF();
   4.517 +        makeRef(s);
   4.518 +        return s;
   4.519 +    }
   4.520 +    
   4.521 +    private Object readReference() throws IOException {
   4.522 +        int i = readInt();
   4.523 +        Object r = getRef(i);
   4.524 +        if (DEBUG) System.err.println("readReference: " + r); // NOI18N
   4.525 +        return r;
   4.526 +    }
   4.527 +    
   4.528 +    private byte[] readBlockData() throws IOException {
   4.529 +        int size = readByte();
   4.530 +        if (size < 0) size += 256;
   4.531 +        byte[] b = new byte[size];
   4.532 +        for (int i = 0; i < size; i++) {
   4.533 +            b[i] = readByte();
   4.534 +        }
   4.535 +        if (DEBUG) System.err.println("readBlockData: " + size + " bytes"); // NOI18N
   4.536 +        return b;
   4.537 +    }
   4.538 +    
   4.539 +    private byte[] readBlockDataLong() throws IOException {
   4.540 +        int size = readInt();
   4.541 +        if (size < 0) throw new NotImplementedException();
   4.542 +        byte[] b = new byte[size];
   4.543 +        for (int i = 0; i < size; i++) {
   4.544 +            b[i] = readByte();
   4.545 +        }
   4.546 +        if (DEBUG) System.err.println("readBlockDataLong: " + size + " bytes"); // NOI18N
   4.547 +        return b;
   4.548 +    }
   4.549 +    
   4.550 +    private List/*<NameValue>*/ readNoWrClass(ClassDesc cd) throws IOException {
   4.551 +        List fields = cd.fields;
   4.552 +        List values = new ArrayList(fields.size());
   4.553 +        for (int i = 0; i < fields.size(); i++) {
   4.554 +            FieldDesc fd = (FieldDesc)fields.get(i);
   4.555 +            if (fd.type.equals("B")) { // NOI18N
   4.556 +                values.add(new NameValue(fd, new Byte(readByte())));
   4.557 +            } else if (fd.type.equals("S")) { // NOI18N
   4.558 +                values.add(new NameValue(fd, new Short(readShort())));
   4.559 +            } else if (fd.type.equals("I")) { // NOI18N
   4.560 +                values.add(new NameValue(fd, new Integer(readInt())));
   4.561 +            } else if (fd.type.equals("J")) { // NOI18N
   4.562 +                values.add(new NameValue(fd, new Long(readLong())));
   4.563 +            } else if (fd.type.equals("F")) { // NOI18N
   4.564 +                values.add(new NameValue(fd, new Float(Float.intBitsToFloat(readInt()))));
   4.565 +            } else if (fd.type.equals("D")) { // NOI18N
   4.566 +                values.add(new NameValue(fd, new Double(Double.longBitsToDouble(readLong()))));
   4.567 +            } else if (fd.type.equals("C")) { // NOI18N
   4.568 +                values.add(new NameValue(fd, new Character((char)readShort())));
   4.569 +            } else if (fd.type.equals("Z")) { // NOI18N
   4.570 +                values.add(new NameValue(fd, readByte() == 1 ? Boolean.TRUE : Boolean.FALSE));
   4.571 +            } else {
   4.572 +                values.add(new NameValue(fd, readContent()));
   4.573 +            }
   4.574 +        }
   4.575 +        if (DEBUG) System.err.println("readNoWrClass: " + values); // NOI18N
   4.576 +        return values;
   4.577 +    }
   4.578 +
   4.579 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/SerStructureNode.java	Fri Sep 17 18:38:20 2010 -0400
     5.3 @@ -0,0 +1,228 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     5.8 + *
     5.9 + * The contents of this file are subject to the terms of either the GNU
    5.10 + * General Public License Version 2 only ("GPL") or the Common
    5.11 + * Development and Distribution License("CDDL") (collectively, the
    5.12 + * "License"). You may not use this file except in compliance with the
    5.13 + * License. You can obtain a copy of the License at
    5.14 + * http://www.netbeans.org/cddl-gplv2.html
    5.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    5.16 + * specific language governing permissions and limitations under the
    5.17 + * License.  When distributing the software, include this License Header
    5.18 + * Notice in each file and include the License file at
    5.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    5.20 + * particular file as subject to the "Classpath" exception as provided
    5.21 + * by Sun in the GPL Version 2 section of the License file that
    5.22 + * accompanied this code. If applicable, add the following below the
    5.23 + * License Header, with the fields enclosed by brackets [] replaced by
    5.24 + * your own identifying information:
    5.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    5.26 + *
    5.27 + * Contributor(s):
    5.28 + *
    5.29 + * The Original Software is NetBeans. The Initial Developer of the Original
    5.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    5.31 + * Microsystems, Inc. All Rights Reserved.
    5.32 + *
    5.33 + * If you wish your version of this file to be governed by only the CDDL
    5.34 + * or only the GPL Version 2, indicate your decision by adding
    5.35 + * "[Contributor] elects to include this software in this distribution
    5.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    5.37 + * single choice of license, a recipient has the option to distribute
    5.38 + * your version of this file under either the CDDL, the GPL Version 2 or
    5.39 + * to extend the choice of license to its licensees as provided above.
    5.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    5.41 + * Version 2 license, then the option applies only if the new code is
    5.42 + * made subject to such option by the copyright holder.
    5.43 + */
    5.44 +
    5.45 +package org.netbeans.modules.apisupport.beanbrowser.ser;
    5.46 +
    5.47 +import java.io.*;
    5.48 +import java.util.*;
    5.49 +
    5.50 +import org.openide.*;
    5.51 +import org.openide.nodes.*;
    5.52 +import org.openide.util.NbBundle;
    5.53 +
    5.54 +/** Nodes representing pieces of a serialized file structurally.
    5.55 + * @author Jesse Glick
    5.56 + */
    5.57 +public abstract class SerStructureNode {
    5.58 +
    5.59 +    private SerStructureNode() {/* do not instantiate me */}
    5.60 +
    5.61 +    public static final class StreamNode extends AbstractNode {
    5.62 +        public StreamNode(SerParser.Stream s) {
    5.63 +            super(new GeneralChildren(s.contents));
    5.64 +            setName(s.label);
    5.65 +            setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
    5.66 +        }
    5.67 +    }
    5.68 +    
    5.69 +    private static class GeneralChildren extends Children.Keys {
    5.70 +        private final List things;
    5.71 +        public GeneralChildren(List things) {
    5.72 +            this.things = things;
    5.73 +        }
    5.74 +        protected void addNotify() {
    5.75 +            super.addNotify();
    5.76 +            setKeys(things);
    5.77 +        }
    5.78 +        protected void removeNotify() {
    5.79 +            setKeys(Collections.EMPTY_SET);
    5.80 +            super.removeNotify();
    5.81 +        }
    5.82 +        protected Node[] createNodes(Object key) {
    5.83 +            return new Node[] {createNode(key)};
    5.84 +        }
    5.85 +        protected Node createNode(Object key) {
    5.86 +            if (key instanceof SerParser.NameValue) {
    5.87 +                SerParser.NameValue nv = (SerParser.NameValue)key;
    5.88 +                Node n = createNode(nv.value);
    5.89 +                n.setName(prettify(nv.name.type) + " " + nv.name.name + " = " + n.getName()); // NOI18N
    5.90 +                return n;
    5.91 +            } else if (key instanceof SerParser.ObjectWrapper) {
    5.92 +                SerParser.ObjectWrapper ow = (SerParser.ObjectWrapper)key;
    5.93 +                String name = prettify(ow.classdesc.name);
    5.94 +                Children ch;
    5.95 +                if (name.equals("org.openide.util.io.NbMarshalledObject")) { // NOI18N
    5.96 +                    // This is special!
    5.97 +                    ch = new NbMarshalledObjectChildren(ow);
    5.98 +                } else {
    5.99 +                    ch = new GeneralChildren(ow.data);
   5.100 +                }
   5.101 +                AbstractNode n = new AbstractNode(ch);
   5.102 +                n.setName(NbBundle.getMessage(SerStructureNode.class, "LBL_instance_of", name));
   5.103 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.104 +                return n;
   5.105 +            } else if (key instanceof SerParser.ArrayWrapper) {
   5.106 +                SerParser.ArrayWrapper aw = (SerParser.ArrayWrapper)key;
   5.107 +                AbstractNode n = new AbstractNode(new GeneralChildren(aw.values));
   5.108 +                if (! aw.classdesc.name.startsWith("[")) throw new IllegalStateException("Strange array name: " + aw.classdesc.name); // NOI18N
   5.109 +                n.setName(prettify(aw.classdesc.name.substring(1, aw.classdesc.name.length())) + "[" + aw.values.size() + "]"); // NOI18N
   5.110 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.111 +                return n;
   5.112 +            } else if (key instanceof byte[]) {
   5.113 +                // Block data.
   5.114 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.115 +                n.setName(SerParser.hexify((byte[])key));
   5.116 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.117 +                return n;
   5.118 +            } else if (key instanceof SerParser.ClassDesc) {
   5.119 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.120 +                n.setName("class " + prettify(((SerParser.ClassDesc)key).name)); // NOI18N
   5.121 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.122 +                return n;
   5.123 +            } else if (key == SerParser.NULL) {
   5.124 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.125 +                n.setName("null"); // NOI18N
   5.126 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.127 +                return n;
   5.128 +            } else if (key instanceof String) {
   5.129 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.130 +                n.setName("\"" + (String)key + "\""); // NOI18N
   5.131 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.132 +                return n;
   5.133 +            } else if ((key instanceof Boolean) || (key instanceof Character) ||
   5.134 +                       (key instanceof Byte) || (key instanceof Short) ||
   5.135 +                       (key instanceof Integer) || (key instanceof Long) ||
   5.136 +                       (key instanceof Float) || (key instanceof Double)) {
   5.137 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.138 +                n.setName(key.toString());
   5.139 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.140 +                return n;
   5.141 +            } else {
   5.142 +                // ????
   5.143 +                AbstractNode n = new AbstractNode(Children.LEAF);
   5.144 +                n.setName("What is this? " + key + " [" + key.getClass().getName() + "]"); // NOI18N
   5.145 +                n.setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/serAlone"); // NOI18N
   5.146 +                return n;
   5.147 +            }
   5.148 +        }
   5.149 +    }
   5.150 +    
   5.151 +    private static String prettify(String type) {
   5.152 +        if (type.equals("B")) { // NOI18N
   5.153 +            return "byte"; // NOI18N
   5.154 +        } else if (type.equals("S")) { // NOI18N
   5.155 +            return "short"; // NOI18N
   5.156 +        } else if (type.equals("I")) { // NOI18N
   5.157 +            return "int"; // NOI18N
   5.158 +        } else if (type.equals("J")) { // NOI18N
   5.159 +            return "long"; // NOI18N
   5.160 +        } else if (type.equals("F")) { // NOI18N
   5.161 +            return "float"; // NOI18N
   5.162 +        } else if (type.equals("D")) { // NOI18N
   5.163 +            return "double"; // NOI18N
   5.164 +        } else if (type.equals("C")) { // NOI18N
   5.165 +            return "char"; // NOI18N
   5.166 +        } else if (type.equals("Z")) { // NOI18N
   5.167 +            return "boolean"; // NOI18N
   5.168 +        } else if (type.startsWith("L") && type.endsWith(";")) { // NOI18N
   5.169 +            String fqn = type.substring(1, type.length() - 1).replace('/', '.').replace('$', '.'); // NOI18N
   5.170 +            if (fqn.startsWith("java.lang.")) { // NOI18N
   5.171 +                fqn = fqn.substring(10, fqn.length());
   5.172 +            }
   5.173 +            return fqn;
   5.174 +        } else if (type.startsWith("[")) { // NOI18N
   5.175 +            return prettify(type.substring(1, type.length())) + "[]"; // NOI18N
   5.176 +        } else {
   5.177 +            // Should not happen.
   5.178 +            return "ILLEGAL<" + type + ">"; // NOI18N
   5.179 +        }
   5.180 +    }
   5.181 +    
   5.182 +    private static final class NbMarshalledObjectChildren extends Children.Keys {
   5.183 +        private final SerParser.ObjectWrapper ow;
   5.184 +        public NbMarshalledObjectChildren(SerParser.ObjectWrapper ow) {
   5.185 +            this.ow = ow;
   5.186 +        }
   5.187 +        protected void addNotify() {
   5.188 +            super.addNotify();
   5.189 +            setKeys(Collections.singleton(Boolean.TRUE));
   5.190 +        }
   5.191 +        protected void removeNotify() {
   5.192 +            setKeys(Collections.EMPTY_SET);
   5.193 +            super.removeNotify();
   5.194 +        }
   5.195 +        protected Node[] createNodes(Object key) {
   5.196 +            List pairs = ow.data;
   5.197 +            Iterator it = pairs.iterator();
   5.198 +            while (it.hasNext()) {
   5.199 +                Object pair = (Object)it.next();
   5.200 +                if (pair instanceof SerParser.NameValue) {
   5.201 +                    SerParser.NameValue nv = (SerParser.NameValue)pair;
   5.202 +                    if (nv.name.name.equals("objBytes") && nv.name.type.equals("[B")) { // NOI18N
   5.203 +                        SerParser.ArrayWrapper aw = (SerParser.ArrayWrapper)nv.value;
   5.204 +                        List vals = aw.values;
   5.205 +                        byte[] b = new byte[vals.size()];
   5.206 +                        for (int i = 0; i < b.length; i++) {
   5.207 +                            b[i] = ((Byte)vals.get(i)).byteValue();
   5.208 +                        }
   5.209 +                        InputStream is = new ByteArrayInputStream(b);
   5.210 +                        try {
   5.211 +                            SerParser.Stream stream = new SerParser(is).parse(NbBundle.getMessage(SerStructureNode.class, "LBL_ser_stream"));
   5.212 +                            return new Node[] {new SerStructureNode.StreamNode(stream)};
   5.213 +                        } catch (SerParser.CorruptException spce) {
   5.214 +                            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, spce);
   5.215 +                            return new Node[] {};
   5.216 +                        } catch (IOException ioe) {
   5.217 +                            ErrorManager.getDefault().notify(ioe);
   5.218 +                            return new Node[] {};
   5.219 +                        } catch (RuntimeException re) {
   5.220 +                            ErrorManager.getDefault().notify(re);
   5.221 +                            return new Node[] {};
   5.222 +                        }
   5.223 +                    }
   5.224 +                }
   5.225 +            }
   5.226 +            // Improper ser state.
   5.227 +            return new Node[] {};
   5.228 +        }
   5.229 +    }
   5.230 +    
   5.231 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/SerialBrowserTopNode.java	Fri Sep 17 18:38:20 2010 -0400
     6.3 @@ -0,0 +1,169 @@
     6.4 +/*
     6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 + *
     6.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
     6.8 + *
     6.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    6.10 + * Other names may be trademarks of their respective owners.
    6.11 + *
    6.12 + * The contents of this file are subject to the terms of either the GNU
    6.13 + * General Public License Version 2 only ("GPL") or the Common
    6.14 + * Development and Distribution License("CDDL") (collectively, the
    6.15 + * "License"). You may not use this file except in compliance with the
    6.16 + * License. You can obtain a copy of the License at
    6.17 + * http://www.netbeans.org/cddl-gplv2.html
    6.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    6.19 + * specific language governing permissions and limitations under the
    6.20 + * License.  When distributing the software, include this License Header
    6.21 + * Notice in each file and include the License file at
    6.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    6.23 + * particular file as subject to the "Classpath" exception as provided
    6.24 + * by Oracle in the GPL Version 2 section of the License file that
    6.25 + * accompanied this code. If applicable, add the following below the
    6.26 + * License Header, with the fields enclosed by brackets [] replaced by
    6.27 + * your own identifying information:
    6.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    6.29 + *
    6.30 + * If you wish your version of this file to be governed by only the CDDL
    6.31 + * or only the GPL Version 2, indicate your decision by adding
    6.32 + * "[Contributor] elects to include this software in this distribution
    6.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    6.34 + * single choice of license, a recipient has the option to distribute
    6.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    6.36 + * to extend the choice of license to its licensees as provided above.
    6.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    6.38 + * Version 2 license, then the option applies only if the new code is
    6.39 + * made subject to such option by the copyright holder.
    6.40 + *
    6.41 + * Contributor(s):
    6.42 + *
    6.43 + * Portions Copyrighted 2010 Sun Microsystems, Inc.
    6.44 + */
    6.45 +
    6.46 +package org.netbeans.modules.apisupport.beanbrowser.ser;
    6.47 +
    6.48 +import java.awt.event.ActionEvent;
    6.49 +import java.io.ByteArrayInputStream;
    6.50 +import java.io.File;
    6.51 +import java.io.FileInputStream;
    6.52 +import java.io.IOException;
    6.53 +import java.io.InputStream;
    6.54 +import java.math.BigInteger;
    6.55 +import java.util.ArrayList;
    6.56 +import java.util.List;
    6.57 +import java.util.Observable;
    6.58 +import java.util.Observer;
    6.59 +import javax.swing.AbstractAction;
    6.60 +import javax.swing.Action;
    6.61 +import javax.swing.JFileChooser;
    6.62 +import javax.swing.filechooser.FileNameExtensionFilter;
    6.63 +import org.netbeans.api.core.ide.ServicesTabNodeRegistration;
    6.64 +import org.netbeans.modules.apisupport.beanbrowser.ser.SerParser.Stream;
    6.65 +import org.openide.DialogDisplayer;
    6.66 +import org.openide.NotifyDescriptor;
    6.67 +import org.openide.nodes.AbstractNode;
    6.68 +import org.openide.nodes.ChildFactory;
    6.69 +import org.openide.nodes.Children;
    6.70 +import org.openide.nodes.Node;
    6.71 +import org.openide.windows.WindowManager;
    6.72 +
    6.73 +@ServicesTabNodeRegistration(name="ser", displayName="Serialized Beans", iconResource="org/netbeans/modules/apisupport/beanbrowser/ser/ser.gif", position=2015)
    6.74 +public class SerialBrowserTopNode extends AbstractNode {
    6.75 +
    6.76 +    private static final class Model extends Observable {
    6.77 +        final List<SerParser.Stream> streams = new ArrayList<SerParser.Stream>();
    6.78 +        void add(SerParser.Stream stream) {
    6.79 +            streams.add(stream);
    6.80 +            setChanged();
    6.81 +            notifyObservers();
    6.82 +        }
    6.83 +    }
    6.84 +
    6.85 +    private final Model model;
    6.86 +
    6.87 +    public SerialBrowserTopNode() {
    6.88 +        this(new Model());
    6.89 +    }
    6.90 +    private SerialBrowserTopNode(Model model) {
    6.91 +        super(Children.create(new Ch(model), false));
    6.92 +        this.model = model;
    6.93 +        setIconBase("org/netbeans/modules/apisupport/beanbrowser/ser/ser"); // NOI18N
    6.94 +        setName("ser");
    6.95 +        setDisplayName("Serialized Beans");
    6.96 +    }
    6.97 +
    6.98 +    private void add(InputStream is, String label) throws IOException {
    6.99 +        try {
   6.100 +            model.add(new SerParser(is).parse(label));
   6.101 +        } finally {
   6.102 +            is.close();
   6.103 +        }
   6.104 +    }
   6.105 +
   6.106 +    public @Override Action[] getActions(boolean context) {
   6.107 +        return new Action[] {
   6.108 +            new AbstractAction("Parse File") {
   6.109 +                public @Override void actionPerformed(ActionEvent e) {
   6.110 +                    JFileChooser c = new JFileChooser();
   6.111 +                    c.setFileFilter(new FileNameExtensionFilter("Serialized files", "ser"));
   6.112 +                    if (c.showOpenDialog(WindowManager.getDefault().getMainWindow()) == JFileChooser.APPROVE_OPTION) {
   6.113 +                        File f = c.getSelectedFile();
   6.114 +                        try {
   6.115 +                            add(new FileInputStream(f), f.getName());
   6.116 +                        } catch (IOException x) {
   6.117 +                            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(x.toString(), NotifyDescriptor.ERROR_MESSAGE));
   6.118 +                        }
   6.119 +                    }
   6.120 +                }
   6.121 +            },
   6.122 +            new AbstractAction("Parse Hex String") {
   6.123 +                public @Override void actionPerformed(ActionEvent e) {
   6.124 +                    NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine("Serial data as hex bytes (spaces OK):", "Enter Serialized Text");
   6.125 +                    if (DialogDisplayer.getDefault().notify(input) == NotifyDescriptor.OK_OPTION) {
   6.126 +                        try {
   6.127 +                            String text = input.getInputText().replaceAll("\\s+", "");
   6.128 +                            InputStream is = new ByteArrayInputStream(new BigInteger(text, 16).toByteArray());
   6.129 +                            is.read(); // discard initial zero sign byte
   6.130 +                            add(is, text.substring(0, Math.min(20, text.length())) + "…");
   6.131 +                        } catch (IOException x) {
   6.132 +                            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(x.toString(), NotifyDescriptor.ERROR_MESSAGE));
   6.133 +                        }
   6.134 +                    }
   6.135 +                }
   6.136 +            },
   6.137 +        };
   6.138 +    }
   6.139 +
   6.140 +    private static final class Ch extends ChildFactory.Detachable<SerParser.Stream> implements Observer {
   6.141 +
   6.142 +        private final Model model;
   6.143 +
   6.144 +        @SuppressWarnings("LeakingThisInConstructor")
   6.145 +        Ch(Model model) {
   6.146 +            this.model = model;
   6.147 +        }
   6.148 +
   6.149 +        protected @Override boolean createKeys(List<Stream> toPopulate) {
   6.150 +            toPopulate.addAll(model.streams);
   6.151 +            return true;
   6.152 +        }
   6.153 +
   6.154 +        protected @Override Node createNodeForKey(Stream key) {
   6.155 +            return new SerStructureNode.StreamNode(key);
   6.156 +        }
   6.157 +
   6.158 +        protected @Override void addNotify() {
   6.159 +            model.addObserver(this);
   6.160 +        }
   6.161 +
   6.162 +        protected @Override void removeNotify() {
   6.163 +            model.deleteObserver(this);
   6.164 +        }
   6.165 +
   6.166 +        public @Override void update(Observable o, Object arg) {
   6.167 +            refresh(false);
   6.168 +        }
   6.169 +
   6.170 +    }
   6.171 +
   6.172 +}
     7.1 Binary file apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/ser.gif has changed
     8.1 Binary file apisupport.beanbrowser/src/org/netbeans/modules/apisupport/beanbrowser/ser/serAlone.gif has changed
     9.1 --- a/apisupport.metainfservices/build.xml	Wed Sep 15 11:58:07 2010 +0530
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,46 +0,0 @@
     9.4 -<?xml version="1.0" encoding="UTF-8"?>
     9.5 -<!--
     9.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.7 -
     9.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
     9.9 -
    9.10 -
    9.11 -The contents of this file are subject to the terms of either the GNU
    9.12 -General Public License Version 2 only ("GPL") or the Common
    9.13 -Development and Distribution License("CDDL") (collectively, the
    9.14 -"License"). You may not use this file except in compliance with the
    9.15 -License. You can obtain a copy of the License at
    9.16 -http://www.netbeans.org/cddl-gplv2.html
    9.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.18 -specific language governing permissions and limitations under the
    9.19 -License.  When distributing the software, include this License Header
    9.20 -Notice in each file and include the License file at
    9.21 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    9.22 -particular file as subject to the "Classpath" exception as provided
    9.23 -by Sun in the GPL Version 2 section of the License file that
    9.24 -accompanied this code. If applicable, add the following below the
    9.25 -License Header, with the fields enclosed by brackets [] replaced by
    9.26 -your own identifying information:
    9.27 -"Portions Copyrighted [year] [name of copyright owner]"
    9.28 -
    9.29 -Contributor(s):
    9.30 -
    9.31 -The Original Software is NetBeans. The Initial Developer of the Original
    9.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    9.33 -Microsystems, Inc. All Rights Reserved.
    9.34 -
    9.35 -If you wish your version of this file to be governed by only the CDDL
    9.36 -or only the GPL Version 2, indicate your decision by adding
    9.37 -"[Contributor] elects to include this software in this distribution
    9.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.39 -single choice of license, a recipient has the option to distribute
    9.40 -your version of this file under either the CDDL, the GPL Version 2 or
    9.41 -to extend the choice of license to its licensees as provided above.
    9.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
    9.43 -Version 2 license, then the option applies only if the new code is
    9.44 -made subject to such option by the copyright holder.
    9.45 --->
    9.46 -<project basedir="." default="netbeans" name="contrib/apisupport.metainfservices">
    9.47 -    <description>Builds, tests, and runs the project org.netbeans.modules.apisupport.metainfservices</description>
    9.48 -    <import file="../../nbbuild/templates/projectized.xml"/>
    9.49 -</project>
    10.1 --- a/apisupport.metainfservices/manifest.mf	Wed Sep 15 11:58:07 2010 +0530
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,6 +0,0 @@
    10.4 -Manifest-Version: 1.0
    10.5 -OpenIDE-Module: org.netbeans.modules.apisupport.metainfservices
    10.6 -OpenIDE-Module-Layer: org/netbeans/modules/apisupport/metainfservices/layer.xml
    10.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/apisupport/metainfservices/Bundle.properties
    10.8 -OpenIDE-Module-Specification-Version: 1.8
    10.9 -
    11.1 --- a/apisupport.metainfservices/nbproject/project.properties	Wed Sep 15 11:58:07 2010 +0530
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,41 +0,0 @@
    11.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.5 -#
    11.6 -# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    11.7 -#
    11.8 -# The contents of this file are subject to the terms of either the GNU
    11.9 -# General Public License Version 2 only ("GPL") or the Common
   11.10 -# Development and Distribution License("CDDL") (collectively, the
   11.11 -# "License"). You may not use this file except in compliance with the
   11.12 -# License. You can obtain a copy of the License at
   11.13 -# http://www.netbeans.org/cddl-gplv2.html
   11.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.15 -# specific language governing permissions and limitations under the
   11.16 -# License.  When distributing the software, include this License Header
   11.17 -# Notice in each file and include the License file at
   11.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   11.19 -# particular file as subject to the "Classpath" exception as provided
   11.20 -# by Sun in the GPL Version 2 section of the License file that
   11.21 -# accompanied this code. If applicable, add the following below the
   11.22 -# License Header, with the fields enclosed by brackets [] replaced by
   11.23 -# your own identifying information:
   11.24 -# "Portions Copyrighted [year] [name of copyright owner]"
   11.25 -#
   11.26 -# Contributor(s):
   11.27 -#
   11.28 -# The Original Software is NetBeans. The Initial Developer of the Original
   11.29 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   11.30 -# Microsystems, Inc. All Rights Reserved.
   11.31 -#
   11.32 -# If you wish your version of this file to be governed by only the CDDL
   11.33 -# or only the GPL Version 2, indicate your decision by adding
   11.34 -# "[Contributor] elects to include this software in this distribution
   11.35 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.36 -# single choice of license, a recipient has the option to distribute
   11.37 -# your version of this file under either the CDDL, the GPL Version 2 or
   11.38 -# to extend the choice of license to its licensees as provided above.
   11.39 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   11.40 -# Version 2 license, then the option applies only if the new code is
   11.41 -# made subject to such option by the copyright holder.
   11.42 -
   11.43 -javac.compilerargs=-Xlint:unchecked
   11.44 -javac.source=1.5
    12.1 --- a/apisupport.metainfservices/nbproject/project.xml	Wed Sep 15 11:58:07 2010 +0530
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,152 +0,0 @@
    12.4 -<?xml version="1.0" encoding="UTF-8"?>
    12.5 -<!--
    12.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.7 -
    12.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    12.9 -
   12.10 -
   12.11 -The contents of this file are subject to the terms of either the GNU
   12.12 -General Public License Version 2 only ("GPL") or the Common
   12.13 -Development and Distribution License("CDDL") (collectively, the
   12.14 -"License"). You may not use this file except in compliance with the
   12.15 -License. You can obtain a copy of the License at
   12.16 -http://www.netbeans.org/cddl-gplv2.html
   12.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.18 -specific language governing permissions and limitations under the
   12.19 -License.  When distributing the software, include this License Header
   12.20 -Notice in each file and include the License file at
   12.21 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   12.22 -particular file as subject to the "Classpath" exception as provided
   12.23 -by Sun in the GPL Version 2 section of the License file that
   12.24 -accompanied this code. If applicable, add the following below the
   12.25 -License Header, with the fields enclosed by brackets [] replaced by
   12.26 -your own identifying information:
   12.27 -"Portions Copyrighted [year] [name of copyright owner]"
   12.28 -
   12.29 -Contributor(s):
   12.30 -
   12.31 -The Original Software is NetBeans. The Initial Developer of the Original
   12.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   12.33 -Microsystems, Inc. All Rights Reserved.
   12.34 -
   12.35 -If you wish your version of this file to be governed by only the CDDL
   12.36 -or only the GPL Version 2, indicate your decision by adding
   12.37 -"[Contributor] elects to include this software in this distribution
   12.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.39 -single choice of license, a recipient has the option to distribute
   12.40 -your version of this file under either the CDDL, the GPL Version 2 or
   12.41 -to extend the choice of license to its licensees as provided above.
   12.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
   12.43 -Version 2 license, then the option applies only if the new code is
   12.44 -made subject to such option by the copyright holder.
   12.45 --->
   12.46 -<project xmlns="http://www.netbeans.org/ns/project/1">
   12.47 -    <type>org.netbeans.modules.apisupport.project</type>
   12.48 -    <configuration>
   12.49 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
   12.50 -            <code-name-base>org.netbeans.modules.apisupport.metainfservices</code-name-base>
   12.51 -            <module-dependencies>
   12.52 -                <dependency>
   12.53 -                    <code-name-base>org.jdesktop.layout</code-name-base>
   12.54 -                    <build-prerequisite/>
   12.55 -                    <compile-dependency/>
   12.56 -                    <run-dependency>
   12.57 -                        <release-version>1</release-version>
   12.58 -                        <specification-version>1.3</specification-version>
   12.59 -                    </run-dependency>
   12.60 -                </dependency>
   12.61 -                <dependency>
   12.62 -                    <code-name-base>org.netbeans.libs.javacapi</code-name-base>
   12.63 -                    <build-prerequisite/>
   12.64 -                    <compile-dependency/>
   12.65 -                    <run-dependency>
   12.66 -                        <specification-version>0.5</specification-version>
   12.67 -                    </run-dependency>
   12.68 -                </dependency>
   12.69 -                <dependency>
   12.70 -                    <code-name-base>org.netbeans.modules.java.project</code-name-base>
   12.71 -                    <build-prerequisite/>
   12.72 -                    <compile-dependency/>
   12.73 -                    <run-dependency>
   12.74 -                        <release-version>1</release-version>
   12.75 -                        <specification-version>1.8</specification-version>
   12.76 -                    </run-dependency>
   12.77 -                </dependency>
   12.78 -                <dependency>
   12.79 -                    <code-name-base>org.netbeans.modules.java.source</code-name-base>
   12.80 -                    <build-prerequisite/>
   12.81 -                    <compile-dependency/>
   12.82 -                    <run-dependency>
   12.83 -                        <specification-version>0.4</specification-version>
   12.84 -                    </run-dependency>
   12.85 -                </dependency>
   12.86 -                <dependency>
   12.87 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
   12.88 -                    <build-prerequisite/>
   12.89 -                    <compile-dependency/>
   12.90 -                    <run-dependency>
   12.91 -                        <release-version>1</release-version>
   12.92 -                        <specification-version>1.8</specification-version>
   12.93 -                    </run-dependency>
   12.94 -                </dependency>
   12.95 -                <dependency>
   12.96 -                    <code-name-base>org.openide.awt</code-name-base>
   12.97 -                    <build-prerequisite/>
   12.98 -                    <compile-dependency/>
   12.99 -                    <run-dependency>
  12.100 -                        <specification-version>6.5</specification-version>
  12.101 -                    </run-dependency>
  12.102 -                </dependency>
  12.103 -                <dependency>
  12.104 -                    <code-name-base>org.openide.dialogs</code-name-base>
  12.105 -                    <build-prerequisite/>
  12.106 -                    <compile-dependency/>
  12.107 -                    <run-dependency>
  12.108 -                        <specification-version>6.5</specification-version>
  12.109 -                    </run-dependency>
  12.110 -                </dependency>
  12.111 -                <dependency>
  12.112 -                    <code-name-base>org.openide.filesystems</code-name-base>
  12.113 -                    <build-prerequisite/>
  12.114 -                    <compile-dependency/>
  12.115 -                    <run-dependency>
  12.116 -                        <specification-version>6.4</specification-version>
  12.117 -                    </run-dependency>
  12.118 -                </dependency>
  12.119 -                <dependency>
  12.120 -                    <code-name-base>org.openide.loaders</code-name-base>
  12.121 -                    <build-prerequisite/>
  12.122 -                    <compile-dependency/>
  12.123 -                    <run-dependency>
  12.124 -                        <specification-version>6.0</specification-version>
  12.125 -                    </run-dependency>
  12.126 -                </dependency>
  12.127 -                <dependency>
  12.128 -                    <code-name-base>org.openide.nodes</code-name-base>
  12.129 -                    <build-prerequisite/>
  12.130 -                    <compile-dependency/>
  12.131 -                    <run-dependency>
  12.132 -                        <specification-version>6.6</specification-version>
  12.133 -                    </run-dependency>
  12.134 -                </dependency>
  12.135 -                <dependency>
  12.136 -                    <code-name-base>org.openide.util</code-name-base>
  12.137 -                    <build-prerequisite/>
  12.138 -                    <compile-dependency/>
  12.139 -                    <run-dependency>
  12.140 -                        <specification-version>8.0</specification-version>
  12.141 -                    </run-dependency>
  12.142 -                </dependency>
  12.143 -                <dependency>
  12.144 -                    <code-name-base>org.openide.util.lookup</code-name-base>
  12.145 -                    <build-prerequisite/>
  12.146 -                    <compile-dependency/>
  12.147 -                    <run-dependency>
  12.148 -                        <specification-version>8.0</specification-version>
  12.149 -                    </run-dependency>
  12.150 -                </dependency>
  12.151 -            </module-dependencies>
  12.152 -            <public-packages/>
  12.153 -        </data>
  12.154 -    </configuration>
  12.155 -</project>
    13.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/Bundle.properties	Wed Sep 15 11:58:07 2010 +0530
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,54 +0,0 @@
    13.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.5 -#
    13.6 -# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    13.7 -#
    13.8 -# The contents of this file are subject to the terms of either the GNU
    13.9 -# General Public License Version 2 only ("GPL") or the Common
   13.10 -# Development and Distribution License("CDDL") (collectively, the
   13.11 -# "License"). You may not use this file except in compliance with the
   13.12 -# License. You can obtain a copy of the License at
   13.13 -# http://www.netbeans.org/cddl-gplv2.html
   13.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   13.15 -# specific language governing permissions and limitations under the
   13.16 -# License.  When distributing the software, include this License Header
   13.17 -# Notice in each file and include the License file at
   13.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   13.19 -# particular file as subject to the "Classpath" exception as provided
   13.20 -# by Sun in the GPL Version 2 section of the License file that
   13.21 -# accompanied this code. If applicable, add the following below the
   13.22 -# License Header, with the fields enclosed by brackets [] replaced by
   13.23 -# your own identifying information:
   13.24 -# "Portions Copyrighted [year] [name of copyright owner]"
   13.25 -#
   13.26 -# Contributor(s):
   13.27 -#
   13.28 -# The Original Software is NetBeans. The Initial Developer of the Original
   13.29 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   13.30 -# Microsystems, Inc. All Rights Reserved.
   13.31 -#
   13.32 -# If you wish your version of this file to be governed by only the CDDL
   13.33 -# or only the GPL Version 2, indicate your decision by adding
   13.34 -# "[Contributor] elects to include this software in this distribution
   13.35 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   13.36 -# single choice of license, a recipient has the option to distribute
   13.37 -# your version of this file under either the CDDL, the GPL Version 2 or
   13.38 -# to extend the choice of license to its licensees as provided above.
   13.39 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   13.40 -# Version 2 license, then the option applies only if the new code is
   13.41 -# made subject to such option by the copyright holder.
   13.42 -
   13.43 -CTL_ExportAction=Export as a Service...
   13.44 -
   13.45 -MSG_CannotFindClass=Cannot find public class in file {0}.
   13.46 -
   13.47 -OpenIDE-Module-Display-Category=Developing NetBeans
   13.48 -OpenIDE-Module-Long-Description=\
   13.49 -    NetBeans extension point system is built around declarative registation of services using META-INF/services files. \
   13.50 -    This module allows you to select a Java class and "export it as a service" - e.g. generate correct META-INF/services files semi-automatically.
   13.51 -OpenIDE-Module-Name=Export as a Service Wizard
   13.52 -
   13.53 -MSG_MetaInfDescription=This wizard is about to generate a registration file that will allow other\n\
   13.54 -   modules to discover your class using Lookup.getDefault().lookup(SomeInterface.class).\n\
   13.55 -   Please select one or more interfaces that you wish to export your class\n\
   13.56 -   as.\n
   13.57 -OpenIDE-Module-Short-Description=Simplifies creation of META-INF/services registrations
    14.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportAction.java	Wed Sep 15 11:58:07 2010 +0530
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,243 +0,0 @@
    14.4 -/*
    14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 - *
    14.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    14.8 - *
    14.9 - * The contents of this file are subject to the terms of either the GNU
   14.10 - * General Public License Version 2 only ("GPL") or the Common
   14.11 - * Development and Distribution License("CDDL") (collectively, the
   14.12 - * "License"). You may not use this file except in compliance with the
   14.13 - * License. You can obtain a copy of the License at
   14.14 - * http://www.netbeans.org/cddl-gplv2.html
   14.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.16 - * specific language governing permissions and limitations under the
   14.17 - * License.  When distributing the software, include this License Header
   14.18 - * Notice in each file and include the License file at
   14.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   14.20 - * particular file as subject to the "Classpath" exception as provided
   14.21 - * by Sun in the GPL Version 2 section of the License file that
   14.22 - * accompanied this code. If applicable, add the following below the
   14.23 - * License Header, with the fields enclosed by brackets [] replaced by
   14.24 - * your own identifying information:
   14.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   14.26 - *
   14.27 - * Contributor(s):
   14.28 - *
   14.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   14.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   14.31 - * Microsystems, Inc. All Rights Reserved.
   14.32 - *
   14.33 - * If you wish your version of this file to be governed by only the CDDL
   14.34 - * or only the GPL Version 2, indicate your decision by adding
   14.35 - * "[Contributor] elects to include this software in this distribution
   14.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.37 - * single choice of license, a recipient has the option to distribute
   14.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   14.39 - * to extend the choice of license to its licensees as provided above.
   14.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   14.41 - * Version 2 license, then the option applies only if the new code is
   14.42 - * made subject to such option by the copyright holder.
   14.43 - */
   14.44 -package org.netbeans.modules.apisupport.metainfservices;
   14.45 -
   14.46 -import com.sun.source.tree.Tree;
   14.47 -import com.sun.source.util.TreePath;
   14.48 -import java.awt.Dialog;
   14.49 -import java.io.FileNotFoundException;
   14.50 -import java.io.IOException;
   14.51 -import java.io.InputStream;
   14.52 -import java.io.OutputStream;
   14.53 -import java.util.Collection;
   14.54 -import java.util.List;
   14.55 -import java.util.TreeSet;
   14.56 -import java.util.logging.Level;
   14.57 -import java.util.logging.Logger;
   14.58 -import javax.lang.model.element.Element;
   14.59 -import javax.lang.model.element.TypeElement;
   14.60 -import javax.lang.model.type.TypeMirror;
   14.61 -import org.netbeans.api.java.project.JavaProjectConstants;
   14.62 -import org.netbeans.api.java.source.CancellableTask;
   14.63 -import org.netbeans.api.java.source.CompilationController;
   14.64 -import org.netbeans.api.java.source.JavaSource;
   14.65 -import org.netbeans.api.project.FileOwnerQuery;
   14.66 -import org.netbeans.api.project.Project;
   14.67 -import org.netbeans.api.project.ProjectUtils;
   14.68 -import org.netbeans.api.project.SourceGroup;
   14.69 -import org.netbeans.api.project.Sources;
   14.70 -import org.openide.DialogDisplayer;
   14.71 -import org.openide.ErrorManager;
   14.72 -import org.openide.NotifyDescriptor;
   14.73 -import org.openide.WizardDescriptor;
   14.74 -import org.openide.filesystems.FileLock;
   14.75 -import org.openide.filesystems.FileObject;
   14.76 -import org.openide.filesystems.FileUtil;
   14.77 -import org.openide.loaders.DataObject;
   14.78 -import org.openide.nodes.Node;
   14.79 -import org.openide.util.HelpCtx;
   14.80 -import org.openide.util.NbBundle;
   14.81 -import org.openide.util.actions.CookieAction;
   14.82 -
   14.83 -public final class ExportAction extends CookieAction {
   14.84 -    private static final Logger LOG = Logger.getLogger(ExportAction.class.getName());
   14.85 -    
   14.86 -    protected void performAction(Node[] activatedNodes) {
   14.87 -        MyTask task = new ExportAction.MyTask();
   14.88 -        FileObject fo = activatedNodes[0].getLookup().lookup(org.openide.filesystems.FileObject.class);
   14.89 -        if (fo == null) {
   14.90 -            return;
   14.91 -        }
   14.92 -        try {
   14.93 -            JavaSource source = JavaSource.forFileObject(fo);
   14.94 -            source.runUserActionTask(task, true);
   14.95 -        } catch (IOException ex) {
   14.96 -            LOG.log(Level.SEVERE, ex.getMessage(), ex);
   14.97 -        }
   14.98 -
   14.99 -        task.postProcess(fo);
  14.100 -    }
  14.101 -
  14.102 -    protected int mode() {
  14.103 -        return CookieAction.MODE_EXACTLY_ONE;
  14.104 -    }
  14.105 -    
  14.106 -    public String getName() {
  14.107 -        return NbBundle.getMessage(ExportAction.class, "CTL_ExportAction");
  14.108 -    }
  14.109 -    
  14.110 -    protected Class[] cookieClasses() {
  14.111 -        return new Class[] {
  14.112 -            DataObject.class
  14.113 -        };
  14.114 -    }
  14.115 -    
  14.116 -    protected void initialize() {
  14.117 -        super.initialize();
  14.118 -        // see org.openide.util.actions.SystemAction.iconResource() javadoc for more details
  14.119 -        putValue("noIconInMenu", Boolean.TRUE);
  14.120 -    }
  14.121 -    
  14.122 -    public HelpCtx getHelpCtx() {
  14.123 -        return HelpCtx.DEFAULT_HELP;
  14.124 -    }
  14.125 -    
  14.126 -    protected boolean asynchronous() {
  14.127 -        return false;
  14.128 -    }
  14.129 -
  14.130 -    private static final class MyTask implements CancellableTask<CompilationController> {
  14.131 -        Collection<String> allInterfaces = new TreeSet<String>();
  14.132 -        String clazzName;
  14.133 -        
  14.134 -        public void cancel() {
  14.135 -        }
  14.136 -
  14.137 -        public void run(CompilationController cont) throws Exception {
  14.138 -            cont.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
  14.139 -            for (Tree t : cont.getCompilationUnit().getTypeDecls()) {
  14.140 -                if (t.getKind() == Tree.Kind.CLASS) {
  14.141 -                    TreePath path = cont.getTrees().getPath(cont.getCompilationUnit(), t);
  14.142 -                    Element e = cont.getTrees().getElement(path);
  14.143 -                    if (e instanceof TypeElement) {
  14.144 -                        TypeElement te = (TypeElement)e;
  14.145 -                        clazzName = te.getQualifiedName().toString();
  14.146 -                    }
  14.147 -                    findInterfaces(cont, e);
  14.148 -                }
  14.149 -            }
  14.150 -        }
  14.151 -        
  14.152 -        private void findInterfaces(CompilationController cont, Element e) {
  14.153 -            if (e == null) {
  14.154 -                return;
  14.155 -            }
  14.156 -            if (!e.getKind().isClass() && !e.getKind().isInterface()) {
  14.157 -                return;
  14.158 -            }
  14.159 -            TypeElement type = (TypeElement)e;
  14.160 -            allInterfaces.add(type.getQualifiedName().toString());
  14.161 -            
  14.162 -            findInterfaces(cont, type.getSuperclass());
  14.163 -            for (TypeMirror m : type.getInterfaces()) {
  14.164 -                findInterfaces(cont, m);
  14.165 -            }
  14.166 -        }
  14.167 -        
  14.168 -        private void findInterfaces(CompilationController cont, TypeMirror m) {
  14.169 -            findInterfaces(cont, cont.getTypes().asElement(m));
  14.170 -        }
  14.171 -
  14.172 -        public void postProcess(FileObject fo) {
  14.173 -            FileObject target = null;
  14.174 -            Project p = FileOwnerQuery.getOwner(fo);
  14.175 -
  14.176 -            if (p != null) {
  14.177 -                Sources s = ProjectUtils.getSources(p);
  14.178 -                SourceGroup[] arr = s.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
  14.179 -                if (arr != null && arr.length > 0) {
  14.180 -                    target = arr[0].getRootFolder();
  14.181 -                }
  14.182 -            }
  14.183 -
  14.184 -
  14.185 -            if (allInterfaces.isEmpty() || clazzName == null) {
  14.186 -                NotifyDescriptor d = new NotifyDescriptor.Message(
  14.187 -                    NbBundle.getMessage(ExportAction.class, "MSG_CannotFindClass", fo),
  14.188 -                    NotifyDescriptor.WARNING_MESSAGE
  14.189 -                );
  14.190 -                DialogDisplayer.getDefault().notify(d);
  14.191 -                return;
  14.192 -            }
  14.193 -
  14.194 -            WizardDescriptor wd = new WizardDescriptor(new ExportWizardIterator());
  14.195 -
  14.196 -            wd.putProperty("implName", clazzName); // NOI18N
  14.197 -            wd.putProperty("interfaceNames", allInterfaces); // NOI18N
  14.198 -            wd.putProperty("target", target);
  14.199 -
  14.200 -            Dialog d = DialogDisplayer.getDefault().createDialog(wd);
  14.201 -            d.setVisible(true);
  14.202 -
  14.203 -            if (wd.FINISH_OPTION == wd.getValue()) {
  14.204 -                try {
  14.205 -                    createFiles(clazzName, wd, target);
  14.206 -                } catch (IOException ex) {
  14.207 -                    ErrorManager.getDefault().notify(ex);
  14.208 -                }
  14.209 -            }
  14.210 -        }
  14.211 -    }
  14.212 -    
  14.213 -    @SuppressWarnings("unchecked")
  14.214 -    private static void createFiles(String implName, WizardDescriptor wd, FileObject target)
  14.215 -    throws IOException, FileNotFoundException {
  14.216 -        List<String> files = (List<String>)wd.getProperty("files"); // NOI18N
  14.217 -        createFiles(implName, files, target);
  14.218 -    }
  14.219 -
  14.220 -    static void createFiles(String implName, List<String> files, FileObject target)
  14.221 -    throws IOException, FileNotFoundException {
  14.222 -        // lets apply the files
  14.223 -        for (String s : files) {
  14.224 -            FileObject f = FileUtil.createData(target, s);
  14.225 -            byte[] exist = new byte[(int)f.getSize()];
  14.226 -            InputStream is = f.getInputStream();
  14.227 -            int len = is.read(exist);
  14.228 -            is.close();
  14.229 -            //assert len == exist.length;
  14.230 -
  14.231 -            String content = new String(exist);
  14.232 -            if (content.length() > 0 && !content.endsWith("\n")) { // NOI18N
  14.233 -                content = content + "\n"; // NOI18N
  14.234 -            }
  14.235 -
  14.236 -            content = content + implName + "\n"; // NOI18N
  14.237 -
  14.238 -            FileLock lock = f.lock();
  14.239 -            OutputStream os = f.getOutputStream(lock);
  14.240 -            os.write(content.getBytes());
  14.241 -            os.close();
  14.242 -            lock.releaseLock();
  14.243 -        }
  14.244 -    }
  14.245 -}
  14.246 -
    15.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportVisualPanel1.form	Wed Sep 15 11:58:07 2010 +0530
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,98 +0,0 @@
    15.4 -<?xml version="1.0" encoding="UTF-8" ?>
    15.5 -
    15.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    15.7 -  <AuxValues>
    15.8 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
    15.9 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
   15.10 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   15.11 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   15.12 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   15.13 -  </AuxValues>
   15.14 -
   15.15 -  <Layout>
   15.16 -    <DimensionLayout dim="0">
   15.17 -      <Group type="103" groupAlignment="0" attributes="0">
   15.18 -          <Group type="102" alignment="0" attributes="0">
   15.19 -              <EmptySpace max="-2" attributes="0"/>
   15.20 -              <Group type="103" groupAlignment="0" attributes="0">
   15.21 -                  <Component id="jScrollPane2" alignment="1" pref="496" max="32767" attributes="1"/>
   15.22 -                  <Component id="description" alignment="1" max="32767" attributes="1"/>
   15.23 -                  <Component id="jScrollPane1" alignment="1" pref="496" max="32767" attributes="0"/>
   15.24 -                  <Component id="generatedLabel" alignment="0" min="-2" max="-2" attributes="0"/>
   15.25 -              </Group>
   15.26 -              <EmptySpace max="-2" attributes="0"/>
   15.27 -          </Group>
   15.28 -      </Group>
   15.29 -    </DimensionLayout>
   15.30 -    <DimensionLayout dim="1">
   15.31 -      <Group type="103" groupAlignment="0" attributes="0">
   15.32 -          <Group type="102" alignment="0" attributes="0">
   15.33 -              <EmptySpace max="-2" attributes="0"/>
   15.34 -              <Component id="description" min="-2" max="-2" attributes="0"/>
   15.35 -              <EmptySpace max="-2" attributes="0"/>
   15.36 -              <Component id="jScrollPane2" min="-2" pref="202" max="-2" attributes="0"/>
   15.37 -              <EmptySpace max="-2" attributes="0"/>
   15.38 -              <Component id="generatedLabel" min="-2" max="-2" attributes="0"/>
   15.39 -              <EmptySpace max="-2" attributes="0"/>
   15.40 -              <Component id="jScrollPane1" min="-2" pref="103" max="-2" attributes="0"/>
   15.41 -              <EmptySpace max="-2" attributes="0"/>
   15.42 -          </Group>
   15.43 -      </Group>
   15.44 -    </DimensionLayout>
   15.45 -  </Layout>
   15.46 -  <SubComponents>
   15.47 -    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
   15.48 -      <Properties>
   15.49 -        <Property name="focusCycleRoot" type="boolean" value="true"/>
   15.50 -      </Properties>
   15.51 -      <AuxValues>
   15.52 -        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
   15.53 -      </AuxValues>
   15.54 -
   15.55 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   15.56 -      <SubComponents>
   15.57 -        <Component class="javax.swing.JTable" name="table">
   15.58 -          <Properties>
   15.59 -            <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
   15.60 -              <Table columnCount="2" rowCount="0">
   15.61 -                <Column editable="true" title="Export this interface?" type="java.lang.Boolean"/>
   15.62 -                <Column editable="false" title="Class Name" type="java.lang.String"/>
   15.63 -              </Table>
   15.64 -            </Property>
   15.65 -          </Properties>
   15.66 -        </Component>
   15.67 -      </SubComponents>
   15.68 -    </Container>
   15.69 -    <Component class="javax.swing.JTextArea" name="description">
   15.70 -      <Properties>
   15.71 -        <Property name="columns" type="int" value="20"/>
   15.72 -        <Property name="editable" type="boolean" value="false"/>
   15.73 -        <Property name="rows" type="int" value="5"/>
   15.74 -        <Property name="text" type="java.lang.String" value="This wizard is about to generate a registration file that will allow other&#xa;modules to discover your class using Lookup.getDefault().lookup(SomeInterface.class).&#xa;Please select one or more interfaces that you which to export your class&#xa;as."/>
   15.75 -        <Property name="enabled" type="boolean" value="false"/>
   15.76 -      </Properties>
   15.77 -    </Component>
   15.78 -    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
   15.79 -      <AuxValues>
   15.80 -        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
   15.81 -      </AuxValues>
   15.82 -
   15.83 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
   15.84 -      <SubComponents>
   15.85 -        <Component class="javax.swing.JTextArea" name="generated">
   15.86 -          <Properties>
   15.87 -            <Property name="columns" type="int" value="20"/>
   15.88 -            <Property name="editable" type="boolean" value="false"/>
   15.89 -            <Property name="rows" type="int" value="5"/>
   15.90 -            <Property name="enabled" type="boolean" value="false"/>
   15.91 -          </Properties>
   15.92 -        </Component>
   15.93 -      </SubComponents>
   15.94 -    </Container>
   15.95 -    <Component class="javax.swing.JLabel" name="generatedLabel">
   15.96 -      <Properties>
   15.97 -        <Property name="text" type="java.lang.String" value="Generated Files:"/>
   15.98 -      </Properties>
   15.99 -    </Component>
  15.100 -  </SubComponents>
  15.101 -</Form>
    16.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportVisualPanel1.java	Wed Sep 15 11:58:07 2010 +0530
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,214 +0,0 @@
    16.4 -/*
    16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.6 - *
    16.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    16.8 - *
    16.9 - * The contents of this file are subject to the terms of either the GNU
   16.10 - * General Public License Version 2 only ("GPL") or the Common
   16.11 - * Development and Distribution License("CDDL") (collectively, the
   16.12 - * "License"). You may not use this file except in compliance with the
   16.13 - * License. You can obtain a copy of the License at
   16.14 - * http://www.netbeans.org/cddl-gplv2.html
   16.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   16.16 - * specific language governing permissions and limitations under the
   16.17 - * License.  When distributing the software, include this License Header
   16.18 - * Notice in each file and include the License file at
   16.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   16.20 - * particular file as subject to the "Classpath" exception as provided
   16.21 - * by Sun in the GPL Version 2 section of the License file that
   16.22 - * accompanied this code. If applicable, add the following below the
   16.23 - * License Header, with the fields enclosed by brackets [] replaced by
   16.24 - * your own identifying information:
   16.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   16.26 - *
   16.27 - * Contributor(s):
   16.28 - *
   16.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   16.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   16.31 - * Microsystems, Inc. All Rights Reserved.
   16.32 - *
   16.33 - * If you wish your version of this file to be governed by only the CDDL
   16.34 - * or only the GPL Version 2, indicate your decision by adding
   16.35 - * "[Contributor] elects to include this software in this distribution
   16.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   16.37 - * single choice of license, a recipient has the option to distribute
   16.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   16.39 - * to extend the choice of license to its licensees as provided above.
   16.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   16.41 - * Version 2 license, then the option applies only if the new code is
   16.42 - * made subject to such option by the copyright holder.
   16.43 - */
   16.44 -package org.netbeans.modules.apisupport.metainfservices;
   16.45 -
   16.46 -import java.io.File;
   16.47 -import java.util.ArrayList;
   16.48 -import java.util.Collection;
   16.49 -import java.util.List;
   16.50 -import javax.swing.JPanel;
   16.51 -import javax.swing.event.TableModelEvent;
   16.52 -import javax.swing.event.TableModelListener;
   16.53 -import javax.swing.table.DefaultTableModel;
   16.54 -
   16.55 -public final class ExportVisualPanel1 extends JPanel
   16.56 -implements TableModelListener{
   16.57 -    private List<String> files;
   16.58 -
   16.59 -    ExportWizardPanel1 panel;
   16.60 -    /** Creates new form ExportVisualPanel1 */
   16.61 -    public ExportVisualPanel1(ExportWizardPanel1 panel) {
   16.62 -        this.panel = panel;
   16.63 -        initComponents();
   16.64 -
   16.65 -        tableChanged(null);
   16.66 -    }
   16.67 -    
   16.68 -    public String getName() {
   16.69 -        return "Select Inteface to Export";
   16.70 -    }
   16.71 -
   16.72 -    final void fillTable(Collection<String> interfaces) {
   16.73 -        DefaultTableModel t = (DefaultTableModel)table.getModel();
   16.74 -        if (t.getRowCount() > 0) {
   16.75 -            return;
   16.76 -        }
   16.77 -
   16.78 -        for (String s : interfaces) {
   16.79 -            t.addRow(new Object[] { Boolean.FALSE, s });
   16.80 -        }
   16.81 -
   16.82 -        t.addTableModelListener(this);
   16.83 -    }
   16.84 -
   16.85 -    final List<String> generatedFiles() {
   16.86 -        return files;
   16.87 -    }
   16.88 -
   16.89 -
   16.90 -    public void tableChanged(TableModelEvent e) {
   16.91 -        StringBuffer modifiedFiles = new StringBuffer();
   16.92 -        List<String> f = new ArrayList<String>();
   16.93 -
   16.94 -        boolean one = false;
   16.95 -        DefaultTableModel t = (DefaultTableModel)table.getModel();
   16.96 -        for (int i = 0; i < t.getRowCount(); i++) {
   16.97 -            Boolean b = (Boolean)t.getValueAt(i, 0);
   16.98 -            if (Boolean.TRUE.equals(b)) {
   16.99 -                one = true;
  16.100 -                modifiedFiles.append(panel.getTarget().getPath())
  16.101 -                .append(File.separatorChar)
  16.102 -                .append("META-INF")
  16.103 -                .append(File.separatorChar)
  16.104 -                .append("services")
  16.105 -                .append(File.separatorChar)
  16.106 -                .append(t.getValueAt(i, 1).toString())
  16.107 -                .append("\n");
  16.108 -
  16.109 -                f.add("META-INF/services/" + t.getValueAt(i, 1).toString());
  16.110 -            }
  16.111 -        }
  16.112 -        panel.setValid(one);
  16.113 -
  16.114 -        generated.setText(modifiedFiles.toString());
  16.115 -
  16.116 -        files = f;
  16.117 -    }
  16.118 -
  16.119 -    /** This method is called from within the constructor to
  16.120 -     * initialize the form.
  16.121 -     * WARNING: Do NOT modify this code. The content of this method is
  16.122 -     * always regenerated by the Form Editor.
  16.123 -     */
  16.124 -    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  16.125 -    private void initComponents() {
  16.126 -
  16.127 -        jScrollPane2 = new javax.swing.JScrollPane();
  16.128 -        table = new javax.swing.JTable();
  16.129 -        description = new javax.swing.JTextArea();
  16.130 -        jScrollPane1 = new javax.swing.JScrollPane();
  16.131 -        generated = new javax.swing.JTextArea();
  16.132 -        generatedLabel = new javax.swing.JLabel();
  16.133 -
  16.134 -        jScrollPane2.setFocusCycleRoot(true);
  16.135 -
  16.136 -        table.setModel(new javax.swing.table.DefaultTableModel(
  16.137 -            new Object [][] {
  16.138 -
  16.139 -            },
  16.140 -            new String [] {
  16.141 -                "Export this interface?", "Class Name"
  16.142 -            }
  16.143 -        ) {
  16.144 -            Class[] types = new Class [] {
  16.145 -                java.lang.Boolean.class, java.lang.String.class
  16.146 -            };
  16.147 -            boolean[] canEdit = new boolean [] {
  16.148 -                true, false
  16.149 -            };
  16.150 -
  16.151 -            public Class getColumnClass(int columnIndex) {
  16.152 -                return types [columnIndex];
  16.153 -            }
  16.154 -
  16.155 -            public boolean isCellEditable(int rowIndex, int columnIndex) {
  16.156 -                return canEdit [columnIndex];
  16.157 -            }
  16.158 -        });
  16.159 -        jScrollPane2.setViewportView(table);
  16.160 -
  16.161 -        description.setColumns(20);
  16.162 -        description.setEditable(false);
  16.163 -        description.setRows(5);
  16.164 -        description.setText("This wizard is about to generate a registration file that will allow other\nmodules to discover your class using Lookup.getDefault().lookup(SomeInterface.class).\nPlease select one or more interfaces that you which to export your class\nas.");
  16.165 -        description.setEnabled(false);
  16.166 -
  16.167 -        generated.setColumns(20);
  16.168 -        generated.setEditable(false);
  16.169 -        generated.setRows(5);
  16.170 -        generated.setEnabled(false);
  16.171 -        jScrollPane1.setViewportView(generated);
  16.172 -
  16.173 -        org.openide.awt.Mnemonics.setLocalizedText(generatedLabel, "Generated Files:");
  16.174 -
  16.175 -        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
  16.176 -        this.setLayout(layout);
  16.177 -        layout.setHorizontalGroup(
  16.178 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  16.179 -            .add(layout.createSequentialGroup()
  16.180 -                .addContainerGap()
  16.181 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  16.182 -                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE)
  16.183 -                    .add(org.jdesktop.layout.GroupLayout.TRAILING, description)
  16.184 -                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE)
  16.185 -                    .add(generatedLabel))
  16.186 -                .addContainerGap())
  16.187 -        );
  16.188 -        layout.setVerticalGroup(
  16.189 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  16.190 -            .add(layout.createSequentialGroup()
  16.191 -                .addContainerGap()
  16.192 -                .add(description, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  16.193 -                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  16.194 -                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  16.195 -                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  16.196 -                .add(generatedLabel)
  16.197 -                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  16.198 -                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 103, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  16.199 -                .addContainerGap())
  16.200 -        );
  16.201 -    }// </editor-fold>//GEN-END:initComponents
  16.202 -    
  16.203 -    
  16.204 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  16.205 -    private javax.swing.JTextArea description;
  16.206 -    private javax.swing.JTextArea generated;
  16.207 -    private javax.swing.JLabel generatedLabel;
  16.208 -    private javax.swing.JScrollPane jScrollPane1;
  16.209 -    private javax.swing.JScrollPane jScrollPane2;
  16.210 -    private javax.swing.JTable table;
  16.211 -    // End of variables declaration//GEN-END:variables
  16.212 -
  16.213 -
  16.214 -
  16.215 -
  16.216 -}
  16.217 -
    17.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportWizardIterator.java	Wed Sep 15 11:58:07 2010 +0530
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,166 +0,0 @@
    17.4 -/*
    17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.6 - *
    17.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    17.8 - *
    17.9 - * The contents of this file are subject to the terms of either the GNU
   17.10 - * General Public License Version 2 only ("GPL") or the Common
   17.11 - * Development and Distribution License("CDDL") (collectively, the
   17.12 - * "License"). You may not use this file except in compliance with the
   17.13 - * License. You can obtain a copy of the License at
   17.14 - * http://www.netbeans.org/cddl-gplv2.html
   17.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   17.16 - * specific language governing permissions and limitations under the
   17.17 - * License.  When distributing the software, include this License Header
   17.18 - * Notice in each file and include the License file at
   17.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   17.20 - * particular file as subject to the "Classpath" exception as provided
   17.21 - * by Sun in the GPL Version 2 section of the License file that
   17.22 - * accompanied this code. If applicable, add the following below the
   17.23 - * License Header, with the fields enclosed by brackets [] replaced by
   17.24 - * your own identifying information:
   17.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   17.26 - *
   17.27 - * Contributor(s):
   17.28 - *
   17.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   17.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   17.31 - * Microsystems, Inc. All Rights Reserved.
   17.32 - *
   17.33 - * If you wish your version of this file to be governed by only the CDDL
   17.34 - * or only the GPL Version 2, indicate your decision by adding
   17.35 - * "[Contributor] elects to include this software in this distribution
   17.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   17.37 - * single choice of license, a recipient has the option to distribute
   17.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   17.39 - * to extend the choice of license to its licensees as provided above.
   17.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   17.41 - * Version 2 license, then the option applies only if the new code is
   17.42 - * made subject to such option by the copyright holder.
   17.43 - */
   17.44 -package org.netbeans.modules.apisupport.metainfservices;
   17.45 -
   17.46 -import java.awt.Component;
   17.47 -import java.util.NoSuchElementException;
   17.48 -import javax.swing.JComponent;
   17.49 -import javax.swing.event.ChangeListener;
   17.50 -import org.openide.WizardDescriptor;
   17.51 -
   17.52 -public final class ExportWizardIterator implements WizardDescriptor.Iterator<WizardDescriptor> {
   17.53 -
   17.54 -    // To invoke this wizard, copy-paste and run the following code, e.g. from
   17.55 -    // SomeAction.performAction():
   17.56 -    /*
   17.57 -    WizardDescriptor.Iterator iterator = new ExportWizardIterator();
   17.58 -    WizardDescriptor wizardDescriptor = new WizardDescriptor(iterator);
   17.59 -    // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName()
   17.60 -    // {1} will be replaced by WizardDescriptor.Iterator.name()
   17.61 -    wizardDescriptor.setTitleFormat(new MessageFormat("{0} ({1})"));
   17.62 -    wizardDescriptor.setTitle("Your wizard dialog title here");
   17.63 -    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
   17.64 -    dialog.setVisible(true);
   17.65 -    dialog.toFront();
   17.66 -    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
   17.67 -    if (!cancelled) {
   17.68 -        // do something
   17.69 -    }
   17.70 -     */
   17.71 -    
   17.72 -    private int index;
   17.73 -    
   17.74 -    private ExportWizardPanel1[] panels;
   17.75 -    
   17.76 -    /**
   17.77 -     * Initialize panels representing individual wizard's steps and sets
   17.78 -     * various properties for them influencing wizard appearance.
   17.79 -     */
   17.80 -    private ExportWizardPanel1[] getPanels() {
   17.81 -        if (panels == null) {
   17.82 -            panels = new ExportWizardPanel1[] {
   17.83 -                new ExportWizardPanel1(),
   17.84 -            };
   17.85 -            String[] steps = new String[panels.length];
   17.86 -            for (int i = 0; i < panels.length; i++) {
   17.87 -                Component c = panels[i].getComponent();
   17.88 -                // Default step name to component name of panel.
   17.89 -                steps[i] = c.getName();
   17.90 -                if (c instanceof JComponent) { // assume Swing components
   17.91 -                    JComponent jc = (JComponent) c;
   17.92 -                    // Sets step number of a component
   17.93 -                    jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
   17.94 -                    // Sets steps names for a panel
   17.95 -                    jc.putClientProperty("WizardPanel_contentData", steps);
   17.96 -                    // Turn on subtitle creation on each step
   17.97 -                    jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
   17.98 -                    // Show steps on the left side with the image on the background
   17.99 -                    jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
  17.100 -                    // Turn on numbering of all steps
  17.101 -                    jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
  17.102 -                }
  17.103 -            }
  17.104 -        }
  17.105 -        return panels;
  17.106 -    }
  17.107 -    
  17.108 -    public WizardDescriptor.Panel<WizardDescriptor> current() {
  17.109 -        return getPanels()[index];
  17.110 -    }
  17.111 -    
  17.112 -    public String name() {
  17.113 -        return index + 1 + ". from " + getPanels().length;
  17.114 -    }
  17.115 -    
  17.116 -    public boolean hasNext() {
  17.117 -        return index < getPanels().length - 1;
  17.118 -    }
  17.119 -    
  17.120 -    public boolean hasPrevious() {
  17.121 -        return index > 0;
  17.122 -    }
  17.123 -    
  17.124 -    public void nextPanel() {
  17.125 -        if (!hasNext()) {
  17.126 -            throw new NoSuchElementException();
  17.127 -        }
  17.128 -        index++;
  17.129 -    }
  17.130 -    
  17.131 -    public void previousPanel() {
  17.132 -        if (!hasPrevious()) {
  17.133 -            throw new NoSuchElementException();
  17.134 -        }
  17.135 -        index--;
  17.136 -    }
  17.137 -    
  17.138 -    // If nothing unusual changes in the middle of the wizard, simply:
  17.139 -    public void addChangeListener(ChangeListener l) {}
  17.140 -    public void removeChangeListener(ChangeListener l) {}
  17.141 -    
  17.142 -    // If something changes dynamically (besides moving between panels), e.g.
  17.143 -    // the number of panels changes in response to user input, then uncomment
  17.144 -    // the following and call when needed: fireChangeEvent();
  17.145 -    /*
  17.146 -    private Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
  17.147 -    public final void addChangeListener(ChangeListener l) {
  17.148 -        synchronized (listeners) {
  17.149 -            listeners.add(l);
  17.150 -        }
  17.151 -    }
  17.152 -    public final void removeChangeListener(ChangeListener l) {
  17.153 -        synchronized (listeners) {
  17.154 -            listeners.remove(l);
  17.155 -        }
  17.156 -    }
  17.157 -    protected final void fireChangeEvent() {
  17.158 -        Iterator<ChangeListener> it;
  17.159 -        synchronized (listeners) {
  17.160 -            it = new HashSet<ChangeListener>(listeners).iterator();
  17.161 -        }
  17.162 -        ChangeEvent ev = new ChangeEvent(this);
  17.163 -        while (it.hasNext()) {
  17.164 -            it.next().stateChanged(ev);
  17.165 -        }
  17.166 -    }
  17.167 -     */
  17.168 -    
  17.169 -}
    18.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/ExportWizardPanel1.java	Wed Sep 15 11:58:07 2010 +0530
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,129 +0,0 @@
    18.4 -/*
    18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.6 - *
    18.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    18.8 - *
    18.9 - * The contents of this file are subject to the terms of either the GNU
   18.10 - * General Public License Version 2 only ("GPL") or the Common
   18.11 - * Development and Distribution License("CDDL") (collectively, the
   18.12 - * "License"). You may not use this file except in compliance with the
   18.13 - * License. You can obtain a copy of the License at
   18.14 - * http://www.netbeans.org/cddl-gplv2.html
   18.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   18.16 - * specific language governing permissions and limitations under the
   18.17 - * License.  When distributing the software, include this License Header
   18.18 - * Notice in each file and include the License file at
   18.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   18.20 - * particular file as subject to the "Classpath" exception as provided
   18.21 - * by Sun in the GPL Version 2 section of the License file that
   18.22 - * accompanied this code. If applicable, add the following below the
   18.23 - * License Header, with the fields enclosed by brackets [] replaced by
   18.24 - * your own identifying information:
   18.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   18.26 - *
   18.27 - * Contributor(s):
   18.28 - *
   18.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   18.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   18.31 - * Microsystems, Inc. All Rights Reserved.
   18.32 - *
   18.33 - * If you wish your version of this file to be governed by only the CDDL
   18.34 - * or only the GPL Version 2, indicate your decision by adding
   18.35 - * "[Contributor] elects to include this software in this distribution
   18.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   18.37 - * single choice of license, a recipient has the option to distribute
   18.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   18.39 - * to extend the choice of license to its licensees as provided above.
   18.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   18.41 - * Version 2 license, then the option applies only if the new code is
   18.42 - * made subject to such option by the copyright holder.
   18.43 - */
   18.44 -package org.netbeans.modules.apisupport.metainfservices;
   18.45 -
   18.46 -import java.awt.Component;
   18.47 -import java.util.*;
   18.48 -import javax.swing.event.ChangeEvent;
   18.49 -import javax.swing.event.ChangeListener;
   18.50 -import org.openide.WizardDescriptor;
   18.51 -import org.openide.util.HelpCtx;
   18.52 -import org.openide.filesystems.FileObject;
   18.53 -
   18.54 -public class ExportWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor> {
   18.55 -
   18.56 -    /**
   18.57 -     * The visual component that displays this panel. If you need to access the
   18.58 -     * component from this class, just use getComponent().
   18.59 -     */
   18.60 -    private ExportVisualPanel1 component;
   18.61 -
   18.62 -    private boolean valid;
   18.63 -    private FileObject target;
   18.64 -
   18.65 -    // Get the visual component for the panel. In this template, the component
   18.66 -    // is kept separate. This can be more efficient: if the wizard is created
   18.67 -    // but never displayed, or not all panels are displayed, it is better to
   18.68 -    // create only those which really need to be visible.
   18.69 -    public Component getComponent() {
   18.70 -        if (component == null) {
   18.71 -            component = new ExportVisualPanel1(this);
   18.72 -        }
   18.73 -        return component;
   18.74 -    }
   18.75 -    
   18.76 -    public HelpCtx getHelp() {
   18.77 -        // Show no Help button for this panel:
   18.78 -        return HelpCtx.DEFAULT_HELP;
   18.79 -        // If you have context help:
   18.80 -        // return new HelpCtx(SampleWizardPanel1.class);
   18.81 -    }
   18.82 -
   18.83 -    final FileObject getTarget() {
   18.84 -        return target;
   18.85 -    }
   18.86 -    
   18.87 -    public boolean isValid() {
   18.88 -        return valid;
   18.89 -    }
   18.90 -
   18.91 -    final void setValid(boolean b) {
   18.92 -        this.valid = b;
   18.93 -        fireChangeEvent();
   18.94 -    }
   18.95 -    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(11);
   18.96 -    public final void addChangeListener(ChangeListener l) {
   18.97 -        synchronized (listeners) {
   18.98 -            listeners.add(l);
   18.99 -        }
  18.100 -    }
  18.101 -    public final void removeChangeListener(ChangeListener l) {
  18.102 -        synchronized (listeners) {
  18.103 -            listeners.remove(l);
  18.104 -        }
  18.105 -    }
  18.106 -    protected final void fireChangeEvent() {
  18.107 -        Iterator<ChangeListener> it;
  18.108 -        synchronized (listeners) {
  18.109 -            it = new HashSet<ChangeListener>(listeners).iterator();
  18.110 -        }
  18.111 -        ChangeEvent ev = new ChangeEvent(this);
  18.112 -        while (it.hasNext()) {
  18.113 -            it.next().stateChanged(ev);
  18.114 -        }
  18.115 -    }
  18.116 -    
  18.117 -    public void readSettings(WizardDescriptor wd) {
  18.118 -        String impl = (String)wd.getProperty("implName"); // NOI18N
  18.119 -        @SuppressWarnings("unchecked")
  18.120 -        Collection<String> interfaces = (Collection<String>)wd.getProperty("interfaceNames"); // NOI18N
  18.121 -        target = (FileObject)wd.getProperty("target"); // NOI18N
  18.122 -
  18.123 -        if (component != null) {
  18.124 -            component.fillTable(interfaces);
  18.125 -        }
  18.126 -    }
  18.127 -    public void storeSettings(WizardDescriptor wd) {
  18.128 -        wd.putProperty("files", component.generatedFiles());
  18.129 -    }
  18.130 -    
  18.131 -}
  18.132 -
    19.1 --- a/apisupport.metainfservices/src/org/netbeans/modules/apisupport/metainfservices/layer.xml	Wed Sep 15 11:58:07 2010 +0530
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,33 +0,0 @@
    19.4 -<?xml version="1.0" encoding="UTF-8"?>
    19.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
    19.6 -<filesystem>
    19.7 -    <folder name="Actions">
    19.8 -        <folder name="Tools">
    19.9 -            <file name="org-netbeans-modules-apisupport-metainfservices-ExportAction.instance"/>
   19.10 -        </folder>
   19.11 -    </folder>
   19.12 -    <folder name="Editors">
   19.13 -        <folder name="text">
   19.14 -            <folder name="x-java">
   19.15 -                <folder name="Popup">
   19.16 -                    <file name="org-netbeans-modules-apisupport-metainfservices-ExportAction.shadow">
   19.17 -                        <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-apisupport-metainfservices-ExportAction.instance"/>
   19.18 -                        <attr name="position" intvalue="9755"/>
   19.19 -                    </file>
   19.20 -                </folder>
   19.21 -            </folder>
   19.22 -        </folder>
   19.23 -    </folder>
   19.24 -    <folder name="Loaders">
   19.25 -        <folder name="text">
   19.26 -            <folder name="x-java">
   19.27 -                <folder name="Actions">
   19.28 -                    <file name="org-netbeans-modules-apisupport-metainfservices-ExportAction.shadow">
   19.29 -                        <attr name="originalFile" stringvalue="Actions/Tools/org-netbeans-modules-apisupport-metainfservices-ExportAction.instance"/>
   19.30 -                        <attr name="position" intvalue="2078"/>
   19.31 -                    </file>
   19.32 -                </folder>
   19.33 -            </folder>
   19.34 -        </folder>
   19.35 -    </folder>
   19.36 -</filesystem>
    20.1 --- a/apisupport.metainfservices/test/unit/src/org/netbeans/modules/apisupport/metainfservices/ExportActionTest.java	Wed Sep 15 11:58:07 2010 +0530
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,144 +0,0 @@
    20.4 -/*
    20.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    20.6 - *
    20.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    20.8 - *
    20.9 - * The contents of this file are subject to the terms of either the GNU
   20.10 - * General Public License Version 2 only ("GPL") or the Common
   20.11 - * Development and Distribution License("CDDL") (collectively, the
   20.12 - * "License"). You may not use this file except in compliance with the
   20.13 - * License. You can obtain a copy of the License at
   20.14 - * http://www.netbeans.org/cddl-gplv2.html
   20.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   20.16 - * specific language governing permissions and limitations under the
   20.17 - * License.  When distributing the software, include this License Header
   20.18 - * Notice in each file and include the License file at
   20.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   20.20 - * particular file as subject to the "Classpath" exception as provided
   20.21 - * by Sun in the GPL Version 2 section of the License file that
   20.22 - * accompanied this code. If applicable, add the following below the
   20.23 - * License Header, with the fields enclosed by brackets [] replaced by
   20.24 - * your own identifying information:
   20.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   20.26 - *
   20.27 - * Contributor(s):
   20.28 - *
   20.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   20.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   20.31 - * Microsystems, Inc. All Rights Reserved.
   20.32 - *
   20.33 - * If you wish your version of this file to be governed by only the CDDL
   20.34 - * or only the GPL Version 2, indicate your decision by adding
   20.35 - * "[Contributor] elects to include this software in this distribution
   20.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   20.37 - * single choice of license, a recipient has the option to distribute
   20.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   20.39 - * to extend the choice of license to its licensees as provided above.
   20.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   20.41 - * Version 2 license, then the option applies only if the new code is
   20.42 - * made subject to such option by the copyright holder.
   20.43 - */
   20.44 -package org.netbeans.modules.apisupport.metainfservices;
   20.45 -
   20.46 -import java.net.URL;
   20.47 -import java.net.URLClassLoader;
   20.48 -import java.util.ArrayList;
   20.49 -import java.util.Set;
   20.50 -import org.netbeans.junit.NbTestCase;
   20.51 -import org.openide.filesystems.FileObject;
   20.52 -import org.openide.filesystems.FileSystem;
   20.53 -import org.openide.filesystems.FileUtil;
   20.54 -import org.openide.filesystems.LocalFileSystem;
   20.55 -import org.openide.util.Lookup;
   20.56 -import org.openide.util.lookup.Lookups;
   20.57 -
   20.58 -public class ExportActionTest extends NbTestCase {
   20.59 -    
   20.60 -    public ExportActionTest(String testName) {
   20.61 -        super(testName);
   20.62 -    }
   20.63 -
   20.64 -    protected void setUp() throws Exception {
   20.65 -        clearWorkDir();
   20.66 -    }
   20.67 -
   20.68 -    protected void tearDown() throws Exception {
   20.69 -    }
   20.70 -
   20.71 -    public void testGenerateFiles() throws Exception {
   20.72 -        LocalFileSystem lfs = new LocalFileSystem();
   20.73 -        lfs.setRootDirectory(getWorkDir());
   20.74 -
   20.75 -        FileSystem fs = lfs;
   20.76 -        FileObject src = FileUtil.createFolder(fs.getRoot(), "src");
   20.77 -
   20.78 -        ArrayList<String> files = new ArrayList<String>();
   20.79 -        files.add("META-INF/services/java.lang.Object");
   20.80 -        files.add("META-INF/services/java.lang.Runnable");
   20.81 -
   20.82 -        ExportAction.createFiles(R.class.getName(), files, src);
   20.83 -
   20.84 -        URLClassLoader loader = new URLClassLoader(new URL[] { src.getURL() }, getClass().getClassLoader());
   20.85 -        Lookup l = Lookups.metaInfServices(loader);
   20.86 -
   20.87 -        Runnable r = l.lookup(Runnable.class);
   20.88 -
   20.89 -        assertNotNull("Runnable found", r);
   20.90 -        assertEquals("It is my class", R.class, r.getClass());
   20.91 -
   20.92 -
   20.93 -        ExportAction.createFiles(Q.class.getName(), files, src);
   20.94 -
   20.95 -        l = Lookups.metaInfServices(loader);
   20.96 -        Set<Class<? extends Runnable>> all = l.lookupResult(Runnable.class).allClasses();
   20.97 -
   20.98 -        assertEquals(2, all.size());
   20.99 -        assertTrue("Q is there", all.contains(Q.class));
  20.100 -        assertTrue("R is there", all.contains(R.class));
  20.101 -    }
  20.102 -
  20.103 -    /* XXX would need to be rewritten:
  20.104 -    public void testRemovesAnnotations() throws Exception {
  20.105 -        JavaClassImpl impl = new JavaClassImpl();
  20.106 -        impl.setName("org.tst.Test");
  20.107 -        impl.setSimpleName("Test");
  20.108 -
  20.109 -        JavaClassImpl par = new JavaClassImpl();
  20.110 -        par.setName("org.par.Parent <X,Y>");
  20.111 -        par.setSimpleName("Parent <X,Y>");
  20.112 -
  20.113 -        impl.setSuperClass(par);
  20.114 -
  20.115 -        JavaClassImpl obj = new JavaClassImpl();
  20.116 -        obj.setName("java.lang.Object");
  20.117 -        obj.setSimpleName("Object");
  20.118 -
  20.119 -        par.setSuperClass(obj);
  20.120 -
  20.121 -        ArrayList<String> names = new ArrayList<String>();
  20.122 -        ExportAction.findInterfaces(impl, names);
  20.123 -
  20.124 -        assertEquals("Three", 3, names.size());
  20.125 -
  20.126 -        for (String n : names) {
  20.127 -            if (n.indexOf("<") >= 0) {
  20.128 -                fail("Contains wrong char: " + n);
  20.129 -            }
  20.130 -            if (n.endsWith(" ")) {
  20.131 -                fail("Ends with space:[" + n + "]");
  20.132 -            }
  20.133 -        }
  20.134 -    }
  20.135 -     */
  20.136 -
  20.137 -    public static class R extends Object implements Runnable {
  20.138 -        public void run() {
  20.139 -        }
  20.140 -    }
  20.141 -
  20.142 -    public static class Q implements Runnable {
  20.143 -        public void run() {
  20.144 -        }
  20.145 -    }
  20.146 -
  20.147 -}
    21.1 --- a/clazz/build.xml	Wed Sep 15 11:58:07 2010 +0530
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,48 +0,0 @@
    21.4 -<?xml version="1.0" encoding="UTF-8"?>
    21.5 -<!--
    21.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    21.7 -
    21.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    21.9 -
   21.10 -
   21.11 -The contents of this file are subject to the terms of either the GNU
   21.12 -General Public License Version 2 only ("GPL") or the Common
   21.13 -Development and Distribution License("CDDL") (collectively, the
   21.14 -"License"). You may not use this file except in compliance with the
   21.15 -License. You can obtain a copy of the License at
   21.16 -http://www.netbeans.org/cddl-gplv2.html
   21.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   21.18 -specific language governing permissions and limitations under the
   21.19 -License.  When distributing the software, include this License Header
   21.20 -Notice in each file and include the License file at
   21.21 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   21.22 -particular file as subject to the "Classpath" exception as provided
   21.23 -by Sun in the GPL Version 2 section of the License file that
   21.24 -accompanied this code. If applicable, add the following below the
   21.25 -License Header, with the fields enclosed by brackets [] replaced by
   21.26 -your own identifying information:
   21.27 -"Portions Copyrighted [year] [name of copyright owner]"
   21.28 -
   21.29 -Contributor(s):
   21.30 -
   21.31 -The Original Software is NetBeans. The Initial Developer of the Original
   21.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   21.33 -Microsystems, Inc. All Rights Reserved.
   21.34 -
   21.35 -If you wish your version of this file to be governed by only the CDDL
   21.36 -or only the GPL Version 2, indicate your decision by adding
   21.37 -"[Contributor] elects to include this software in this distribution
   21.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   21.39 -single choice of license, a recipient has the option to distribute
   21.40 -your version of this file under either the CDDL, the GPL Version 2 or
   21.41 -to extend the choice of license to its licensees as provided above.
   21.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
   21.43 -Version 2 license, then the option applies only if the new code is
   21.44 -made subject to such option by the copyright holder.
   21.45 --->
   21.46 -
   21.47 -<project name="contrib/clazz" default="netbeans" basedir=".">
   21.48 -
   21.49 -    <import file="../../nbbuild/templates/projectized.xml"/>
   21.50 -
   21.51 -</project>
    22.1 --- a/clazz/l10n.list	Wed Sep 15 11:58:07 2010 +0530
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,1 +0,0 @@
    22.4 -clazz/src/**/Bundle*.properties
    23.1 --- a/clazz/manifest.mf	Wed Sep 15 11:58:07 2010 +0530
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,9 +0,0 @@
    23.4 -Manifest-Version: 1.0
    23.5 -OpenIDE-Module-Layer: org/netbeans/modules/clazz/resources/mf-layer.xml
    23.6 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/clazz/Bundle.properties
    23.7 -OpenIDE-Module-Specification-Version: 1.20
    23.8 -OpenIDE-Module: org.netbeans.modules.clazz/1
    23.9 -
   23.10 -Name: org/netbeans/modules/clazz/ClassDataLoader.class
   23.11 -OpenIDE-Module-Class: Loader
   23.12 -
    24.1 --- a/clazz/nbproject/project.properties	Wed Sep 15 11:58:07 2010 +0530
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,38 +0,0 @@
    24.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    24.5 -#
    24.6 -# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    24.7 -#
    24.8 -# The contents of this file are subject to the terms of either the GNU
    24.9 -# General Public License Version 2 only ("GPL") or the Common
   24.10 -# Development and Distribution License("CDDL") (collectively, the
   24.11 -# "License"). You may not use this file except in compliance with the
   24.12 -# License. You can obtain a copy of the License at
   24.13 -# http://www.netbeans.org/cddl-gplv2.html
   24.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   24.15 -# specific language governing permissions and limitations under the
   24.16 -# License.  When distributing the software, include this License Header
   24.17 -# Notice in each file and include the License file at
   24.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   24.19 -# particular file as subject to the "Classpath" exception as provided
   24.20 -# by Sun in the GPL Version 2 section of the License file that
   24.21 -# accompanied this code. If applicable, add the following below the
   24.22 -# License Header, with the fields enclosed by brackets [] replaced by
   24.23 -# your own identifying information:
   24.24 -# "Portions Copyrighted [year] [name of copyright owner]"
   24.25 -#
   24.26 -# Contributor(s):
   24.27 -#
   24.28 -# The Original Software is NetBeans. The Initial Developer of the Original
   24.29 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   24.30 -# Microsystems, Inc. All Rights Reserved.
   24.31 -#
   24.32 -# If you wish your version of this file to be governed by only the CDDL
   24.33 -# or only the GPL Version 2, indicate your decision by adding
   24.34 -# "[Contributor] elects to include this software in this distribution
   24.35 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   24.36 -# single choice of license, a recipient has the option to distribute
   24.37 -# your version of this file under either the CDDL, the GPL Version 2 or
   24.38 -# to extend the choice of license to its licensees as provided above.
   24.39 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   24.40 -# Version 2 license, then the option applies only if the new code is
   24.41 -# made subject to such option by the copyright holder.
    25.1 --- a/clazz/nbproject/project.xml	Wed Sep 15 11:58:07 2010 +0530
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,141 +0,0 @@
    25.4 -<?xml version="1.0" encoding="UTF-8"?>
    25.5 -<!--
    25.6 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    25.7 -
    25.8 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    25.9 -
   25.10 -
   25.11 -The contents of this file are subject to the terms of either the GNU
   25.12 -General Public License Version 2 only ("GPL") or the Common
   25.13 -Development and Distribution License("CDDL") (collectively, the
   25.14 -"License"). You may not use this file except in compliance with the
   25.15 -License. You can obtain a copy of the License at
   25.16 -http://www.netbeans.org/cddl-gplv2.html
   25.17 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   25.18 -specific language governing permissions and limitations under the
   25.19 -License.  When distributing the software, include this License Header
   25.20 -Notice in each file and include the License file at
   25.21 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   25.22 -particular file as subject to the "Classpath" exception as provided
   25.23 -by Sun in the GPL Version 2 section of the License file that
   25.24 -accompanied this code. If applicable, add the following below the
   25.25 -License Header, with the fields enclosed by brackets [] replaced by
   25.26 -your own identifying information:
   25.27 -"Portions Copyrighted [year] [name of copyright owner]"
   25.28 -
   25.29 -Contributor(s):
   25.30 -
   25.31 -The Original Software is NetBeans. The Initial Developer of the Original
   25.32 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   25.33 -Microsystems, Inc. All Rights Reserved.
   25.34 -
   25.35 -If you wish your version of this file to be governed by only the CDDL
   25.36 -or only the GPL Version 2, indicate your decision by adding
   25.37 -"[Contributor] elects to include this software in this distribution
   25.38 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   25.39 -single choice of license, a recipient has the option to distribute
   25.40 -your version of this file under either the CDDL, the GPL Version 2 or
   25.41 -to extend the choice of license to its licensees as provided above.
   25.42 -However, if you add GPL Version 2 code and therefore, elected the GPL
   25.43 -Version 2 license, then the option applies only if the new code is
   25.44 -made subject to such option by the copyright holder.
   25.45 --->
   25.46 -<project xmlns="http://www.netbeans.org/ns/project/1">
   25.47 -    <type>org.netbeans.modules.apisupport.project</type>
   25.48 -    <configuration>
   25.49 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
   25.50 -            <code-name-base>org.netbeans.modules.clazz</code-name-base>
   25.51 -            <module-dependencies>
   25.52 -                <dependency>
   25.53 -                    <code-name-base>org.netbeans.api.java</code-name-base>
   25.54 -                    <build-prerequisite/>
   25.55 -                    <compile-dependency/>
   25.56 -                    <run-dependency>
   25.57 -                        <release-version>1</release-version>
   25.58 -                        <specification-version>1.18</specification-version>
   25.59 -                    </run-dependency>
   25.60 -                </dependency>
   25.61 -                <dependency>
   25.62 -                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
   25.63 -                    <build-prerequisite/>
   25.64 -                    <compile-dependency/>
   25.65 -                    <run-dependency>
   25.66 -                        <release-version>1</release-version>
   25.67 -                        <specification-version>1.0</specification-version>
   25.68 -                    </run-dependency>
   25.69 -                </dependency>
   25.70 -                <dependency>
   25.71 -                    <code-name-base>org.netbeans.modules.classfile</code-name-base>
   25.72 -                    <build-prerequisite/>
   25.73 -                    <compile-dependency/>
   25.74 -                    <run-dependency>
   25.75 -                        <release-version>1</release-version>
   25.76 -                    </run-dependency>
   25.77 -                </dependency>
   25.78 -                <dependency>
   25.79 -                    <code-name-base>org.openide.filesystems</code-name-base>
   25.80 -                    <build-prerequisite/>
   25.81 -                    <compile-dependency/>
   25.82 -                    <run-dependency>
   25.83 -                        <specification-version>7.19</specification-version>
   25.84 -                    </run-dependency>
   25.85 -                </dependency>
   25.86 -                <dependency>
   25.87 -                    <code-name-base>org.openide.util</code-name-base>
   25.88 -                    <build-prerequisite/>
   25.89 -                    <compile-dependency/>
   25.90 -                    <run-dependency>
   25.91 -                        <specification-version>6.2</specification-version>
   25.92 -                    </run-dependency>
   25.93 -                </dependency>
   25.94 -                <dependency>
   25.95 -                    <code-name-base>org.openide.nodes</code-name-base>
   25.96 -                    <build-prerequisite/>
   25.97 -                    <compile-dependency/>
   25.98 -                    <run-dependency>
   25.99 -                        <specification-version>6.2</specification-version>
  25.100 -                    </run-dependency>
  25.101 -                </dependency>
  25.102 -                <dependency>
  25.103 -                    <code-name-base>org.openide.explorer</code-name-base>
  25.104 -                    <build-prerequisite/>
  25.105 -                    <compile-dependency/>
  25.106 -                    <run-dependency>
  25.107 -                        <specification-version>6.8</specification-version>
  25.108 -                    </run-dependency>
  25.109 -                </dependency>
  25.110 -                <dependency>
  25.111 -                    <code-name-base>org.openide.awt</code-name-base>
  25.112 -                    <build-prerequisite/>
  25.113 -                    <compile-dependency/>
  25.114 -                    <run-dependency>
  25.115 -                        <specification-version>6.2</specification-version>
  25.116 -                    </run-dependency>
  25.117 -                </dependency>
  25.118 -                <dependency>
  25.119 -                    <code-name-base>org.openide.dialogs</code-name-base>
  25.120 -                    <build-prerequisite/>
  25.121 -                    <compile-dependency/>
  25.122 -                    <run-dependency>
  25.123 -                        <specification-version>6.2</specification-version>
  25.124 -                    </run-dependency>
  25.125 -                </dependency>
  25.126 -                <dependency>
  25.127 -                    <code-name-base>org.openide.actions</code-name-base>
  25.128 -                    <build-prerequisite/>
  25.129 -                    <compile-dependency/>
  25.130 -                    <run-dependency>
  25.131 -                        <specification-version>6.2</specification-version>
  25.132 -                    </run-dependency>
  25.133 -                </dependency>
  25.134 -                <dependency>
  25.135 -                    <code-name-base>org.openide.loaders</code-name-base>
  25.136 -                    <build-prerequisite/>
  25.137 -                    <compile-dependency/>
  25.138 -                    <run-dependency/>
  25.139 -                </dependency>
  25.140 -            </module-dependencies>
  25.141 -            <public-packages/>
  25.142 -        </data>
  25.143 -    </configuration>
  25.144 -</project>
    26.1 --- a/clazz/src/org/netbeans/modules/clazz/Bundle.properties	Wed Sep 15 11:58:07 2010 +0530
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,91 +0,0 @@
    26.4 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    26.5 -#
    26.6 -# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    26.7 -#
    26.8 -# The contents of this file are subject to the terms of either the GNU
    26.9 -# General Public License Version 2 only ("GPL") or the Common
   26.10 -# Development and Distribution License("CDDL") (collectively, the
   26.11 -# "License"). You may not use this file except in compliance with the
   26.12 -# License. You can obtain a copy of the License at
   26.13 -# http://www.netbeans.org/cddl-gplv2.html
   26.14 -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   26.15 -# specific language governing permissions and limitations under the
   26.16 -# License.  When distributing the software, include this License Header
   26.17 -# Notice in each file and include the License file at
   26.18 -# nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   26.19 -# particular file as subject to the "Classpath" exception as provided
   26.20 -# by Sun in the GPL Version 2 section of the License file that
   26.21 -# accompanied this code. If applicable, add the following below the
   26.22 -# License Header, with the fields enclosed by brackets [] replaced by
   26.23 -# your own identifying information:
   26.24 -# "Portions Copyrighted [year] [name of copyright owner]"
   26.25 -#
   26.26 -# Contributor(s):
   26.27 -#
   26.28 -# The Original Software is NetBeans. The Initial Developer of the Original
   26.29 -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   26.30 -# Microsystems, Inc. All Rights Reserved.
   26.31 -#
   26.32 -# If you wish your version of this file to be governed by only the CDDL
   26.33 -# or only the GPL Version 2, indicate your decision by adding
   26.34 -# "[Contributor] elects to include this software in this distribution
   26.35 -# under the [CDDL or GPL Version 2] license." If you do not indicate a
   26.36 -# single choice of license, a recipient has the option to distribute
   26.37 -# your version of this file under either the CDDL, the GPL Version 2 or
   26.38 -# to extend the choice of license to its licensees as provided above.
   26.39 -# However, if you add GPL Version 2 code and therefore, elected the GPL
   26.40 -# Version 2 license, then the option applies only if the new code is
   26.41 -# made subject to such option by the copyright holder.
   26.42 -
   26.43 -
   26.44 -# Localizable manifest entries
   26.45 -OpenIDE-Module-Name=Sourceless Java Classes
   26.46 -OpenIDE-Module-Short-Description=Supports work with Java class files without source.
   26.47 -OpenIDE-Module-Long-Description=The Sourceless Java Classes module enables you to work with class files that are without their corresponding source file. It also supports serialized JavaBeans components.
   26.48 -OpenIDE-Module-Display-Category=Java
   26.49 -
   26.50 -# ClassDataObject properties
   26.51 -PROP_isInterface=Is Interface
   26.52 -PROP_isApplet=Is Applet
   26.53 -PROP_isJavaBean=Is Bean
   26.54 -PROP_isExecutable=Is Executable
   26.55 -PROP_superclass=Superclass
   26.56 -PROP_modifiers=Modifiers
   26.57 -PROP_className=Class Name
   26.58 -# ClassDataObject messages
   26.59 -TXT_NoSources=Source file for {0} not found.
   26.60 -
   26.61 -HINT_isInterface=Is this an interface or a class?
   26.62 -HINT_isApplet=Is this class an applet?
   26.63 -HINT_isJavaBean=Is this class a bean?
   26.64 -HINT_isExecutable=Is this class executable?
   26.65 -HINT_superclass=Superclass of this class.
   26.66 -HINT_modifiers=Java modifiers of this element.
   26.67 -HINT_className=Class name.
   26.68 -
   26.69 -# ClassDataLoaderBeanInfo
   26.70 -PROP_Extensions=Extensions
   26.71 -HINT_Extensions=A set of possible extensions for classes.
   26.72 -
   26.73 -PROP_ClassLoader_Name=Class Objects
   26.74 -
   26.75 -CTL_Rewrite=Rewrite
   26.76 -CTL_Rename=Rename
   26.77 -CTL_Cancel=Cancel
   26.78 -# {0} = filename, {1} = folder name
   26.79 -MSG_SerExists=File {0} already exists in the {1} directory.
   26.80 -
   26.81 -#ClassElementNodeFactory
   26.82 -CTL_Class_name_format={C}
   26.83 -
   26.84 -#ClassDataNode
   26.85 -FMT_ErrorHint=Errors introspecting class: {0}
   26.86 -
   26.87 -# ElementImpls and descendants
   26.88 -MSG_CantModify=Changes to sourceless elements are not supported.
   26.89 -MSG_INVName=Invalid serialized class name.
   26.90 -
   26.91 -# SerStructureNode
   26.92 -LBL_ser_stream=Serialized stream
   26.93 -# {0} - class name
   26.94 -LBL_instance_of=instance of {0}
    27.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassDataLoader.java	Wed Sep 15 11:58:07 2010 +0530
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,180 +0,0 @@
    27.4 -/*
    27.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    27.6 - *
    27.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    27.8 - *
    27.9 - * The contents of this file are subject to the terms of either the GNU
   27.10 - * General Public License Version 2 only ("GPL") or the Common
   27.11 - * Development and Distribution License("CDDL") (collectively, the
   27.12 - * "License"). You may not use this file except in compliance with the
   27.13 - * License. You can obtain a copy of the License at
   27.14 - * http://www.netbeans.org/cddl-gplv2.html
   27.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   27.16 - * specific language governing permissions and limitations under the
   27.17 - * License.  When distributing the software, include this License Header
   27.18 - * Notice in each file and include the License file at
   27.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   27.20 - * particular file as subject to the "Classpath" exception as provided
   27.21 - * by Sun in the GPL Version 2 section of the License file that
   27.22 - * accompanied this code. If applicable, add the following below the
   27.23 - * License Header, with the fields enclosed by brackets [] replaced by
   27.24 - * your own identifying information:
   27.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   27.26 - *
   27.27 - * Contributor(s):
   27.28 - *
   27.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   27.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   27.31 - * Microsystems, Inc. All Rights Reserved.
   27.32 - *
   27.33 - * If you wish your version of this file to be governed by only the CDDL
   27.34 - * or only the GPL Version 2, indicate your decision by adding
   27.35 - * "[Contributor] elects to include this software in this distribution
   27.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   27.37 - * single choice of license, a recipient has the option to distribute
   27.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   27.39 - * to extend the choice of license to its licensees as provided above.
   27.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   27.41 - * Version 2 license, then the option applies only if the new code is
   27.42 - * made subject to such option by the copyright holder.
   27.43 - */
   27.44 -
   27.45 -package org.netbeans.modules.clazz;
   27.46 -
   27.47 -import java.io.IOException;
   27.48 -
   27.49 -import org.openide.filesystems.FileObject;
   27.50 -import org.openide.loaders.*;
   27.51 -import org.openide.util.NbBundle;
   27.52 -
   27.53 -
   27.54 -/** The DataLoader for ClassDataObjects.
   27.55 -* This class is final only for performance reasons,
   27.56 -* can be happily unfinaled if desired.
   27.57 -*
   27.58 -* @author Jan Jancura, Ian Formanek, Dafe Simonek
   27.59 -*/
   27.60 -public final class ClassDataLoader extends MultiFileLoader {
   27.61 -
   27.62 -    /** Extension constants */
   27.63 -    private static final String SER_EXT = "ser"; // NOI18N
   27.64 -    private static final String CLASS_EXT = "class"; // NOI18N
   27.65 -    private static final String REPRESENTATION_CLASS_NAME = 
   27.66 -        "org.netbeans.modules.clazz.ClassDataObject"; // NOI18N
   27.67 -
   27.68 -    private static final char INNER_CLASS_DIVIDER = '$';
   27.69 -
   27.70 -    /** List of extensions recognized by this loader */
   27.71 -    private static ExtensionList extensions;
   27.72 -
   27.73 -    static final long serialVersionUID =3149080169747384034L;
   27.74 -
   27.75 -    /** Creates a new ClassDataLoader */
   27.76 -    public ClassDataLoader () {
   27.77 -        super(REPRESENTATION_CLASS_NAME);
   27.78 -    }
   27.79 -    
   27.80 -    protected String defaultDisplayName() {
   27.81 -        return NbBundle.getMessage (ClassDataLoader.class, "PROP_ClassLoader_Name");
   27.82 -    }
   27.83 -    
   27.84 -     protected String actionsContext () {
   27.85 -        return "Loaders/application/x-java-class/Actions/";               //NOI18N
   27.86 -     }    
   27.87 -
   27.88 -    /** For a given file finds a primary file.
   27.89 -    * @param fo the file to find primary file for
   27.90 -    *
   27.91 -    * @return the primary file for the file or null if the file is not
   27.92 -    *   recognized by this loader
   27.93 -    */
   27.94 -    protected FileObject findPrimaryFile (FileObject fo) {
   27.95 -        // never recognize folders.
   27.96 -        if (fo.isFolder())
   27.97 -            return null;
   27.98 -        if (SER_EXT.equals(fo.getExt())) {
   27.99 -            // serialized file, return itself
  27.100 -            try {
  27.101 -                return fo.getFileSystem().isDefault() ? null : fo;
  27.102 -            } catch (org.openide.filesystems.FileStateInvalidException ex) {
  27.103 -                return null;
  27.104 -            }
  27.105 -        }
  27.106 -        if (CLASS_EXT.equals(fo.getExt())) {
  27.107 -            // class file
  27.108 -            return findPrimaryForClass(fo);
  27.109 -        }
  27.110 -        // not recognized
  27.111 -        return null;
  27.112 -    }
  27.113 -
  27.114 -    /** Creates the right data object for given primary file.
  27.115 -    * It is guaranteed that the provided file is realy primary file
  27.116 -    * returned from the method findPrimaryFile.
  27.117 -    *
  27.118 -    * @param primaryFile the primary file
  27.119 -    * @return the data object for this file
  27.120 -    * @exception DataObjectExistsException if the primary file already has data object
  27.121 -    */
  27.122 -    protected MultiDataObject createMultiObject (FileObject primaryFile)
  27.123 -    throws DataObjectExistsException, IOException {
  27.124 -        if (SER_EXT.equals(primaryFile.getExt())) {
  27.125 -            // serialized file, return bean data object
  27.126 -            // moved to ClassDataObject class for performance reasons
  27.127 -            return ClassDataObject.createSerDataObject (primaryFile, this);
  27.128 -        }
  27.129 -        if (CLASS_EXT.equals(primaryFile.getExt())) {
  27.130 -            // class file, return class data object
  27.131 -            // moved to ClassDataObject class for performance reasons
  27.132 -            return ClassDataObject.createCompiledDataObject (primaryFile, this);
  27.133 -        }
  27.134 -        // otherwise
  27.135 -        return null;
  27.136 -    }
  27.137 -
  27.138 -    /** Creates the right primary entry for given primary file.
  27.139 -    *
  27.140 -    * @param primaryFile primary file recognized by this loader
  27.141 -    * @return primary entry for that file
  27.142 -    */
  27.143 -    protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) {
  27.144 -        return new FileEntry(obj, primaryFile);
  27.145 -    }
  27.146 -
  27.147 -    /** Creates right secondary entry for given file. The file is said to
  27.148 -    * belong to an object created by this loader.
  27.149 -    *
  27.150 -    * @param secondaryFile secondary file for which we want to create entry
  27.151 -    * @return the entry
  27.152 -    */
  27.153 -    protected MultiDataObject.Entry createSecondaryEntry (MultiDataObject obj, FileObject secondaryFile) {
  27.154 -        return new FileEntry(obj, secondaryFile);
  27.155 -    }
  27.156 -
  27.157 -    /** Utility method, finds primary class file for given class file.
  27.158 -    * (input class file can be innerclass class file) */
  27.159 -    private FileObject findPrimaryForClass (final FileObject fo) {
  27.160 -        final String name = fo.getName();
  27.161 -        final int index = name.indexOf(INNER_CLASS_DIVIDER);
  27.162 -        if (index > 0) {
  27.163 -            // could be innerclass class file - try to find outer class file
  27.164 -            FileObject outer =
  27.165 -                fo.getParent().getFileObject(name.substring(0, index), CLASS_EXT);
  27.166 -            if (outer != null) return outer;
  27.167 -        }
  27.168 -        return fo;
  27.169 -    }
  27.170 -
  27.171 -    /** @return The list of extensions this loader recognizes
  27.172 -    * (default list constains class, ser extensions)
  27.173 -    */
  27.174 -    public ExtensionList getExtensions () {
  27.175 -        if (extensions == null) {
  27.176 -            extensions = new ExtensionList();
  27.177 -            extensions.addExtension(CLASS_EXT);
  27.178 -            extensions.addExtension(SER_EXT);
  27.179 -        }
  27.180 -        return extensions;
  27.181 -    }
  27.182 -}
  27.183 -
    28.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassDataLoaderBeanInfo.java	Wed Sep 15 11:58:07 2010 +0530
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,102 +0,0 @@
    28.4 -/*
    28.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    28.6 - *
    28.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    28.8 - *
    28.9 - * The contents of this file are subject to the terms of either the GNU
   28.10 - * General Public License Version 2 only ("GPL") or the Common
   28.11 - * Development and Distribution License("CDDL") (collectively, the
   28.12 - * "License"). You may not use this file except in compliance with the
   28.13 - * License. You can obtain a copy of the License at
   28.14 - * http://www.netbeans.org/cddl-gplv2.html
   28.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   28.16 - * specific language governing permissions and limitations under the
   28.17 - * License.  When distributing the software, include this License Header
   28.18 - * Notice in each file and include the License file at
   28.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   28.20 - * particular file as subject to the "Classpath" exception as provided
   28.21 - * by Sun in the GPL Version 2 section of the License file that
   28.22 - * accompanied this code. If applicable, add the following below the
   28.23 - * License Header, with the fields enclosed by brackets [] replaced by
   28.24 - * your own identifying information:
   28.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   28.26 - *
   28.27 - * Contributor(s):
   28.28 - *
   28.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   28.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   28.31 - * Microsystems, Inc. All Rights Reserved.
   28.32 - *
   28.33 - * If you wish your version of this file to be governed by only the CDDL
   28.34 - * or only the GPL Version 2, indicate your decision by adding
   28.35 - * "[Contributor] elects to include this software in this distribution
   28.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   28.37 - * single choice of license, a recipient has the option to distribute
   28.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   28.39 - * to extend the choice of license to its licensees as provided above.
   28.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   28.41 - * Version 2 license, then the option applies only if the new code is
   28.42 - * made subject to such option by the copyright holder.
   28.43 - */
   28.44 -
   28.45 -package org.netbeans.modules.clazz;
   28.46 -
   28.47 -import java.beans.*;
   28.48 -import java.awt.Image;
   28.49 -import java.util.ResourceBundle;
   28.50 -
   28.51 -import org.openide.loaders.MultiFileLoader;
   28.52 -import org.openide.ErrorManager;
   28.53 -import org.openide.util.NbBundle;
   28.54 -import org.openide.util.Utilities;
   28.55 -
   28.56 -
   28.57 -/** BeanInfo for class loader.
   28.58 -*
   28.59 -* @author Dafe Simonek
   28.60 -*/
   28.61 -public final class ClassDataLoaderBeanInfo extends SimpleBeanInfo {
   28.62 -
   28.63 -    public BeanInfo[] getAdditionalBeanInfo () {
   28.64 -        try {
   28.65 -            return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
   28.66 -        } catch (IntrospectionException ie) {
   28.67 -	    ErrorManager.getDefault().notify(ie);
   28.68 -            return null;
   28.69 -        }
   28.70 -    }
   28.71 -
   28.72 -
   28.73 -
   28.74 -    /**
   28.75 -    * @return Returns an array of PropertyDescriptors
   28.76 -    * describing the editable properties supported by this bean.
   28.77 -    */
   28.78 -    public PropertyDescriptor[] getPropertyDescriptors () {
   28.79 -	final ResourceBundle bundle =
   28.80 -            NbBundle.getBundle(ClassDataLoaderBeanInfo.class);
   28.81 -        try {
   28.82 -	    PropertyDescriptor[] descriptors =  new PropertyDescriptor[] {
   28.83 -                               new PropertyDescriptor ("extensions", ClassDataLoader.class, // NOI18N
   28.84 -                                                       "getExtensions", null) // NOI18N
   28.85 -                           };
   28.86 -            descriptors[0].setDisplayName(bundle.getString("PROP_Extensions"));
   28.87 -            descriptors[0].setShortDescription(bundle.getString("HINT_Extensions"));
   28.88 -    	    return descriptors;
   28.89 -        } catch (IntrospectionException e) {
   28.90 -	    ErrorManager.getDefault().notify(e);
   28.91 -	    return null;
   28.92 -        }
   28.93 -    }
   28.94 -
   28.95 -    /** @param type Desired type of the icon
   28.96 -    * @return returns the Txt loader's icon
   28.97 -    */
   28.98 -    public Image getIcon(final int type) {
   28.99 -        if ((type == BeanInfo.ICON_COLOR_16x16) || (type == BeanInfo.ICON_MONO_16x16)) {
  28.100 -	    return Utilities.loadImage("org/netbeans/modules/clazz/resources/class.gif"); // NOI18N
  28.101 -        } else {
  28.102 -            return Utilities.loadImage ("org/netbeans/modules/clazz/resources/class32.gif"); // NOI18N
  28.103 -        }
  28.104 -    }
  28.105 -}
    29.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassDataNode.java	Wed Sep 15 11:58:07 2010 +0530
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,293 +0,0 @@
    29.4 -/*
    29.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    29.6 - *
    29.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    29.8 - *
    29.9 - * The contents of this file are subject to the terms of either the GNU
   29.10 - * General Public License Version 2 only ("GPL") or the Common
   29.11 - * Development and Distribution License("CDDL") (collectively, the
   29.12 - * "License"). You may not use this file except in compliance with the
   29.13 - * License. You can obtain a copy of the License at
   29.14 - * http://www.netbeans.org/cddl-gplv2.html
   29.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   29.16 - * specific language governing permissions and limitations under the
   29.17 - * License.  When distributing the software, include this License Header
   29.18 - * Notice in each file and include the License file at
   29.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   29.20 - * particular file as subject to the "Classpath" exception as provided
   29.21 - * by Sun in the GPL Version 2 section of the License file that
   29.22 - * accompanied this code. If applicable, add the following below the
   29.23 - * License Header, with the fields enclosed by brackets [] replaced by
   29.24 - * your own identifying information:
   29.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   29.26 - *
   29.27 - * Contributor(s):
   29.28 - *
   29.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   29.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   29.31 - * Microsystems, Inc. All Rights Reserved.
   29.32 - *
   29.33 - * If you wish your version of this file to be governed by only the CDDL
   29.34 - * or only the GPL Version 2, indicate your decision by adding
   29.35 - * "[Contributor] elects to include this software in this distribution
   29.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   29.37 - * single choice of license, a recipient has the option to distribute
   29.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   29.39 - * to extend the choice of license to its licensees as provided above.
   29.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   29.41 - * Version 2 license, then the option applies only if the new code is
   29.42 - * made subject to such option by the copyright holder.
   29.43 - */
   29.44 -
   29.45 -package org.netbeans.modules.clazz;
   29.46 -
   29.47 -import java.awt.Image;
   29.48 -import java.beans.PropertyChangeEvent;
   29.49 -import java.beans.PropertyChangeListener;
   29.50 -import java.lang.reflect.*;
   29.51 -import java.util.ResourceBundle;
   29.52 -import java.io.*;
   29.53 -import java.text.MessageFormat;
   29.54 -
   29.55 -import org.openide.nodes.*;
   29.56 -import org.openide.loaders.DataNode;
   29.57 -import org.openide.util.NbBundle;
   29.58 -import org.openide.util.WeakListeners;
   29.59 -import org.openide.src.*;
   29.60 -import org.openide.src.nodes.SourceChildren;
   29.61 -import org.openide.cookies.SourceCookie;
   29.62 -import org.openide.ErrorManager;
   29.63 -import org.openide.util.RequestProcessor;
   29.64 -
   29.65 -/** Represents ClassDataObject. Common base for CompiledDataNode (.class)
   29.66 -* and SerDataNode (.ser and other serialized extensions)
   29.67 -* @author Ales Novak, Ian Formanek, Jan Jancura, Dafe Simonek
   29.68 -*/
   29.69 -abstract class ClassDataNode extends DataNode 
   29.70 -    implements Runnable, PropertyChangeListener {
   29.71 -    /** generated Serialized Version UID */
   29.72 -    static final long serialVersionUID = -1543899241509520203L;
   29.73 -
   29.74 -    /** Properties */
   29.75 -    private final static String PROP_CLASS_NAME = "className"; // NOI18N
   29.76 -    private final static String PROP_IS_JAVA_BEAN = "isJavaBean"; // NOI18N
   29.77 -    private final static String PROP_IS_APPLET = "isApplet"; // NOI18N
   29.78 -
   29.79 -    /** a flag whether the children of this object are only items declared
   29.80 -    * by this class, or all items (incl. inherited)
   29.81 -    */
   29.82 -    private boolean showDeclaredOnly = true;  // [PENDING - get default value from somewhere ?]
   29.83 -
   29.84 -    /** The flag indicating whether right icon has been already found */
   29.85 -    transient boolean iconResolved = false;
   29.86 -
   29.87 -    /** Holds error message shown in node tooltip */
   29.88 -    transient String errorMsg;
   29.89 -    
   29.90 -    transient boolean initialized;
   29.91 -
   29.92 -    private static final RequestProcessor iconResolver = new RequestProcessor("clazz icon resolver", 1); // NOI18N
   29.93 -    // -----------------------------------------------------------------------
   29.94 -    // constructor
   29.95 -
   29.96 -    /** @param obj is a ClassDataObject that is to be represented
   29.97 -    */
   29.98 -    ClassDataNode(final ClassDataObject obj) {
   29.99 -        /* Changed for multiple factories
  29.100 -        super(obj, new SourceChildren(ClassElementNodeFactory.getInstance()));
  29.101 -        */
  29.102 -        this(obj, new LazySourceChildren( obj, ClassDataObject.getExplorerFactory()) );
  29.103 -    }
  29.104 -    
  29.105 -    protected ClassDataNode(ClassDataObject obj, Children ch) {
  29.106 -        super(obj, ch);
  29.107 -        initialize();
  29.108 -    }
  29.109 -    
  29.110 -    protected SourceChildren getSourceChildren() {
  29.111 -        return (SourceChildren)getChildren();
  29.112 -    }
  29.113 -    
  29.114 -    /** Returns icon base string which should be used for
  29.115 -    * icon inicialization. Subclasses can ovveride this method
  29.116 -    * to provide their own icon base string.
  29.117 -    */
  29.118 -    protected abstract String initialIconBase ();
  29.119 -    
  29.120 -    protected abstract void resolveIcons();
  29.121 -    
  29.122 -    protected abstract void requestResolveIcon();
  29.123 -
  29.124 -    private void initialize () {
  29.125 -        
  29.126 -        setIconBase(initialIconBase());
  29.127 -        /* Disable the icon resolution - for now.
  29.128 -         *
  29.129 -        // icons...
  29.130 -        RequestProcessor.postRequest(this, 200);
  29.131 -         */
  29.132 -    }
  29.133 -    
  29.134 -    /**
  29.135 -     * If the image is not known, returns the basic (classfile) one and
  29.136 -     * requests image resolution. After the image is known, it returns the
  29.137 -     * cached image.
  29.138 -     */
  29.139 -    public Image getIcon(int type) {
  29.140 -        ensureIconResolved();
  29.141 -        return super.getIcon(type);
  29.142 -    }
  29.143 -    
  29.144 -    public Image getOpenedIcon(int type) {
  29.145 -        ensureIconResolved();
  29.146 -        return super.getOpenedIcon(type);
  29.147 -    }
  29.148 -    
  29.149 -    private void ensureIconResolved() {
  29.150 -        if (iconResolved)
  29.151 -            return;
  29.152 -        iconResolver.post(new Runnable() {
  29.153 -            public void run() {
  29.154 -                requestResolveIcon();
  29.155 -            }
  29.156 -        });
  29.157 -    }
  29.158 -
  29.159 -    /** Creates property set for this node */
  29.160 -    protected Sheet createSheet () {
  29.161 -        Sheet s = super.createSheet();
  29.162 -        ResourceBundle bundle = NbBundle.getBundle(ClassDataNode.class);
  29.163 -        final ClassDataObject obj=(ClassDataObject)getDataObject();
  29.164 -        Sheet.Set ps = s.get(Sheet.PROPERTIES);
  29.165 -        ps.put(new PropertySupport.ReadOnly (
  29.166 -                   PROP_CLASS_NAME,
  29.167 -                   String.class,
  29.168 -                   bundle.getString("PROP_className"),
  29.169 -                   bundle.getString("HINT_className")
  29.170 -               ) {
  29.171 -                   public Object getValue () throws InvocationTargetException {
  29.172 -                       return obj.getClassName();
  29.173 -                   }
  29.174 -               });
  29.175 -        ps.put(new PropertySupport.ReadOnly (
  29.176 -                   ElementProperties.PROP_MODIFIERS,
  29.177 -                   String.class,
  29.178 -                   bundle.getString ("PROP_modifiers"),
  29.179 -                   bundle.getString ("HINT_modifiers")
  29.180 -               ) {
  29.181 -                   public Object getValue () throws InvocationTargetException {
  29.182 -                       Object result = null;
  29.183 -                       try {
  29.184 -                           result = obj.getModifiers();
  29.185 -                       } catch (IOException ex) {
  29.186 -                           // ignore - return null
  29.187 -                       } catch (ClassNotFoundException ex) {
  29.188 -                           // ignore - return null
  29.189 -                       }
  29.190 -                       return result;
  29.191 -                   }
  29.192 -               });
  29.193 -        ps.put(new PropertySupport.ReadOnly (
  29.194 -                   ElementProperties.PROP_SUPERCLASS,
  29.195 -                   String.class,
  29.196 -                   bundle.getString ("PROP_superclass"),
  29.197 -                   bundle.getString ("HINT_superclass")
  29.198 -               ) {
  29.199 -                   public Object getValue () throws InvocationTargetException {
  29.200 -                       return obj.getSuperclass();
  29.201 -                   }
  29.202 -               });
  29.203 -        ps.put(new PropertySupport.ReadOnly (
  29.204 -                   ElementProperties.PROP_CLASS_OR_INTERFACE,
  29.205 -                   Boolean.TYPE,
  29.206 -                   bundle.getString ("PROP_isInterface"),
  29.207 -                   bundle.getString ("HINT_isInterface")
  29.208 -               ) {
  29.209 -                   public Object getValue () throws InvocationTargetException {
  29.210 -                       return obj.isInterface() ? Boolean.TRUE : Boolean.FALSE;
  29.211 -                   }
  29.212 -               });
  29.213 -        ps.put(new PropertySupport.ReadOnly (
  29.214 -                   PROP_IS_APPLET,
  29.215 -                   Boolean.TYPE,
  29.216 -                   bundle.getString ("PROP_isApplet"),
  29.217 -                   bundle.getString ("HINT_isApplet")
  29.218 -               ) {
  29.219 -                   public Object getValue () throws InvocationTargetException {
  29.220 -                       return obj.isApplet() ? Boolean.TRUE : Boolean.FALSE;
  29.221 -                   }
  29.222 -               });
  29.223 -        ps.put(new PropertySupport.ReadOnly (
  29.224 -                   PROP_IS_JAVA_BEAN,
  29.225 -                   Boolean.TYPE,
  29.226 -                   bundle.getString ("PROP_isJavaBean"),
  29.227 -                   bundle.getString ("HINT_isJavaBean")
  29.228 -               ) {
  29.229 -                   public Object getValue () throws InvocationTargetException {
  29.230 -                       return obj.isJavaBean() ? Boolean.TRUE : Boolean.FALSE;
  29.231 -                   }
  29.232 -               });
  29.233 -        return s;
  29.234 -    }
  29.235 -
  29.236 -    /** The implementation of the Runnable interface
  29.237 -    * (initialization tasks in separate thread)
  29.238 -    */
  29.239 -    public void run () {
  29.240 -        // set right source element to our children
  29.241 -        SourceCookie sc =
  29.242 -            (SourceCookie)getDataObject().getCookie(SourceCookie.class);
  29.243 -        if (sc != null) {
  29.244 -            if (!initialized)
  29.245 -                sc.getSource().addPropertyChangeListener(
  29.246 -                    WeakListeners.propertyChange(this, sc.getSource()));
  29.247 -            initialized = true;
  29.248 -        }
  29.249 -        resolveIcons();
  29.250 -    }
  29.251 -    
  29.252 -    public void propertyChange(PropertyChangeEvent ev) {
  29.253 -        if (ElementProperties.PROP_STATUS.equals(ev.getPropertyName()))
  29.254 -            Util.getClassProcessor().post(this, 200);
  29.255 -    }
  29.256 -
  29.257 -    // --------------------------------------------------------------------
  29.258 -    // private methods
  29.259 -
  29.260 -    
  29.261 -    /** Sets error tooltip based on given exception message.
  29.262 -    * @param exc Exception which describes the failure.
  29.263 -    */
  29.264 -    protected void setErrorToolTip (Exception exc) {
  29.265 -        String errMsg = findErrorMessage(exc);
  29.266 -        errorMsg = NbBundle.getMessage(ClassDataNode.class, "FMT_ErrorHint",
  29.267 -            errMsg
  29.268 -        );
  29.269 -        setShortDescription(errorMsg);
  29.270 -    }
  29.271 -
  29.272 -    private String findErrorMessage(Throwable t) {
  29.273 -        if (t == null) {
  29.274 -            return null;
  29.275 -        }
  29.276 -        
  29.277 -        ErrorManager.Annotation[] ann = ErrorManager.getDefault().findAnnotations(t);
  29.278 -        if (ann == null)
  29.279 -            return t.getLocalizedMessage();
  29.280 -        for (int i = 0; i < ann.length; i++) {
  29.281 -            String normal = ann[i].getMessage();
  29.282 -            String localized = ann[i].getLocalizedMessage();
  29.283 -            if (localized != null)
  29.284 -                return localized;
  29.285 -            Throwable t2 = ann[i].getStackTrace();
  29.286 -            if (t2 == null)
  29.287 -                continue;
  29.288 -            localized = t2.getLocalizedMessage();
  29.289 -            if (localized != null) {
  29.290 -                if (!localized.equals(normal))
  29.291 -                    return localized;
  29.292 -            }
  29.293 -        }
  29.294 -        return t.getLocalizedMessage();
  29.295 -    }
  29.296 -}
    30.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassDataObject.java	Wed Sep 15 11:58:07 2010 +0530
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,778 +0,0 @@
    30.4 -/*
    30.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    30.6 - *
    30.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    30.8 - *
    30.9 - * The contents of this file are subject to the terms of either the GNU
   30.10 - * General Public License Version 2 only ("GPL") or the Common
   30.11 - * Development and Distribution License("CDDL") (collectively, the
   30.12 - * "License"). You may not use this file except in compliance with the
   30.13 - * License. You can obtain a copy of the License at
   30.14 - * http://www.netbeans.org/cddl-gplv2.html
   30.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   30.16 - * specific language governing permissions and limitations under the
   30.17 - * License.  When distributing the software, include this License Header
   30.18 - * Notice in each file and include the License file at
   30.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   30.20 - * particular file as subject to the "Classpath" exception as provided
   30.21 - * by Sun in the GPL Version 2 section of the License file that
   30.22 - * accompanied this code. If applicable, add the following below the
   30.23 - * License Header, with the fields enclosed by brackets [] replaced by
   30.24 - * your own identifying information:
   30.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   30.26 - *
   30.27 - * Contributor(s):
   30.28 - *
   30.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   30.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   30.31 - * Microsystems, Inc. All Rights Reserved.
   30.32 - *
   30.33 - * If you wish your version of this file to be governed by only the CDDL
   30.34 - * or only the GPL Version 2, indicate your decision by adding
   30.35 - * "[Contributor] elects to include this software in this distribution
   30.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   30.37 - * single choice of license, a recipient has the option to distribute
   30.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   30.39 - * to extend the choice of license to its licensees as provided above.
   30.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   30.41 - * Version 2 license, then the option applies only if the new code is
   30.42 - * made subject to such option by the copyright holder.
   30.43 - */
   30.44 -
   30.45 -package org.netbeans.modules.clazz;
   30.46 -
   30.47 -import java.beans.PropertyChangeEvent;
   30.48 -import java.beans.PropertyChangeListener;
   30.49 -import java.io.BufferedInputStream;
   30.50 -import java.io.IOException;
   30.51 -import java.io.InputStream;
   30.52 -import java.io.ObjectInputStream;
   30.53 -import java.io.ObjectStreamClass;
   30.54 -import java.lang.ref.Reference;
   30.55 -import java.lang.ref.WeakReference;
   30.56 -import java.lang.reflect.Modifier;
   30.57 -import java.text.MessageFormat;
   30.58 -import java.util.Collection;
   30.59 -import java.util.HashSet;
   30.60 -import java.util.LinkedList;
   30.61 -import javax.jmi.reflect.InvalidObjectException;
   30.62 -import org.netbeans.api.java.classpath.ClassPath;
   30.63 -import org.netbeans.api.java.queries.SourceForBinaryQuery;
   30.64 -import org.netbeans.modules.classfile.ClassFile;
   30.65 -import org.netbeans.spi.java.classpath.support.ClassPathSupport;
   30.66 -import org.openide.ErrorManager;
   30.67 -import org.openide.awt.StatusDisplayer;
   30.68 -import org.openide.cookies.InstanceCookie;
   30.69 -import org.openide.cookies.SourceCookie;
   30.70 -import org.openide.cookies.OpenCookie;
   30.71 -import org.openide.filesystems.FileChangeAdapter;
   30.72 -import org.openide.filesystems.FileEvent;
   30.73 -import org.openide.filesystems.FileObject;
   30.74 -import org.openide.filesystems.FileStateInvalidException;
   30.75 -import org.openide.filesystems.FileUtil;
   30.76 -import org.openide.loaders.DataFolder;
   30.77 -import org.openide.loaders.DataObject;
   30.78 -import org.openide.loaders.DataObjectExistsException;
   30.79 -import org.openide.loaders.DataObjectNotFoundException;
   30.80 -import org.openide.loaders.InstanceSupport;
   30.81 -import org.openide.loaders.MultiDataObject;
   30.82 -import org.openide.loaders.MultiFileLoader;
   30.83 -import org.openide.nodes.CookieSet.Factory;
   30.84 -import org.openide.nodes.CookieSet;
   30.85 -import org.openide.nodes.Node.Cookie;
   30.86 -import org.openide.src.ClassElement;
   30.87 -import org.openide.src.ConstructorElement;
   30.88 -import org.openide.src.Identifier;
   30.89 -import org.openide.src.SourceElement;
   30.90 -import org.openide.src.Type;
   30.91 -import org.openide.src.nodes.ElementNodeFactory;
   30.92 -import org.openide.src.nodes.FilterFactory;
   30.93 -import org.openide.util.NbBundle;
   30.94 -
   30.95 -/** This DataObject loads sourceless classes and provides a common framework
   30.96 - * for presenting them in the IDE.
   30.97 - * The descendants define specific behaviour, restrictions and operations.<P>
   30.98 - * <B>Note:</B> The previous version of ClassDataObject has become CompiledDataObject.
   30.99 - * Because ClassDataObject was public, the name was retained for compatibility reasons.
  30.100 - * Method behaviour specific to compiled classes was moved to CompiledDataObject and
  30.101 - * the behaviour specific to serialized objects was moved into SerDataObject.
  30.102 - *
  30.103 - * @author sdedic
  30.104 - */
  30.105 -public class ClassDataObject extends MultiDataObject implements Factory, SourceCookie {
  30.106 -    public static final String PROP_CLASS_LOADING_ERROR = "classLoadingError"; // NOI18N
  30.107 -    /**
  30.108 -     * Holds an exception that occured during an attempt to create the class.
  30.109 -     */
  30.110 -    private Throwable classLoadingError;
  30.111 -
  30.112 -    /** The generic type */
  30.113 -    protected static final int UNDECIDED = 0;
  30.114 -
  30.115 -    /** The DataObject contains an applet */
  30.116 -    protected static final int APPLET = 1;
  30.117 -
  30.118 -    /** The DataObject is an application. */
  30.119 -    protected static final int APPLICATION = 2;
  30.120 -
  30.121 -    /** CHANGE!!! */
  30.122 -    static final long serialVersionUID = -1;
  30.123 -
  30.124 -    /** Support for working with class */
  30.125 -    transient private InstanceSupport instanceSupport;
  30.126 -
  30.127 -    transient private boolean sourceCreated;
  30.128 -    
  30.129 -    transient PropL propL;
  30.130 -    
  30.131 -    transient Reference srcEl = new WeakReference(null);
  30.132 -    
  30.133 -    transient private ClassFile mainClass; // don't access directly, use getMainClass() instead
  30.134 -    
  30.135 -    /** Creates a new sourceless DataObject.
  30.136 -     */
  30.137 -    public ClassDataObject(final FileObject fo, final MultiFileLoader loader) throws DataObjectExistsException {
  30.138 -        super(fo, loader);
  30.139 -    }
  30.140 -
  30.141 -    static ClassDataObject createSerDataObject(FileObject fo, ClassDataLoader dl)
  30.142 -                throws DataObjectExistsException, IOException {
  30.143 -        return new SerDataObject(fo, dl);
  30.144 -    }
  30.145 -
  30.146 -    static ClassDataObject createCompiledDataObject(FileObject fo, ClassDataLoader dl)
  30.147 -                throws DataObjectExistsException, IOException {
  30.148 -        return new CompiledDataObject(fo, dl);
  30.149 -    }
  30.150 -    
  30.151 -    private class PropL extends FileChangeAdapter implements Runnable, PropertyChangeListener {
  30.152 -        public void propertyChange(PropertyChangeEvent ev) {
  30.153 -            String prop = ev.getPropertyName();
  30.154 -            if (PROP_PRIMARY_FILE.equals(prop)) {
  30.155 -                FileObject p = getPrimaryFile();
  30.156 -                p.addFileChangeListener(FileUtil.weakFileChangeListener(this, getPrimaryFile()));
  30.157 -                postReload();
  30.158 -            }
  30.159 -        }
  30.160 -        
  30.161 -        public void fileChanged(FileEvent ev) {
  30.162 -            postReload();
  30.163 -        }
  30.164 -        
  30.165 -        public void run() {
  30.166 -            forceReload();
  30.167 -        }
  30.168 -        
  30.169 -        private void postReload() {
  30.170 -            Util.getClassProcessor().post(this, 100);
  30.171 -        }
  30.172 -    }
  30.173 -    
  30.174 -    protected void initCookies() {
  30.175 -        CookieSet cs = getCookieSet();
  30.176 -        cs.add(new Class[] {
  30.177 -            SourceCookie.class, 
  30.178 -        }, this);
  30.179 -        cs.add(OpenCookie.class,this);
  30.180 -    }
  30.181 -
  30.182 -    /**
  30.183 -     * Creates InstanceSupport for the primary .class file.
  30.184 -     */
  30.185 -    protected InstanceSupport createInstanceSupport() {
  30.186 -        if (instanceSupport != null)
  30.187 -            return instanceSupport;
  30.188 -        synchronized (this) {
  30.189 -            if (instanceSupport == null) {
  30.190 -                instanceSupport = new ClazzInstanceSupport(getPrimaryEntry());
  30.191 -                if (propL == null) {
  30.192 -                    propL = new PropL();
  30.193 -                    FileObject p = getPrimaryFile();
  30.194 -                    p.addFileChangeListener(FileUtil.weakFileChangeListener(propL, p));
  30.195 -                }
  30.196 -            }
  30.197 -        }
  30.198 -        return instanceSupport;
  30.199 -    }
  30.200 -    
  30.201 -    public SourceElement getSource() {
  30.202 -        SourceElement s;
  30.203 -
  30.204 -        s = (SourceElement)srcEl.get();
  30.205 -        if (s != null)
  30.206 -            return s;
  30.207 -        synchronized (this) {
  30.208 -            s = (SourceElement)srcEl.get();
  30.209 -            if (s != null)
  30.210 -                return s;
  30.211 -            sourceCreated = true;
  30.212 -            s = new SourceElement(new SourceElementImpl(this));
  30.213 -            srcEl = new WeakReference(s);
  30.214 -        }
  30.215 -        return s;
  30.216 -    }
  30.217 -    
  30.218 -    public Cookie createCookie(Class desired) {
  30.219 -        if (desired == InstanceCookie.class) {
  30.220 -            return createInstanceSupport();
  30.221 -        }
  30.222 -        else if (OpenCookie.class.isAssignableFrom(desired)) {
  30.223 -            return new OpenSourceCookie ();
  30.224 -        }
  30.225 -        return null;
  30.226 -    }
  30.227 -    
  30.228 -    protected Throwable getClassLoadingError() {
  30.229 -        getClassFile();
  30.230 -        return classLoadingError;
  30.231 -    }
  30.232 -    
  30.233 -    /**
  30.234 -     * Forces reload of the class and the whole instance support.
  30.235 -     */
  30.236 -    protected void forceReload() {
  30.237 -        CookieSet s = getCookieSet();
  30.238 -        InstanceCookie prevCookie;
  30.239 -    
  30.240 -        prevCookie = instanceSupport;
  30.241 -        synchronized (this) {
  30.242 -            instanceSupport = null;
  30.243 -            mainClass = null;
  30.244 -        }
  30.245 -        // if the previous support was != null, it recreates the cookie
  30.246 -        // (and fires PROP_COOKIE change).
  30.247 -        if (prevCookie != null) {
  30.248 -            s.remove(prevCookie);
  30.249 -            s.add(new Class[] {
  30.250 -                InstanceCookie.class
  30.251 -            }, this);
  30.252 -        }
  30.253 -
  30.254 -        if (sourceCreated) {
  30.255 -            SourceCookie sc = (SourceCookie)getCookie(SourceCookie.class);
  30.256 -            SourceElementImpl impl = (SourceElementImpl)sc.getSource().getCookie(SourceElement.Impl.class);
  30.257 -            if (impl != null)
  30.258 -                impl.setResource(null);
  30.259 -        }
  30.260 -    }
  30.261 -    
  30.262 -    /**
  30.263 -     * Returns the "main" class for this DataObject, or null if the class
  30.264 -     * cannot be loaded. In such case, it records the error trace into
  30.265 -     * {@link #classLoadingError} variable.
  30.266 -     */
  30.267 -    protected ClassFile getClassFile() {
  30.268 -        if (mainClass==null) {        
  30.269 -            Throwable t = this.classLoadingError;
  30.270 -            classLoadingError = null;
  30.271 -            try {
  30.272 -                mainClass = loadClassFile();            
  30.273 -            } catch (RuntimeException ex) {
  30.274 -                classLoadingError = ex;
  30.275 -            } catch (IOException ex) {
  30.276 -                classLoadingError = ex;
  30.277 -            } catch (ClassNotFoundException ex) {
  30.278 -                classLoadingError = ex;
  30.279 -            }
  30.280 -            if (classLoadingError != null)
  30.281 -                firePropertyChange(PROP_CLASS_LOADING_ERROR, t, classLoadingError);
  30.282 -        }
  30.283 -        return mainClass;
  30.284 -    }
  30.285 -    
  30.286 -    protected ClassElement getMainClass() {
  30.287 -        ClassElement ce[]=getSource().getClasses();
  30.288 -        
  30.289 -        if (ce.length==0)
  30.290 -            return null;
  30.291 -        return ce[0];
  30.292 -    }
  30.293 -    
  30.294 -    protected ClassFile loadClassFile() throws IOException,ClassNotFoundException {
  30.295 -        InputStream stream=getPrimaryEntry().getFile().getInputStream();
  30.296 -        
  30.297 -        if (stream==null)
  30.298 -            return null;
  30.299 -        try {
  30.300 -            return new ClassFile(stream,false);
  30.301 -        } finally {
  30.302 -            stream.close();
  30.303 -        }   
  30.304 -    }
  30.305 -    
  30.306 -    // DataObject implementation .............................................
  30.307 -
  30.308 -    /** Getter for copy action.
  30.309 -    * @return true if the object can be copied
  30.310 -    */
  30.311 -    public boolean isCopyAllowed () {
  30.312 -        return true;    
  30.313 -    }
  30.314 -
  30.315 -    public boolean isMoveAllowed() {
  30.316 -        return getPrimaryFile().canWrite();
  30.317 -    }
  30.318 -
  30.319 -    public boolean isRenameAllowed() {
  30.320 -        return getPrimaryFile().canWrite();
  30.321 -    }
  30.322 -
  30.323 -    // =======================================================================
  30.324 -    // Various properties describing the file although it is questionable to 
  30.325 -    // put them at the file level. At least JavaBean and Applet are properties
  30.326 -    // of a class, not a file or serialized object.
  30.327 -    public boolean isJavaBean () {
  30.328 -        return createInstanceSupport().isJavaBean();
  30.329 -    }
  30.330 -
  30.331 -    public boolean isApplet () {
  30.332 -        return createInstanceSupport().isApplet ();
  30.333 -    }
  30.334 -
  30.335 -    public boolean isInterface () {
  30.336 -        return createInstanceSupport().isInterface ();
  30.337 -    }
  30.338 -
  30.339 -    public String getSuperclass () {
  30.340 -        ClassElement ce=getMainClass();
  30.341 -        
  30.342 -        if (ce==null)
  30.343 -            return "";
  30.344 -        Identifier id = ce.getSuperclass();
  30.345 -        return id == null ? "" : id.getFullName();
  30.346 -    }
  30.347 -
  30.348 -    public String getModifiers () throws IOException, ClassNotFoundException {
  30.349 -        ClassElement ce=getMainClass();
  30.350 -        
  30.351 -        if (ce==null)
  30.352 -            throw new ClassNotFoundException();
  30.353 -        return Modifier.toString(ce.getModifiers());
  30.354 -    }
  30.355 -
  30.356 -    public String getClassName () {
  30.357 -        return createInstanceSupport().instanceName ();
  30.358 -    }
  30.359 -
  30.360 -    public Class getBeanClass () throws IOException, ClassNotFoundException {
  30.361 -        return createInstanceSupport().instanceClass ();
  30.362 -    }
  30.363 -
  30.364 -    // =============== The mechanism for regeisteing node factories ==============
  30.365 -
  30.366 -    // =============== The mechanism for regeisteing node factories ==============
  30.367 -    
  30.368 -    private static NodeFactoryPool explorerFactories;
  30.369 -    private static NodeFactoryPool browserFactories;
  30.370 -    private static ElementNodeFactory basicBrowser;
  30.371 -    private static ElementNodeFactory basicExplorer;
  30.372 -
  30.373 -    /**
  30.374 -     * DO NOT USE THIS METHOD!!! <P>
  30.375 -     * This method is intended to be called only during initialization of java
  30.376 -     * module-provided node factories from the installation layer. It won't
  30.377 -     * be maintained for compatibility reasons.
  30.378 -     */
  30.379 -    synchronized static ElementNodeFactory createBasicExplorerFactory() {
  30.380 -        if (basicExplorer == null) {
  30.381 -            basicExplorer = new ClassElementNodeFactory();
  30.382 -        }
  30.383 -        return basicExplorer;
  30.384 -    }
  30.385 -    
  30.386 -    /**
  30.387 -     * DO NOT USE THIS METHOD!!! <P>
  30.388 -     * This method is intended to be called only during initialization of java
  30.389 -     * module-provided node factories from the installation layer. It won't
  30.390 -     * be maintained for compatibility reasons.
  30.391 -     */
  30.392 -    synchronized static ElementNodeFactory createBasicBrowserFactory() {
  30.393 -        if (basicBrowser == null) {
  30.394 -            basicBrowser = new ClassElementNodeFactory();
  30.395 -            ((ClassElementNodeFactory)basicBrowser).setGenerateForTree (true);
  30.396 -        }
  30.397 -        return basicBrowser;
  30.398 -    }
  30.399 -
  30.400 -    public static ElementNodeFactory getExplorerFactory() {
  30.401 -        NodeFactoryPool pool = createExplorerFactory();
  30.402 -        ElementNodeFactory f = null;
  30.403 -        
  30.404 -        if (pool != null)
  30.405 -            f = pool.getHead();
  30.406 -        if (f == null)
  30.407 -            f = createBasicExplorerFactory();
  30.408 -        return f;
  30.409 -    }
  30.410 -    
  30.411 -    public static ElementNodeFactory getBrowserFactory() {
  30.412 -        NodeFactoryPool pool = createBrowserFactory();
  30.413 -        ElementNodeFactory f = null;
  30.414 -        
  30.415 -        if (pool != null)
  30.416 -            f = pool.getHead();
  30.417 -        if (f == null)
  30.418 -            f = createBasicBrowserFactory();
  30.419 -        return f;
  30.420 -    }
  30.421 -
  30.422 -    static NodeFactoryPool createFactoryPool(String folderName, ElementNodeFactory def) {
  30.423 -        FileObject f = FileUtil.getConfigFile(folderName);
  30.424 -	if (f == null)
  30.425 -    	    return null;
  30.426 -        try {
  30.427 -            DataFolder folder = (DataFolder)DataObject.find(f).getCookie(DataFolder.class);
  30.428 -            return new NodeFactoryPool(folder, def);
  30.429 -        } catch (DataObjectNotFoundException ex) {
  30.430 -            return null;
  30.431 -        }
  30.432 -    }
  30.433 -    
  30.434 -    synchronized static NodeFactoryPool createBrowserFactory() {
  30.435 -        if (browserFactories != null)
  30.436 -            return browserFactories;
  30.437 -        browserFactories = createFactoryPool("/NodeFactories/clazz/objectbrowser", createBasicBrowserFactory()); // NOI18N
  30.438 -        return browserFactories;
  30.439 -    }
  30.440 -    
  30.441 -    synchronized static NodeFactoryPool createExplorerFactory() {
  30.442 -        if (explorerFactories != null)
  30.443 -            return explorerFactories;
  30.444 -        explorerFactories = createFactoryPool("/NodeFactories/clazz/explorer", createBasicExplorerFactory()); // NOI18N
  30.445 -        return explorerFactories;
  30.446 -    }
  30.447 -
  30.448 -    /**
  30.449 -     * @deprecated use installation layer for registering a factory for the the whole
  30.450 -     * time a module is installed. Note: This feature will be dropped in the next
  30.451 -     * release.
  30.452 -     */
  30.453 -    public static void addExplorerFilterFactory( FilterFactory factory ) {
  30.454 -        NodeFactoryPool p = createExplorerFactory();
  30.455 -        if (p != null)
  30.456 -            p.addFactory(factory);
  30.457 -    }
  30.458 -
  30.459 -    /**
  30.460 -     * @deprecated use installation layer for registering a factory for the the whole
  30.461 -     * time a module is installed. Note: This feature will be dropped in the next
  30.462 -     * release.
  30.463 -     */
  30.464 -    public static void removeExplorerFilterFactory( FilterFactory factory ) {
  30.465 -        NodeFactoryPool p = createExplorerFactory();
  30.466 -        if (p != null)
  30.467 -            p.removeFactory(factory);
  30.468 -    }
  30.469 -
  30.470 -    /**
  30.471 -     * @deprecated use installation layer for registering a factory for the the whole
  30.472 -     * time a module is installed. Note: This feature will be dropped in the next
  30.473 -     * release.
  30.474 -     */
  30.475 -    public static void addBrowserFilterFactory(FilterFactory factory) {
  30.476 -        NodeFactoryPool p = createBrowserFactory();
  30.477 -        if (p != null)
  30.478 -            p.addFactory(factory);
  30.479 -    }
  30.480 -
  30.481 -    /**
  30.482 -     * @deprecated use installation layer for registering a factory for the the whole
  30.483 -     * time a module is installed. Note: This feature will be dropped in the next
  30.484 -     * release.
  30.485 -     */
  30.486 -    public static void removeBrowserFilterFactory( FilterFactory factory ) {
  30.487 -        NodeFactoryPool p = createBrowserFactory();
  30.488 -        if (p != null)
  30.489 -            p.removeFactory(factory);
  30.490 -    }
  30.491 -
  30.492 -    protected final class ClazzInstanceSupport extends InstanceSupport {
  30.493 -
  30.494 -        /** the class is bean */
  30.495 -        private Boolean bean;
  30.496 -
  30.497 -        /** the class is executable */
  30.498 -        private Boolean executable;
  30.499 -
  30.500 -        ClazzInstanceSupport(MultiDataObject.Entry entry) {
  30.501 -            super(entry);
  30.502 -        }
  30.503 -        
  30.504 -        public Class instanceClass() throws IOException, ClassNotFoundException {
  30.505 -            try {
  30.506 -                Class c = super.instanceClass();
  30.507 -                return c;
  30.508 -            } catch (RuntimeException ex) {
  30.509 -                // convert RuntimeExceptions -> CNFE
  30.510 -                ClassDataObject.this.classLoadingError = ex;
  30.511 -                throw new ClassNotFoundException(ex.getMessage());
  30.512 -            }
  30.513 -        }
  30.514 -        
  30.515 -        /** 
  30.516 -         * Creates class loader that permits <<ALL FILES>> and all properties to be read,
  30.517 -         * and is based on a reference file.
  30.518 -         */
  30.519 -        protected ClassLoader createClassLoader(FileObject ref) {
  30.520 -            Collection c = new HashSet ();
  30.521 -            ClassPath cp = ClassPath.getClassPath(ref, ClassPath.COMPILE);
  30.522 -            if (cp != null) {
  30.523 -                c.add (cp);
  30.524 -            }
  30.525 -            cp = ClassPath.getClassPath(ref, ClassPath.EXECUTE);
  30.526 -            if (cp != null) {
  30.527 -                c.add (cp);
  30.528 -            }
  30.529 -            if (c.size()>0) {
  30.530 -                cp = ClassPathSupport.createProxyClassPath((ClassPath[])c.toArray(new ClassPath[c.size()]));
  30.531 -                return cp.getClassLoader(true);
  30.532 -            }
  30.533 -            else {
  30.534 -                return null;
  30.535 -            }
  30.536 -        }
  30.537 -        
  30.538 -        /** Is this a JavaBean?
  30.539 -         * @return <code>true</code> if this class represents JavaBean (is public and has a public default constructor).
  30.540 -         */
  30.541 -        public boolean isJavaBean() {
  30.542 -        if (bean != null) return bean.booleanValue ();
  30.543 -        
  30.544 -        // if from ser file => definitely it is a java bean
  30.545 -        if (isSerialized ()) {
  30.546 -            bean = Boolean.TRUE;
  30.547 -            return true;
  30.548 -        }
  30.549 -        
  30.550 -        // try to find out...
  30.551 -        try {
  30.552 -            ClassElement clazz = getMainClass();
  30.553 -            
  30.554 -            if (clazz==null) return false;
  30.555 -            int modif = clazz.getModifiers();
  30.556 -            if (!Modifier.isPublic(modif) || Modifier.isAbstract(modif)) {
  30.557 -                bean = Boolean.FALSE;
  30.558 -                return false;
  30.559 -            }
  30.560 -            ConstructorElement c=clazz.getConstructor(new Type[0]);
  30.561 -            if ((c == null) || !Modifier.isPublic(c.getModifiers())) {
  30.562 -                bean = Boolean.FALSE;
  30.563 -                return false;
  30.564 -            }
  30.565 -            // check: if the class is an inner class, all outer classes have
  30.566 -            // to be public and in the static context:
  30.567 -            
  30.568 -            for (ClassElement outer = clazz.getDeclaringClass(); outer != null; outer = outer.getDeclaringClass()) {
  30.569 -                // check if the enclosed class is static
  30.570 -                if (!Modifier.isStatic(modif)) {
  30.571 -                    bean = Boolean.FALSE;
  30.572 -                    return false;
  30.573 -                }
  30.574 -                modif = outer.getModifiers();
  30.575 -                // ... and the enclosing class is public
  30.576 -                if (!Modifier.isPublic(modif)) {
  30.577 -                    bean = Boolean.FALSE;
  30.578 -                    return false;
  30.579 -                }
  30.580 -            }
  30.581 -        } catch (InvalidObjectException ioe) {
  30.582 -            bean = Boolean.FALSE;
  30.583 -            return false;
  30.584 -        } catch (RuntimeException ex) {
  30.585 -            throw ex;
  30.586 -        } catch (ThreadDeath t) {
  30.587 -            throw t;
  30.588 -        } catch (Throwable t) {
  30.589 -            // false when other errors occur (NoClassDefFoundError etc...)
  30.590 -            bean = Boolean.FALSE;
  30.591 -            return false;
  30.592 -        }
  30.593 -        // okay, this is bean...
  30.594 -        //    return isBean = java.io.Serializable.class.isAssignableFrom (clazz);
  30.595 -        bean = Boolean.TRUE;
  30.596 -        return true;   
  30.597 -        }
  30.598 -        
  30.599 -        /** Is this an interface?
  30.600 -         * @return <code>true</code> if the class is an interface
  30.601 -         */
  30.602 -        public boolean isInterface() {
  30.603 -            ClassElement ce=getMainClass();
  30.604 -            
  30.605 -            return (ce==null)?false:ce.isInterface();
  30.606 -        }
  30.607 -                
  30.608 -        public String instanceName() {
  30.609 -            ClassElement ce=getMainClass();
  30.610 -            
  30.611 -            if (ce==null)
  30.612 -                return super.instanceName();
  30.613 -            return ce.getName().getFullName();
  30.614 -        }
  30.615 -        
  30.616 -        /*Query to found out if the object created by this cookie is 
  30.617 -        * instance of given type.
  30.618 -        * @param type the class type we want to check
  30.619 -        * @return true if this cookie can produce object of given type
  30.620 -        */
  30.621 -        public boolean instanceOf(Class type) {
  30.622 -            String className=type.getName();
  30.623 -            ClassElement ce=getMainClass();
  30.624 -            
  30.625 -            if (ce == null)
  30.626 -                return false;
  30.627 -            boolean isClassType = !type.isInterface();
  30.628 -            String typename = type.getName().replace('$', '.');
  30.629 -            Identifier id;
  30.630 -            LinkedList l = new LinkedList();
  30.631 -            
  30.632 -            do {
  30.633 -                if (ce.getName().getFullName().equals(typename)) 
  30.634 -                    return true;
  30.635 -                id = ce.getSuperclass();
  30.636 -                Identifier[] itfs = ce.getInterfaces();
  30.637 -                for (int i = 0; i < itfs.length; i++) {
  30.638 -                    l.addLast(itfs[i]);
  30.639 -                }
  30.640 -                if (id == null) {
  30.641 -                    if (l.isEmpty())
  30.642 -                        return false;
  30.643 -                    else
  30.644 -                        id = (Identifier)l.removeFirst();
  30.645 -                }
  30.646 -                ce = ClassElement.forName(id.getFullName(), ClassDataObject.this.getPrimaryFile());
  30.647 -                while (ce == null && !l.isEmpty()) 
  30.648 -                    ce = ClassElement.forName(((Identifier)l.removeFirst()).getFullName(),
  30.649 -                            ClassDataObject.this.getPrimaryFile());
  30.650 -            } while (ce != null);
  30.651 -            return false;
  30.652 -        }
  30.653 -
  30.654 -        /** Is this a standalone executable?
  30.655 -         * @return <code>true</code> if this class has main method
  30.656 -         * (e.g., <code>public static void main (String[] arguments)</code>).
  30.657 -         */
  30.658 -        public boolean isExecutable() {
  30.659 -            try {
  30.660 -                if (executable == null) {
  30.661 -                    ClassElement ce=getMainClass();
  30.662 -                    
  30.663 -                    executable = ((ce==null) ? false : ce.hasMainMethod()) ? Boolean.TRUE : Boolean.FALSE;
  30.664 -                }
  30.665 -            } catch (InvalidObjectException ioe) {
  30.666 -                executable = Boolean.FALSE;
  30.667 -            }
  30.668 -            return executable.booleanValue();
  30.669 -        }
  30.670 -        
  30.671 -        /** Test whether the instance represents serialized version of a class
  30.672 -         * or not.
  30.673 -         * @return true if the file entry extension is ser
  30.674 -         */
  30.675 -        private boolean isSerialized () {
  30.676 -            return instanceOrigin().getExt().equals("ser"); // NOI18N
  30.677 -        }
  30.678 -
  30.679 -        public Object instanceCreate() throws java.io.IOException, ClassNotFoundException {
  30.680 -            try {
  30.681 -                if (isSerialized()) {
  30.682 -                    // create from ser file
  30.683 -                    BufferedInputStream bis = new BufferedInputStream(instanceOrigin().getInputStream(), 1024);
  30.684 -                    ClassLoader classLoader = createClassLoader(instanceOrigin());
  30.685 -                    if (classLoader == null) {
  30.686 -                        throw new ClassNotFoundException ();
  30.687 -                    }
  30.688 -                    CMObjectInputStream cis = new CMObjectInputStream(bis,classLoader);
  30.689 -                    Object o = null;
  30.690 -                    try {
  30.691 -                        o = cis.readObject();
  30.692 -                    } finally {
  30.693 -                        cis.close();
  30.694 -                    }
  30.695 -                    return o;
  30.696 -                } else {
  30.697 -                    return super.instanceCreate();
  30.698 -                }
  30.699 -            } catch (IOException ex) {
  30.700 -                // [PENDING] annotate with localized message
  30.701 -                ErrorManager.getDefault().annotate(ex, instanceName());
  30.702 -                throw ex;
  30.703 -            } catch (ClassNotFoundException ex) {
  30.704 -                throw ex;
  30.705 -            } catch (Exception e) {
  30.706 -                // turn other throwables into class not found ex.
  30.707 -                throw new ClassNotFoundException(e.toString(), e);
  30.708 -            } catch (LinkageError e) {
  30.709 -                throw new ClassNotFoundException(e.toString(), e);
  30.710 -                
  30.711 -            }
  30.712 -        }
  30.713 -        
  30.714 -        private final class CMObjectInputStream extends ObjectInputStream {
  30.715 -            
  30.716 -            private ClassLoader loader;
  30.717 -            
  30.718 -            protected CMObjectInputStream(InputStream s, ClassLoader cl) throws IOException {
  30.719 -                super(s);
  30.720 -                loader=cl;
  30.721 -            }
  30.722 -            
  30.723 -            protected Class resolveClass(ObjectStreamClass s) throws IOException, ClassNotFoundException {
  30.724 -                return Class.forName(s.getName(), false, loader);
  30.725 -            }
  30.726 -            
  30.727 -        }        
  30.728 -    }
  30.729 -
  30.730 -    private class OpenSourceCookie implements OpenCookie {
  30.731 -
  30.732 -        public void open() {
  30.733 -            try {
  30.734 -                FileObject fo = getPrimaryFile();
  30.735 -                FileObject binaryRoot = null;
  30.736 -                String resourceName = null;
  30.737 -                ClassPath cp = ClassPath.getClassPath (fo, ClassPath.COMPILE);
  30.738 -                if (cp == null || (binaryRoot = cp.findOwnerRoot (fo))==null) {
  30.739 -                    cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE);
  30.740 -                    if (cp != null) {
  30.741 -                        binaryRoot = cp.findOwnerRoot (fo);
  30.742 -                        resourceName = cp.getResourceName(fo,'/',false);  //NOI18N
  30.743 -                    }
  30.744 -                }
  30.745 -                else if (binaryRoot != null) {
  30.746 -                    resourceName = cp.getResourceName(fo,'/',false);  //NOI18N
  30.747 -                }
  30.748 -                FileObject[] sourceRoots = null;
  30.749 -                if (binaryRoot != null) {
  30.750 -                     sourceRoots = SourceForBinaryQuery.findSourceRoots (binaryRoot.getURL()).getRoots();
  30.751 -                }
  30.752 -                FileObject resource = null;
  30.753 -                if (sourceRoots != null && sourceRoots.length>0) {
  30.754 -                    cp = ClassPathSupport.createClassPath(sourceRoots);
  30.755 -                    resource = cp.findResource (resourceName+ ".java"); //NOI18N
  30.756 -                }
  30.757 -                if (resource !=null ) {
  30.758 -                    DataObject sourceFile = DataObject.find(resource);
  30.759 -                    OpenCookie oc = (OpenCookie) sourceFile.getCookie(OpenCookie.class);
  30.760 -                    if (oc != null) {
  30.761 -                        oc.open();
  30.762 -                    }
  30.763 -                    else {
  30.764 -                        ErrorManager.getDefault().log ("SourceFile: "+resource.getPath()+" has no OpenCookie"); //NOI18N
  30.765 -                    }
  30.766 -                }
  30.767 -                else {
  30.768 -                   if (resourceName == null)
  30.769 -                       resourceName = fo.getName();
  30.770 -                   StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(ClassDataObject.class,"TXT_NoSources",
  30.771 -                        resourceName.replace('/','.'))); //NOI18N
  30.772 -                }
  30.773 -            } catch (FileStateInvalidException e) {
  30.774 -                ErrorManager.getDefault().notify(e);
  30.775 -            }
  30.776 -            catch (DataObjectNotFoundException nf) {
  30.777 -                ErrorManager.getDefault().notify(nf);
  30.778 -            }
  30.779 -        }
  30.780 -    }
  30.781 -}
    31.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,561 +0,0 @@
    31.4 -/*
    31.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    31.6 - *
    31.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    31.8 - *
    31.9 - * The contents of this file are subject to the terms of either the GNU
   31.10 - * General Public License Version 2 only ("GPL") or the Common
   31.11 - * Development and Distribution License("CDDL") (collectively, the
   31.12 - * "License"). You may not use this file except in compliance with the
   31.13 - * License. You can obtain a copy of the License at
   31.14 - * http://www.netbeans.org/cddl-gplv2.html
   31.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   31.16 - * specific language governing permissions and limitations under the
   31.17 - * License.  When distributing the software, include this License Header
   31.18 - * Notice in each file and include the License file at
   31.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   31.20 - * particular file as subject to the "Classpath" exception as provided
   31.21 - * by Sun in the GPL Version 2 section of the License file that
   31.22 - * accompanied this code. If applicable, add the following below the
   31.23 - * License Header, with the fields enclosed by brackets [] replaced by
   31.24 - * your own identifying information:
   31.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   31.26 - *
   31.27 - * Contributor(s):
   31.28 - *
   31.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   31.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   31.31 - * Microsystems, Inc. All Rights Reserved.
   31.32 - *
   31.33 - * If you wish your version of this file to be governed by only the CDDL
   31.34 - * or only the GPL Version 2, indicate your decision by adding
   31.35 - * "[Contributor] elects to include this software in this distribution
   31.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   31.37 - * single choice of license, a recipient has the option to distribute
   31.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   31.39 - * to extend the choice of license to its licensees as provided above.
   31.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   31.41 - * Version 2 license, then the option applies only if the new code is
   31.42 - * made subject to such option by the copyright holder.
   31.43 - */
   31.44 -
   31.45 -package org.netbeans.modules.clazz;
   31.46 -
   31.47 -import org.netbeans.modules.classfile.ClassFile;
   31.48 -import org.netbeans.modules.classfile.InnerClass;
   31.49 -import org.openide.src.*;
   31.50 -import java.lang.ref.SoftReference;
   31.51 -import java.util.*;
   31.52 -import org.netbeans.api.mdr.MDRepository;
   31.53 -import org.netbeans.jmi.javamodel.Constructor;
   31.54 -import org.netbeans.jmi.javamodel.Feature;
   31.55 -import org.netbeans.jmi.javamodel.Field;
   31.56 -import org.netbeans.jmi.javamodel.JavaClass;
   31.57 -import org.netbeans.jmi.javamodel.Method;
   31.58 -import org.netbeans.jmi.javamodel.NamedElement;
   31.59 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   31.60 -import org.openide.util.RequestProcessor;
   31.61 -
   31.62 -/** The implementation of the class element for
   31.63 -* class objects. Presents data about the class -
   31.64 -* uses java reflection to obtain needed information.
   31.65 -*
   31.66 -* @author Dafe Simonek
   31.67 -*/
   31.68 -public final class ClassElementImpl extends MemberElementImpl implements ClassElement.Impl, ElementProperties {
   31.69 -    /** Empty array of initializers - constant to return from getInitializers() */
   31.70 -    private static final InitializerElement[] EMPTY_INITIALIZERS =
   31.71 -        new InitializerElement[0];
   31.72 -    private static final Object[] EMPTY_ARRAY = new Object[0];
   31.73 -
   31.74 -    /** Identifier of superclass of this class element,
   31.75 -    * can be empty */
   31.76 -    private Identifier superClass;
   31.77 -    /** Array of identifiers for interfaces */
   31.78 -    private Identifier[] interfaces;
   31.79 -
   31.80 -    /** Fields of this class element */
   31.81 -    private SoftReference fields;
   31.82 -    /** Inner classes of this class element */
   31.83 -    private SoftReference inners;
   31.84 -    /** Contructors of this class element */
   31.85 -    private SoftReference constructors;
   31.86 -    /** Methods of this class element */
   31.87 -    private SoftReference methods;
   31.88 -    
   31.89 -    /* InnerClass attribute of a associeted with this classfile */ 
   31.90 -    private InnerClass innerclass;
   31.91 -    
   31.92 -    private boolean isClassInited = false;
   31.93 -    private boolean isClass;
   31.94 -    
   31.95 -    /** One JavaDoc empty implementation for all objects */
   31.96 -    private static final ClassJavaDocImpl.Class CLASS_JAVADOC_IMPL = new ClassJavaDocImpl.Class ();
   31.97 -    
   31.98 -    private static final Identifier NO_SUPERCLASS = Identifier.create(""); // NOI18N
   31.99 -
  31.100 -    static final long serialVersionUID =-8717988834353784544L;
  31.101 -    /** Default constructor.
  31.102 -    */
  31.103 -    public ClassElementImpl (final ClassFile data) {
  31.104 -        super(data);
  31.105 -    }
  31.106 -    
  31.107 -    ClassElementImpl(JavaClass data) {
  31.108 -        super(data);
  31.109 -    }
  31.110 -    
  31.111 -    private ClassElementImpl (final ClassFile data,InnerClass inner) {
  31.112 -        this(data);
  31.113 -        innerclass=inner;
  31.114 -    }
  31.115 -    
  31.116 -    public void initializeData() {
  31.117 -        super.initializeData();
  31.118 -        getSuperclass();
  31.119 -        isClassOrInterface();
  31.120 -        getInterfaces();
  31.121 -        ClassElement[] classes = getClasses();
  31.122 -        for (int x = 0; x < classes.length; x++) {
  31.123 -            ClassElementImpl impl = (ClassElementImpl) classes[x].getCookie(org.openide.src.Element.Impl.class);
  31.124 -            impl.initializeData();
  31.125 -        }
  31.126 -        FieldElement[] fields = getFields();
  31.127 -        for (int x = 0; x < fields.length; x++) {
  31.128 -            FieldElementImpl impl = (FieldElementImpl) fields[x].getCookie(org.openide.src.Element.Impl.class);
  31.129 -            impl.initializeData();
  31.130 -        }
  31.131 -        MethodElement[] methods = getMethods();
  31.132 -        for (int x = 0; x < methods.length; x++) {
  31.133 -            MethodElementImpl impl = (MethodElementImpl) methods[x].getCookie(org.openide.src.Element.Impl.class);
  31.134 -            impl.initializeData();
  31.135 -        }
  31.136 -        ConstructorElement[] cons = getConstructors();
  31.137 -        for (int x = 0; x < cons.length; x++) {
  31.138 -            ConstructorElementImpl impl = (ConstructorElementImpl) cons[x].getCookie(org.openide.src.Element.Impl.class);
  31.139 -            impl.initializeData();
  31.140 -        }
  31.141 -    }
  31.142 -    
  31.143 -    /** Not supported. Throws source exception */
  31.144 -    public void setSuperclass(Identifier superClass) throws SourceException {
  31.145 -        throwReadOnlyException();
  31.146 -    }
  31.147 -    
  31.148 -    JavaClass getClazz() {
  31.149 -        return (JavaClass)data;
  31.150 -    }
  31.151 -
  31.152 -    public Identifier getSuperclass() {
  31.153 -        if (superClass == NO_SUPERCLASS)
  31.154 -            return null;
  31.155 -        if (superClass != null)
  31.156 -            return superClass;
  31.157 -        
  31.158 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.159 -        repo.beginTrans(false);
  31.160 -        try {
  31.161 -            if (!isValid()) {
  31.162 -                return Identifier.create(""); // NOI18N
  31.163 -            }
  31.164 -            if (superClass == null) {
  31.165 -                JavaClass c = getClazz();
  31.166 -                JavaClass tid = c.getSuperClass();
  31.167 -                if (tid == null)
  31.168 -                    superClass = NO_SUPERCLASS;
  31.169 -                else
  31.170 -                    superClass = Identifier.create(Util.createClassName(tid.getName()));
  31.171 -            }
  31.172 -            if (superClass == NO_SUPERCLASS)
  31.173 -                return null;
  31.174 -            else
  31.175 -                return superClass;
  31.176 -        } finally {
  31.177 -            repo.endTrans();
  31.178 -        }
  31.179 -    }
  31.180 -    
  31.181 -    protected Identifier createName(Object data) {
  31.182 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.183 -        repo.beginTrans(false);
  31.184 -        try {
  31.185 -            if (!isValid()) {
  31.186 -                return Identifier.create(""); // NOI18N
  31.187 -            }
  31.188 -            String fqn=getClazz().getName();
  31.189 -            String simpleName;
  31.190 -            int lastDot=fqn.lastIndexOf('.');
  31.191 -
  31.192 -            if (lastDot!=-1)
  31.193 -                simpleName=fqn.substring(lastDot+1);
  31.194 -            else
  31.195 -                simpleName=fqn;
  31.196 -            return Identifier.create(fqn, simpleName);
  31.197 -        } finally {
  31.198 -            repo.endTrans();
  31.199 -        }
  31.200 -    }
  31.201 -
  31.202 -    /** Not supported. Throws Source Exception */
  31.203 -    public void setClassOrInterface(boolean isClass) throws SourceException {
  31.204 -        throwReadOnlyException();
  31.205 -    }
  31.206 -
  31.207 -    public boolean isClassOrInterface() {
  31.208 -        if (isClassInited)
  31.209 -            return isClass;
  31.210 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.211 -        repo.beginTrans(false);
  31.212 -        try {
  31.213 -            if (!isValid()) {
  31.214 -                return true;
  31.215 -            }
  31.216 -            isClassInited = true;
  31.217 -            return isClass = !getClazz().isInterface();
  31.218 -        } finally {
  31.219 -            repo.endTrans();
  31.220 -        }
  31.221 -    }
  31.222 -
  31.223 -    /** Not supported. Throws SourceException.
  31.224 -    */
  31.225 -    public void changeInitializers (InitializerElement[] elems, int action) throws SourceException {
  31.226 -        throwReadOnlyException();
  31.227 -    }
  31.228 -
  31.229 -    /** Not available. Always returns empty array */
  31.230 -    public InitializerElement[] getInitializers () {
  31.231 -        return EMPTY_INITIALIZERS;
  31.232 -    }
  31.233 -
  31.234 -    /** Changes set of elements.
  31.235 -    * @param elems elements to change
  31.236 -    * @exception SourceException if the action cannot be handled
  31.237 -    */
  31.238 -    public void changeFields (FieldElement[] elems, int action) throws SourceException {
  31.239 -        throwReadOnlyException();
  31.240 -    }
  31.241 -
  31.242 -    public FieldElement[] getFields () {
  31.243 -        Map fieldsMap = (fields == null) ? null : (Map)fields.get();
  31.244 -        if (fieldsMap == null) {
  31.245 -            // soft ref null, we must recreate
  31.246 -            fieldsMap = createFieldsMap();
  31.247 -            fields = new SoftReference(fieldsMap);
  31.248 -        }
  31.249 -        return (FieldElement[])fieldsMap.values().toArray(new FieldElement[0]);
  31.250 -    }
  31.251 -
  31.252 -    /** Finds a field with given name.
  31.253 -    * @param name the name of field to look for
  31.254 -    * @return the element or null if field with such name does not exist
  31.255 -    */
  31.256 -    public FieldElement getField (Identifier name) {
  31.257 -        Map fieldsMap = (fields == null) ? null : (Map)fields.get();
  31.258 -        if (fieldsMap == null) {
  31.259 -            // soft ref null, we must recreate
  31.260 -            fieldsMap = createFieldsMap();
  31.261 -            fields = new SoftReference(fieldsMap);
  31.262 -        }
  31.263 -        return (FieldElement)fieldsMap.get(name);
  31.264 -    }
  31.265 -
  31.266 -    /** Changes set of elements.
  31.267 -    * @param elems elements to change
  31.268 -    * @exception SourceException if the action cannot be handled
  31.269 -    */
  31.270 -    public void changeMethods (MethodElement[] elems, int action) throws SourceException {
  31.271 -        throwReadOnlyException();
  31.272 -    }
  31.273 -
  31.274 -    public MethodElement[] getMethods () {
  31.275 -        Map methodsMap = (methods == null) ? null : (Map)methods.get();
  31.276 -        if (methodsMap == null) {
  31.277 -            // soft ref null, we must recreate
  31.278 -            methodsMap = createMethodsMap();
  31.279 -            methods = new SoftReference(methodsMap);
  31.280 -        }
  31.281 -        return (MethodElement[])methodsMap.values().toArray(new MethodElement[0]);
  31.282 -    }
  31.283 -
  31.284 -    /** Finds a method with given name and argument types.
  31.285 -    * @param name the name of field to look for
  31.286 -    * @param arguments for the method
  31.287 -    * @return the element or null if such method does not exist
  31.288 -    */
  31.289 -    public MethodElement getMethod (Identifier name, Type[] arguments) {
  31.290 -        Map methodsMap = (methods == null) ? null : (Map)methods.get();
  31.291 -        if (methodsMap == null) {
  31.292 -            // soft ref null, we must recreate
  31.293 -            methodsMap = createMethodsMap();
  31.294 -            methods = new SoftReference(methodsMap);
  31.295 -        }
  31.296 -        return (MethodElement)
  31.297 -               methodsMap.get(new MethodElement.Key(name, arguments));
  31.298 -    }
  31.299 -
  31.300 -    /** Changes set of elements.
  31.301 -    * @param elems elements to change
  31.302 -    * @exception SourceException if the action cannot be handled
  31.303 -    */
  31.304 -    public void changeConstructors (ConstructorElement[] elems, int action) throws SourceException {
  31.305 -        throwReadOnlyException();
  31.306 -    }
  31.307 -
  31.308 -    public ConstructorElement[] getConstructors () {
  31.309 -        Map constructorsMap =
  31.310 -            (constructors == null) ? null :(Map)constructors.get();
  31.311 -        if (constructorsMap == null) {
  31.312 -            // soft ref null, we must recreate
  31.313 -            constructorsMap = createConstructorsMap();
  31.314 -            constructors = new SoftReference(constructorsMap);
  31.315 -        }
  31.316 -        return (ConstructorElement[])constructorsMap.values().
  31.317 -               toArray(new ConstructorElement[0]);
  31.318 -    }
  31.319 -
  31.320 -    /** Finds a constructor with argument types.
  31.321 -    * @param arguments for the method
  31.322 -    * @return the element or null if such method does not exist
  31.323 -    */
  31.324 -    public ConstructorElement getConstructor (Type[] arguments) {
  31.325 -        Map constructorsMap =
  31.326 -            (constructors == null) ? null :(Map)constructors.get();
  31.327 -        if (constructorsMap == null) {
  31.328 -            // soft ref null, we must recreate
  31.329 -            constructorsMap = createConstructorsMap();
  31.330 -            constructors = new SoftReference(constructorsMap);
  31.331 -        }
  31.332 -        return (ConstructorElement)
  31.333 -               constructorsMap.get(new ConstructorElement.Key(arguments));
  31.334 -    }
  31.335 -
  31.336 -    /** Changes set of elements.
  31.337 -    * @param elems elements to change
  31.338 -    * @exception SourceException if the action cannot be handled
  31.339 -    */
  31.340 -    public void changeClasses (ClassElement[] elems, int action) throws SourceException {
  31.341 -        throwReadOnlyException();
  31.342 -    }
  31.343 -
  31.344 -    public ClassElement[] getClasses () {
  31.345 -        Map innersMap = (inners == null) ? null : (Map)inners.get();
  31.346 -        if (innersMap == null) {
  31.347 -            // soft ref null, we must recreate
  31.348 -            innersMap = createInnersMap();
  31.349 -            inners = new SoftReference(innersMap);
  31.350 -        }
  31.351 -        return (ClassElement[])innersMap.values().toArray(new ClassElement[0]);
  31.352 -    }
  31.353 -
  31.354 -    /** Finds an inner class with given name.
  31.355 -    * @param name the name to look for
  31.356 -    * @return the element or null if such class does not exist
  31.357 -    */
  31.358 -    public ClassElement getClass (Identifier n) {
  31.359 -        Map innersMap = (inners == null) ? null : (Map)inners.get();
  31.360 -        if (innersMap == null) {
  31.361 -            // soft ref null, we must recreate
  31.362 -            innersMap = createInnersMap();
  31.363 -            inners = new SoftReference(innersMap);
  31.364 -        }
  31.365 -        String key = n.getSourceName();
  31.366 -        ClassElement el = (ClassElement)innersMap.get(key);
  31.367 -        if (el != null) {
  31.368 -            if (!key.equals(n.getFullName()) &&
  31.369 -                !n.getFullName().equals(el.getName().getFullName()))
  31.370 -            el = null;
  31.371 -        }
  31.372 -        return el;
  31.373 -    }
  31.374 -
  31.375 -    /** Changes interfaces this class implements (or extends).
  31.376 -    * @param ids identifiers to change
  31.377 -    * @exception SourceException if the action cannot be handled
  31.378 -    */
  31.379 -    public void changeInterfaces (Identifier[] ids, int action) throws SourceException {
  31.380 -        throwReadOnlyException();
  31.381 -    }
  31.382 -
  31.383 -    /** @return all interfaces which the class implements or interface extends.
  31.384 -    */
  31.385 -    public Identifier[] getInterfaces () {
  31.386 -        if (interfaces == null) {
  31.387 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.388 -            repo.beginTrans(false);
  31.389 -            try {
  31.390 -                if (!isValid()) {
  31.391 -                    interfaces = new Identifier[0];
  31.392 -                } else {
  31.393 -                    JavaClass[] reflIntfs = (JavaClass[])getClazz().getInterfaces().toArray(new JavaClass[0]);
  31.394 -                    interfaces = new Identifier[reflIntfs.length];
  31.395 -                    for (int i = 0; i < reflIntfs.length; i++) {
  31.396 -                        interfaces[i] = Identifier.create(Util.createClassName(reflIntfs[i].getName()));
  31.397 -                    }
  31.398 -                }
  31.399 -            } finally {
  31.400 -                repo.endTrans();
  31.401 -            }
  31.402 -        }
  31.403 -        return interfaces;
  31.404 -    }
  31.405 -
  31.406 -    /** @return class documentation.
  31.407 -    */
  31.408 -    public JavaDoc.Class getJavaDoc() {
  31.409 -        return CLASS_JAVADOC_IMPL;
  31.410 -    }
  31.411 -
  31.412 -    /******** non public methods ***********/
  31.413 -
  31.414 -    /** Creates map for fields consisting of identifier - field entries */
  31.415 -    private Map createFieldsMap () {
  31.416 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.417 -        repo.beginTrans(false);
  31.418 -        try {
  31.419 -            if (!isValid()) {
  31.420 -                return Collections.EMPTY_MAP;
  31.421 -            }
  31.422 -            Feature[] reflFields = (Feature[])getClazz().getFeatures().toArray(new Feature[0]);
  31.423 -            Map result = new HashMap(reflFields.length);
  31.424 -            for (int i = 0; i < reflFields.length; i++) {
  31.425 -                Feature f=reflFields[i];
  31.426 -
  31.427 -                if (f instanceof Field) {
  31.428 -                    Field field=(Field)f;
  31.429 -                    // filter out methods added by compiler
  31.430 -                    if (!addedByCompiler(field)) {
  31.431 -                        FieldElement curFE = new FieldElement(new FieldElementImpl(field),
  31.432 -                                                 (ClassElement)element);
  31.433 -                        result.put(curFE.getName(), curFE);
  31.434 -                    }
  31.435 -                }
  31.436 -            }
  31.437 -            return result;
  31.438 -        } finally {
  31.439 -            repo.endTrans();
  31.440 -        }
  31.441 -    }
  31.442 -
  31.443 -    /** Creates map for inner classes of this class,
  31.444 -    * consisting of identifier - class element entries */
  31.445 -    private Map createInnersMap () {
  31.446 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.447 -        repo.beginTrans(false);
  31.448 -        try {
  31.449 -            if (!isValid()) {
  31.450 -                return Collections.EMPTY_MAP;
  31.451 -            }
  31.452 -            Feature[] reflInners = (Feature[])getClazz().getFeatures().toArray(new Feature[0]);
  31.453 -
  31.454 -            // create map
  31.455 -            ClassElement curCE = null;
  31.456 -            Map result = new HashMap(reflInners.length);
  31.457 -            for (int i = 0; i < reflInners.length; i++) {
  31.458 -                Feature f=reflInners[i];
  31.459 -
  31.460 -                if (f instanceof JavaClass) {
  31.461 -                    JavaClass jcls=(JavaClass)f;
  31.462 -                    String iname = jcls.getName();
  31.463 -                    curCE = new ClassElement(new ClassElementImpl(jcls),
  31.464 -                                             (ClassElement)element);
  31.465 -                    result.put(iname, curCE);
  31.466 -                }
  31.467 -            }
  31.468 -            return result;
  31.469 -        } finally {
  31.470 -            repo.endTrans();
  31.471 -        }
  31.472 -    }
  31.473 -
  31.474 -    SourceElementImpl findSourceImpl() {
  31.475 -        return (SourceElementImpl)((ClassElement)element).getSource().getCookie(SourceElement.Impl.class);
  31.476 -    }
  31.477 -
  31.478 -    /** Creates map for constructors of this class,
  31.479 -    * consisting of constructor key - constructor element entries */
  31.480 -    private Map createConstructorsMap () {
  31.481 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.482 -        repo.beginTrans(false);
  31.483 -        try {
  31.484 -            if (!isValid()) {
  31.485 -                return Collections.EMPTY_MAP;
  31.486 -            }
  31.487 -            Feature[] reflCons = (Feature[])getClazz().getFeatures().toArray(new Feature[0]);
  31.488 -            Map result = new HashMap(reflCons.length);
  31.489 -
  31.490 -            for (int i = 0; i < reflCons.length; i++) {
  31.491 -                Feature f=reflCons[i];
  31.492 -
  31.493 -                if (f instanceof Constructor) {
  31.494 -                    ConstructorElement curCE = new ConstructorElement(new ConstructorElementImpl((Constructor)f),
  31.495 -                                                   (ClassElement)element);
  31.496 -                    result.put(new ConstructorElement.Key(curCE), curCE);
  31.497 -                }
  31.498 -            }
  31.499 -            return result;
  31.500 -        } finally {
  31.501 -            repo.endTrans();
  31.502 -        }
  31.503 -    }
  31.504 -
  31.505 -    /** Creates map for methods of this class,
  31.506 -    * consisting of method key - method element entries */
  31.507 -    private Map createMethodsMap () {
  31.508 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  31.509 -        repo.beginTrans(false);
  31.510 -        try {
  31.511 -            if (!isValid()) {
  31.512 -                return Collections.EMPTY_MAP;
  31.513 -            }
  31.514 -            Feature[] reflMethods = (Feature[])getClazz().getFeatures().toArray(new Feature[0]);
  31.515 -            Map result = new HashMap(reflMethods.length);
  31.516 -
  31.517 -            for (int i = 0; i < reflMethods.length; i++) {
  31.518 -                Feature f=reflMethods[i];
  31.519 -
  31.520 -                if (f instanceof Method) {                
  31.521 -                    // filter out methods added by compiler
  31.522 -                    Method m = (Method)f;
  31.523 -                    if (!addedByCompiler(m)) {
  31.524 -                        MethodElement curME = new MethodElement(new MethodElementImpl(m),
  31.525 -                                                  (ClassElement)element);
  31.526 -                        result.put(new MethodElement.Key(curME, true), curME);
  31.527 -                    }
  31.528 -                }
  31.529 -            }
  31.530 -            return result;
  31.531 -        } finally {
  31.532 -            repo.endTrans();
  31.533 -        }
  31.534 -    }
  31.535 -
  31.536 -    public Object readResolve() {
  31.537 -        return new ClassElement(this, (SourceElement)null);
  31.538 -    }
  31.539 -
  31.540 -    public void refreshData() {
  31.541 -        // System.out.println("refreshing class ...");
  31.542 -        fields = null;
  31.543 -        inners = null;
  31.544 -        constructors = null;
  31.545 -        methods = null;
  31.546 -        RequestProcessor.getDefault().post(new Runnable() {
  31.547 -            public void run() {
  31.548 -                firePropertyChange(PROP_MEMBERS, null, null);
  31.549 -                firePropertyChange(PROP_METHODS, null, null);
  31.550 -                firePropertyChange(PROP_FIELDS, null, null);
  31.551 -                firePropertyChange(PROP_CONSTRUCTORS, null, null);
  31.552 -                firePropertyChange(PROP_CLASSES, null, null);
  31.553 -            }
  31.554 -        });
  31.555 -    }
  31.556 -    
  31.557 -    /** @return true if given member was generated automatically by compiler,
  31.558 -    * false otherwise. Decision is made by inspecting the name of the member.
  31.559 -    */
  31.560 -    private static boolean addedByCompiler(NamedElement field) {
  31.561 -        String name = field.getName();
  31.562 -        return name.indexOf('$') >= 0;
  31.563 -    }   
  31.564 -}
    32.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassElementNodeFactory.java	Wed Sep 15 11:58:07 2010 +0530
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,213 +0,0 @@
    32.4 -/*
    32.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    32.6 - *
    32.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    32.8 - *
    32.9 - * The contents of this file are subject to the terms of either the GNU
   32.10 - * General Public License Version 2 only ("GPL") or the Common
   32.11 - * Development and Distribution License("CDDL") (collectively, the
   32.12 - * "License"). You may not use this file except in compliance with the
   32.13 - * License. You can obtain a copy of the License at
   32.14 - * http://www.netbeans.org/cddl-gplv2.html
   32.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   32.16 - * specific language governing permissions and limitations under the
   32.17 - * License.  When distributing the software, include this License Header
   32.18 - * Notice in each file and include the License file at
   32.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   32.20 - * particular file as subject to the "Classpath" exception as provided
   32.21 - * by Sun in the GPL Version 2 section of the License file that
   32.22 - * accompanied this code. If applicable, add the following below the
   32.23 - * License Header, with the fields enclosed by brackets [] replaced by
   32.24 - * your own identifying information:
   32.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   32.26 - *
   32.27 - * Contributor(s):
   32.28 - *
   32.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   32.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   32.31 - * Microsystems, Inc. All Rights Reserved.
   32.32 - *
   32.33 - * If you wish your version of this file to be governed by only the CDDL
   32.34 - * or only the GPL Version 2, indicate your decision by adding
   32.35 - * "[Contributor] elects to include this software in this distribution
   32.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   32.37 - * single choice of license, a recipient has the option to distribute
   32.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   32.39 - * to extend the choice of license to its licensees as provided above.
   32.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   32.41 - * Version 2 license, then the option applies only if the new code is
   32.42 - * made subject to such option by the copyright holder.
   32.43 - */
   32.44 -
   32.45 -package org.netbeans.modules.clazz;
   32.46 -
   32.47 -import java.beans.*;
   32.48 -
   32.49 -import org.openide.actions.PropertiesAction;
   32.50 -import org.openide.actions.ToolsAction;
   32.51 -import org.openide.cookies.FilterCookie;
   32.52 -import org.openide.nodes.Node;
   32.53 -import org.openide.nodes.AbstractNode;
   32.54 -import org.openide.nodes.Children;
   32.55 -import org.openide.nodes.CookieSet;
   32.56 -import org.openide.src.*;
   32.57 -import org.openide.src.nodes.*;
   32.58 -import org.openide.util.NbBundle;
   32.59 -import org.openide.util.actions.SystemAction;
   32.60 -
   32.61 -/** The implementation of hierarchy nodes factory for the class loader.
   32.62 -*
   32.63 -* @author Petr Hamernik, Dafe Simonek
   32.64 -*/
   32.65 -final class ClassElementNodeFactory extends DefaultFactory {
   32.66 -
   32.67 -    private final FactoryGetterNode FACTORY_GETTER_NODE = new FactoryGetterNode();
   32.68 -
   32.69 -    /** Default instance of this factory. */
   32.70 -    private static DefaultFactory instance;
   32.71 -
   32.72 -    /** Array of the actions for element nodes */
   32.73 -    private static SystemAction[] defaultActions;
   32.74 -
   32.75 -    /** Create nodes for tree */
   32.76 -    private boolean tree = false;
   32.77 -
   32.78 -    /** Creates new factory. */
   32.79 -    public ClassElementNodeFactory() {
   32.80 -        super(false);
   32.81 -    }
   32.82 -
   32.83 -    /** If true generate nodes for tree.
   32.84 -    */
   32.85 -    public void setGenerateForTree (boolean tree) {
   32.86 -        this.tree = tree;
   32.87 -    }
   32.88 -
   32.89 -    /** Returns true if generate nodes for tree.
   32.90 -    * @returns true if generate nodes for tree.
   32.91 -    */
   32.92 -    public boolean getGenerateForTree () {
   32.93 -        return tree;
   32.94 -    }
   32.95 -
   32.96 -    /** Returns the node asociated with specified element.
   32.97 -    * @return ElementNode
   32.98 -    */
   32.99 -    public Node createMethodNode(final MethodElement element) {
  32.100 -        MethodElementNode n = new MethodElementNode(element, false);
  32.101 -        n.setDefaultAction(SystemAction.get(PropertiesAction.class));
  32.102 -        n.setActions(getDefaultActions());
  32.103 -        return n;
  32.104 -    }
  32.105 -
  32.106 -    /** Returns the node asociated with specified element.
  32.107 -    * @return ElementNode
  32.108 -    */
  32.109 -    public Node createConstructorNode(ConstructorElement element) {
  32.110 -        ConstructorElementNode n = new ConstructorElementNode(element, false);
  32.111 -        n.setDefaultAction(SystemAction.get(PropertiesAction.class));
  32.112 -        n.setActions(getDefaultActions());
  32.113 -        return n;
  32.114 -    }
  32.115 -
  32.116 -    /** Returns the node asociated with specified element.
  32.117 -    * @return ElementNode
  32.118 -    */
  32.119 -    public Node createFieldNode(FieldElement element) {
  32.120 -        FieldElementNode n = new FieldElementNode(element, false);
  32.121 -        n.setDefaultAction(SystemAction.get(PropertiesAction.class));
  32.122 -        n.setActions(getDefaultActions());
  32.123 -        return n;
  32.124 -    }
  32.125 -
  32.126 -    /** Returns the node asociated with specified element.
  32.127 -    * @return ElementNode
  32.128 -    */
  32.129 -    public Node createClassNode (final ClassElement element) {
  32.130 -        if ( element == null ) {
  32.131 -            return FACTORY_GETTER_NODE;
  32.132 -        }
  32.133 -        if (tree) {
  32.134 -            ClassChildren ch = new ClassChildren(ClassDataObject.getBrowserFactory(), element);
  32.135 -            ClassElementNode n = new ClassElementNode(element, ch, false) {
  32.136 -                {
  32.137 -                    getCookieSet().add((FilterCookie)getChildren());
  32.138 -                }
  32.139 -            };
  32.140 -
  32.141 -            n.setElementFormat(new ElementFormat (
  32.142 -                                   NbBundle.getBundle (ClassElementNodeFactory.class).getString("CTL_Class_name_format")
  32.143 -                               ));
  32.144 -
  32.145 -            // filter out inner classes
  32.146 -            ClassElementFilter cel = new ClassElementFilter ();
  32.147 -            cel.setOrder (new int[] {
  32.148 -                              ClassElementFilter.CONSTRUCTOR + ClassElementFilter.METHOD,
  32.149 -                              ClassElementFilter.FIELD,
  32.150 -                          });
  32.151 -            ch.setFilter (cel);
  32.152 -            n.setActions(getDefaultActions());
  32.153 -            n.setIconBase (element.isInterface () ?
  32.154 -                           "org/netbeans/modules/clazz/resources/interfaceBr" : // NOI18N
  32.155 -                           "org/netbeans/modules/clazz/resources/classBr" // NOI18N
  32.156 -                          );
  32.157 -            return n;
  32.158 -        }
  32.159 -        else {
  32.160 -            Children ch = createClassChildren(element, ClassDataObject.getExplorerFactory() );
  32.161 -            ClassElementNode n = new ClassElementNode(element, ch, false);
  32.162 -            n.setActions(getDefaultActions());
  32.163 -            return n;
  32.164 -        }
  32.165 -    }
  32.166 -
  32.167 -    /** Convenience method for obtaining default actions of nodes */
  32.168 -    SystemAction[] getDefaultActions () {
  32.169 -        if (defaultActions == null) {
  32.170 -            defaultActions = new SystemAction[] {
  32.171 -                                 SystemAction.get(ToolsAction.class),
  32.172 -                                 SystemAction.get(PropertiesAction.class),
  32.173 -                             };
  32.174 -        }
  32.175 -        return defaultActions;
  32.176 -    }
  32.177 -
  32.178 -    /** Returns instance of this element node factory */
  32.179 -    static DefaultFactory getInstance () {
  32.180 -        if (instance == null)
  32.181 -            instance = new ClassElementNodeFactory();
  32.182 -        return instance;
  32.183 -    }
  32.184 -
  32.185 -
  32.186 -    /** This is an unusuall use of Node and FilterCookie */
  32.187 -
  32.188 -    private class FactoryGetterNode extends AbstractNode implements FilterCookie {
  32.189 -
  32.190 -        FactoryGetterNode( ) {
  32.191 -            super ( Children.LEAF );
  32.192 -        }
  32.193 -
  32.194 -        public synchronized Node.Cookie getCookie( Class clazz ) {
  32.195 -            if ( clazz == FilterFactory.class )
  32.196 -                return this;
  32.197 -            else
  32.198 -                return super.getCookie( clazz );
  32.199 -        }
  32.200 -
  32.201 -        public Class getFilterClass() {
  32.202 -            return null;
  32.203 -        }
  32.204 -
  32.205 -        public void setFilter( Object filter ) {}
  32.206 -
  32.207 -        public Object getFilter( ) {
  32.208 -            if ( tree )
  32.209 -                return ClassDataObject.getBrowserFactory();
  32.210 -            else
  32.211 -                return ClassDataObject.getExplorerFactory();
  32.212 -        }
  32.213 -
  32.214 -    }
  32.215 -
  32.216 -}
    33.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassException.java	Wed Sep 15 11:58:07 2010 +0530
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,73 +0,0 @@
    33.4 -/*
    33.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    33.6 - *
    33.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    33.8 - *
    33.9 - * The contents of this file are subject to the terms of either the GNU
   33.10 - * General Public License Version 2 only ("GPL") or the Common
   33.11 - * Development and Distribution License("CDDL") (collectively, the
   33.12 - * "License"). You may not use this file except in compliance with the
   33.13 - * License. You can obtain a copy of the License at
   33.14 - * http://www.netbeans.org/cddl-gplv2.html
   33.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   33.16 - * specific language governing permissions and limitations under the
   33.17 - * License.  When distributing the software, include this License Header
   33.18 - * Notice in each file and include the License file at
   33.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   33.20 - * particular file as subject to the "Classpath" exception as provided
   33.21 - * by Sun in the GPL Version 2 section of the License file that
   33.22 - * accompanied this code. If applicable, add the following below the
   33.23 - * License Header, with the fields enclosed by brackets [] replaced by
   33.24 - * your own identifying information:
   33.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   33.26 - *
   33.27 - * Contributor(s):
   33.28 - *
   33.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   33.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   33.31 - * Microsystems, Inc. All Rights Reserved.
   33.32 - *
   33.33 - * If you wish your version of this file to be governed by only the CDDL
   33.34 - * or only the GPL Version 2, indicate your decision by adding
   33.35 - * "[Contributor] elects to include this software in this distribution
   33.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   33.37 - * single choice of license, a recipient has the option to distribute
   33.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   33.39 - * to extend the choice of license to its licensees as provided above.
   33.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   33.41 - * Version 2 license, then the option applies only if the new code is
   33.42 - * made subject to such option by the copyright holder.
   33.43 - */
   33.44 -
   33.45 -package org.netbeans.modules.clazz;
   33.46 -
   33.47 -/**
   33.48 -* Exception encapsulating other possible exceptions occurred while working with
   33.49 -* .class file.
   33.50 -*
   33.51 -* @author Jan Jancura
   33.52 -* @version 0.10, Apr 15, 1998
   33.53 -*/
   33.54 -public class ClassException extends java.lang.reflect.InvocationTargetException {
   33.55 -    /** generated Serialized Version UID */
   33.56 -    static final long serialVersionUID = 1159065613681402933L;
   33.57 -
   33.58 -    /**
   33.59 -    * Construct ClassException encapsulating some other.
   33.60 -    *
   33.61 -    * @param throwable Exception to be encapsulated.
   33.62 -    */
   33.63 -    public ClassException (Throwable throwable) {
   33.64 -        super (throwable);
   33.65 -    }
   33.66 -
   33.67 -    /**
   33.68 -    * Construct ClassException encapsulating some other with special comment.
   33.69 -    *
   33.70 -    * @param throwable Exception to be encapsulated.
   33.71 -    * @param comment Comment.
   33.72 -    */
   33.73 -    public ClassException (Throwable throwable, String comment) {
   33.74 -        super (throwable, comment);
   33.75 -    }
   33.76 -}
    34.1 --- a/clazz/src/org/netbeans/modules/clazz/ClassJavaDocImpl.java	Wed Sep 15 11:58:07 2010 +0530
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,166 +0,0 @@
    34.4 -/*
    34.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    34.6 - *
    34.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    34.8 - *
    34.9 - * The contents of this file are subject to the terms of either the GNU
   34.10 - * General Public License Version 2 only ("GPL") or the Common
   34.11 - * Development and Distribution License("CDDL") (collectively, the
   34.12 - * "License"). You may not use this file except in compliance with the
   34.13 - * License. You can obtain a copy of the License at
   34.14 - * http://www.netbeans.org/cddl-gplv2.html
   34.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   34.16 - * specific language governing permissions and limitations under the
   34.17 - * License.  When distributing the software, include this License Header
   34.18 - * Notice in each file and include the License file at
   34.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   34.20 - * particular file as subject to the "Classpath" exception as provided
   34.21 - * by Sun in the GPL Version 2 section of the License file that
   34.22 - * accompanied this code. If applicable, add the following below the
   34.23 - * License Header, with the fields enclosed by brackets [] replaced by
   34.24 - * your own identifying information:
   34.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   34.26 - *
   34.27 - * Contributor(s):
   34.28 - *
   34.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   34.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   34.31 - * Microsystems, Inc. All Rights Reserved.
   34.32 - *
   34.33 - * If you wish your version of this file to be governed by only the CDDL
   34.34 - * or only the GPL Version 2, indicate your decision by adding
   34.35 - * "[Contributor] elects to include this software in this distribution
   34.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   34.37 - * single choice of license, a recipient has the option to distribute
   34.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   34.39 - * to extend the choice of license to its licensees as provided above.
   34.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   34.41 - * Version 2 license, then the option applies only if the new code is
   34.42 - * made subject to such option by the copyright holder.
   34.43 - */
   34.44 -
   34.45 -package org.netbeans.modules.clazz;
   34.46 -
   34.47 -
   34.48 -import org.openide.src.*;
   34.49 -
   34.50 -/** Empty implementation of JavaDoc for sourceless data objects.
   34.51 - *
   34.52 - * @author  Petr Hrebejk
   34.53 - */
   34.54 -class ClassJavaDocImpl extends Object implements JavaDoc {
   34.55 -
   34.56 -    private static final JavaDocTag[] TAGS_EMPTY = new JavaDocTag[] {};
   34.57 -    private static final JavaDocTag.See[] SEE_TAGS_EMPTY = new JavaDocTag.See[] {};
   34.58 -    private static final JavaDocTag.Param[] PARAM_TAGS_EMPTY = new JavaDocTag.Param[] {};
   34.59 -    private static final JavaDocTag.Throws[] THROWS_TAGS_EMPTY = new JavaDocTag.Throws[] {};
   34.60 -    private static final JavaDocTag.SerialField[] SERIALFIELD_TAGS_EMPTY = new JavaDocTag.SerialField[] {};
   34.61 -
   34.62 -    /** Creates new ClassJavaDocImpl */
   34.63 -    public ClassJavaDocImpl() {
   34.64 -    }
   34.65 -
   34.66 -    /** Get the entire text of the comment.
   34.67 -     * @return the whole text
   34.68 -     */
   34.69 -    public String getRawText() {
   34.70 -        return ""; // NOI18N
   34.71 -    }
   34.72 -
   34.73 -    /** Set the raw text of the comment.
   34.74 -     * @param s the whole text to set
   34.75 -     * @exception SourceException if the modification cannot be performed
   34.76 -     */
   34.77 -    public void setRawText(String s) throws SourceException {
   34.78 -        throw new SourceException();
   34.79 -    }
   34.80 -
   34.81 -    /** Get the actual text, cleared of all (non-inline) tags.
   34.82 -     * @return the plain text
   34.83 -     */
   34.84 -    public String getText() {
   34.85 -        return ""; // NOI18N
   34.86 -    }
   34.87 -
   34.88 -    /** Set the actual text.
   34.89 -     * @param s the actual text, without any (non-inline) tags
   34.90 -     * @exception SourceException if the modification cannot be performed
   34.91 -     */
   34.92 -    public void setText(String s) throws SourceException {
   34.93 -        throw new SourceException();
   34.94 -    }
   34.95 -
   34.96 -    /** Clears the javadoc from the source.
   34.97 -     */
   34.98 -    public void clearJavaDoc() throws SourceException {
   34.99 -        throw new SourceException();
  34.100 -    }
  34.101 -
  34.102 -    /** Test if this javadoc is empty.
  34.103 -     * @return true if it is not generated to the source.
  34.104 -     */
  34.105 -    public boolean isEmpty() {
  34.106 -        return true;
  34.107 -    }
  34.108 -
  34.109 -    /** Gets all tags from comment.
  34.110 -     */
  34.111 -    public JavaDocTag[] getTags() {
  34.112 -        return TAGS_EMPTY;
  34.113 -    }
  34.114 -
  34.115 -    /** Gets all tags of given name
  34.116 -     */
  34.117 -    public JavaDocTag[] getTags(String name) {
  34.118 -        return TAGS_EMPTY;
  34.119 -    }
  34.120 -
  34.121 -    /** Adds removes or sets tags used in this comment
  34.122 -     * @param elems the new initializers
  34.123 -     * @param action {@link #ADD}, {@link #REMOVE}, or {@link #SET}
  34.124 -     * @exception SourceException if impossible
  34.125 -     */
  34.126 -    public void changeTags(JavaDocTag[] tags,int action) throws SourceException {
  34.127 -        throw new SourceException();
  34.128 -    }
  34.129 -
  34.130 -    /** Gets all @see tags
  34.131 -     */
  34.132 -    public JavaDocTag.See[] getSeeTags() {
  34.133 -        return SEE_TAGS_EMPTY;
  34.134 -    }
  34.135 -
  34.136 -    /** The JavaDoc of a class.
  34.137 -    * Class javadoc adds no special tags.
  34.138 -    */
  34.139 -    static class Class extends ClassJavaDocImpl implements JavaDoc.Class {
  34.140 -    }
  34.141 -
  34.142 -    /** The JavaDoc of a field.
  34.143 -    * <p>Currently adds special @SerialField tag
  34.144 -    */
  34.145 -    static class Field extends ClassJavaDocImpl implements JavaDoc.Field {
  34.146 -        /** Gets SerialField tags.
  34.147 -        */
  34.148 -        public JavaDocTag.SerialField[] getSerialFieldTags() {
  34.149 -            return SERIALFIELD_TAGS_EMPTY;
  34.150 -        }
  34.151 -    }
  34.152 -
  34.153 -    /** The JavaDoc of a method. Adds two special tags: @para tag and @throws tag.
  34.154 -    */
  34.155 -    static class Method extends ClassJavaDocImpl implements JavaDoc.Method {
  34.156 -
  34.157 -        /** Gets param tags.
  34.158 -        */
  34.159 -        public JavaDocTag.Param[] getParamTags() {
  34.160 -            return PARAM_TAGS_EMPTY;
  34.161 -        }
  34.162 -
  34.163 -        /** Gets throws tags.
  34.164 -        */
  34.165 -        public JavaDocTag.Throws[] getThrowsTags() {
  34.166 -            return THROWS_TAGS_EMPTY;
  34.167 -        }
  34.168 -    }
  34.169 -}
    35.1 --- a/clazz/src/org/netbeans/modules/clazz/CompiledDataNode.java	Wed Sep 15 11:58:07 2010 +0530
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,146 +0,0 @@
    35.4 -/*
    35.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    35.6 - *
    35.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    35.8 - *
    35.9 - * The contents of this file are subject to the terms of either the GNU
   35.10 - * General Public License Version 2 only ("GPL") or the Common
   35.11 - * Development and Distribution License("CDDL") (collectively, the
   35.12 - * "License"). You may not use this file except in compliance with the
   35.13 - * License. You can obtain a copy of the License at
   35.14 - * http://www.netbeans.org/cddl-gplv2.html
   35.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   35.16 - * specific language governing permissions and limitations under the
   35.17 - * License.  When distributing the software, include this License Header
   35.18 - * Notice in each file and include the License file at
   35.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   35.20 - * particular file as subject to the "Classpath" exception as provided
   35.21 - * by Sun in the GPL Version 2 section of the License file that
   35.22 - * accompanied this code. If applicable, add the following below the
   35.23 - * License Header, with the fields enclosed by brackets [] replaced by
   35.24 - * your own identifying information:
   35.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   35.26 - *
   35.27 - * Contributor(s):
   35.28 - *
   35.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   35.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   35.31 - * Microsystems, Inc. All Rights Reserved.
   35.32 - *
   35.33 - * If you wish your version of this file to be governed by only the CDDL
   35.34 - * or only the GPL Version 2, indicate your decision by adding
   35.35 - * "[Contributor] elects to include this software in this distribution
   35.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   35.37 - * single choice of license, a recipient has the option to distribute
   35.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   35.39 - * to extend the choice of license to its licensees as provided above.
   35.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   35.41 - * Version 2 license, then the option applies only if the new code is
   35.42 - * made subject to such option by the copyright holder.
   35.43 - */
   35.44 -package org.netbeans.modules.clazz;
   35.45 -
   35.46 -import org.openide.util.Task;
   35.47 -import org.openide.util.TaskListener;
   35.48 -import java.lang.reflect.InvocationTargetException;
   35.49 -import java.io.*;
   35.50 -import java.util.*;
   35.51 -
   35.52 -import org.openide.cookies.SourceCookie;
   35.53 -import org.openide.nodes.Sheet;
   35.54 -import org.openide.nodes.PropertySupport;
   35.55 -import org.openide.util.NbBundle;
   35.56 -import org.openide.filesystems.FileObject;
   35.57 -import org.netbeans.api.java.classpath.ClassPath;
   35.58 -
   35.59 -/**
   35.60 - * This class overrides a few methods from ClassDataNode presenting the contents
   35.61 - * as a sourceless class. It also adds .class - specific behaviour such as
   35.62 - * execution and parameters property.
   35.63 - *
   35.64 - * @author  sdedic
   35.65 - * @version 
   35.66 - */
   35.67 -public class CompiledDataNode extends ClassDataNode {
   35.68 -    private final static String PROP_IS_EXECUTABLE = "isExecutable"; // NOI18N
   35.69 -    private final static String PROP_FILE_PARAMS = "fileParams"; // NOI18N
   35.70 -    private final static String PROP_EXECUTION = "execution"; // NOI18N
   35.71 -    private final static String EXECUTION_SET_NAME     = "Execution"; // NOI18N
   35.72 -    
   35.73 -    /** Icon bases for icon manager */
   35.74 -    protected final static String CLASS_BASE =
   35.75 -        "org/netbeans/modules/clazz/resources/class"; // NOI18N
   35.76 -    private final static String CLASS_MAIN_BASE =
   35.77 -        "org/netbeans/modules/clazz/resources/classMain"; // NOI18N
   35.78 -    private final static String ERROR_BASE =
   35.79 -        "org/netbeans/modules/clazz/resources/classError"; // NOI18N
   35.80 -    private final static String BEAN_BASE =
   35.81 -        "org/netbeans/modules/clazz/resources/bean"; // NOI18N
   35.82 -    private final static String BEAN_MAIN_BASE =
   35.83 -        "org/netbeans/modules/clazz/resources/beanMain"; // NOI18N
   35.84 -
   35.85 -
   35.86 -    /** Creates new CompiledDataNode */
   35.87 -    public CompiledDataNode(final CompiledDataObject obj) {
   35.88 -        super(obj);
   35.89 -    }
   35.90 -    
   35.91 -    private CompiledDataObject getCompiledDataObject() {
   35.92 -	return (CompiledDataObject)getDataObject();
   35.93 -    }
   35.94 -
   35.95 -    boolean isExecutable() {
   35.96 -        return getCompiledDataObject().isExecutable();
   35.97 -    }
   35.98 -
   35.99 -    protected Sheet createSheet () {
  35.100 -        Sheet s = super.createSheet();
  35.101 -        ResourceBundle bundle = NbBundle.getBundle(ClassDataNode.class);
  35.102 -        Sheet.Set ps = s.get(Sheet.PROPERTIES);
  35.103 -
  35.104 -        ps.put(new PropertySupport.ReadOnly (
  35.105 -                   PROP_IS_EXECUTABLE,
  35.106 -                   Boolean.TYPE,
  35.107 -                   bundle.getString ("PROP_isExecutable"),
  35.108 -                   bundle.getString ("HINT_isExecutable")
  35.109 -               ) {
  35.110 -                   public Object getValue () throws InvocationTargetException {
  35.111 -                       return getCompiledDataObject().isExecutable() ? Boolean.TRUE : Boolean.FALSE;
  35.112 -                   }
  35.113 -               });
  35.114 -        return s;
  35.115 -    }
  35.116 -
  35.117 -    protected String initialIconBase() {
  35.118 -        return CLASS_BASE;
  35.119 -    }
  35.120 -    
  35.121 -    /** Find right icon for this node. */
  35.122 -    protected void resolveIcons () {      
  35.123 -        iconResolved = true;
  35.124 -    }
  35.125 -
  35.126 -    /**
  35.127 -     * Requests construction / retrieval of metadata
  35.128 -     */
  35.129 -    protected void requestResolveIcon() {
  35.130 -        CompiledDataObject dataObj = getCompiledDataObject();
  35.131 -        FileObject fo=dataObj.getPrimaryFile();
  35.132 -        ClassPath libs = ClassPath.getClassPath (fo, ClassPath.COMPILE);
  35.133 -        ClassPath source = ClassPath.getClassPath (fo, ClassPath.SOURCE);
  35.134 -        ClassPath exec = ClassPath.getClassPath (fo, ClassPath.EXECUTE);
  35.135 -        if ((libs == null || !libs.contains(fo)) && (source == null || !source.contains(fo))
  35.136 -            && (exec == null || !exec.contains(fo))) {
  35.137 -            setIconBase(ERROR_BASE);
  35.138 -        } else if (dataObj.isJavaBean ()) {
  35.139 -            if (dataObj.isExecutable ())
  35.140 -                setIconBase(BEAN_MAIN_BASE);
  35.141 -            else
  35.142 -                setIconBase(BEAN_BASE);
  35.143 -        } else if (dataObj.isExecutable ())
  35.144 -            setIconBase(CLASS_MAIN_BASE);
  35.145 -        else
  35.146 -            setIconBase(CLASS_BASE);
  35.147 -        iconResolved = true;
  35.148 -    }
  35.149 -}
    36.1 --- a/clazz/src/org/netbeans/modules/clazz/CompiledDataObject.java	Wed Sep 15 11:58:07 2010 +0530
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,189 +0,0 @@
    36.4 -/*
    36.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    36.6 - *
    36.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    36.8 - *
    36.9 - * The contents of this file are subject to the terms of either the GNU
   36.10 - * General Public License Version 2 only ("GPL") or the Common
   36.11 - * Development and Distribution License("CDDL") (collectively, the
   36.12 - * "License"). You may not use this file except in compliance with the
   36.13 - * License. You can obtain a copy of the License at
   36.14 - * http://www.netbeans.org/cddl-gplv2.html
   36.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   36.16 - * specific language governing permissions and limitations under the
   36.17 - * License.  When distributing the software, include this License Header
   36.18 - * Notice in each file and include the License file at
   36.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   36.20 - * particular file as subject to the "Classpath" exception as provided
   36.21 - * by Sun in the GPL Version 2 section of the License file that
   36.22 - * accompanied this code. If applicable, add the following below the
   36.23 - * License Header, with the fields enclosed by brackets [] replaced by
   36.24 - * your own identifying information:
   36.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   36.26 - *
   36.27 - * Contributor(s):
   36.28 - *
   36.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   36.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   36.31 - * Microsystems, Inc. All Rights Reserved.
   36.32 - *
   36.33 - * If you wish your version of this file to be governed by only the CDDL
   36.34 - * or only the GPL Version 2, indicate your decision by adding
   36.35 - * "[Contributor] elects to include this software in this distribution
   36.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   36.37 - * single choice of license, a recipient has the option to distribute
   36.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   36.39 - * to extend the choice of license to its licensees as provided above.
   36.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   36.41 - * Version 2 license, then the option applies only if the new code is
   36.42 - * made subject to such option by the copyright holder.
   36.43 - */
   36.44 -
   36.45 -package org.netbeans.modules.clazz;
   36.46 -
   36.47 -import java.applet.Applet;
   36.48 -import java.awt.datatransfer.Clipboard;
   36.49 -import java.awt.datatransfer.DataFlavor;
   36.50 -import java.awt.datatransfer.Transferable;
   36.51 -import java.awt.datatransfer.UnsupportedFlavorException;
   36.52 -import java.beans.*;
   36.53 -import java.io.*;
   36.54 -import java.util.StringTokenizer;
   36.55 -import java.util.List;
   36.56 -import java.util.ArrayList;
   36.57 -import java.util.ResourceBundle;
   36.58 -import java.text.MessageFormat;
   36.59 -import java.util.Iterator;
   36.60 -import javax.swing.JApplet;
   36.61 -import javax.swing.JButton;
   36.62 -
   36.63 -import org.openide.*;
   36.64 -import org.openide.util.*;
   36.65 -import org.openide.cookies.*;
   36.66 -import org.openide.filesystems.*;
   36.67 -import org.openide.loaders.*;
   36.68 -import org.openide.explorer.propertysheet.PropertySheet;
   36.69 -import org.openide.nodes.Node;
   36.70 -import org.openide.nodes.AbstractNode;
   36.71 -import org.openide.nodes.CookieSet;
   36.72 -import org.openide.src.SourceElement;
   36.73 -import org.openide.src.nodes.SourceChildren;
   36.74 -import org.openide.src.nodes.SourceElementFilter;
   36.75 -import org.openide.src.nodes.FilterFactory;
   36.76 -import org.openide.src.nodes.ElementNodeFactory;
   36.77 -import org.netbeans.modules.classfile.ClassFile;
   36.78 -
   36.79 -/* TODO:
   36.80 -  - check the showDeclaredOnly flag - it works different for
   36.81 -    variables/constructors than for methods (i.e. for variables/constructors
   36.82 -    the declaredOnly are not subset of notDecalredOnly
   36.83 -*/
   36.84 -
   36.85 -/**
   36.86 -* DataObject which represents .class files.
   36.87 -*
   36.88 -* @author Jan Jancura, Ian Formanek, Petr Hamernik, Dafe Simonek
   36.89 -*/
   36.90 -public class CompiledDataObject extends ClassDataObject {
   36.91 -    /** generated Serialized Version UID */
   36.92 -    static final long serialVersionUID = -7355104884002106137L;
   36.93 -
   36.94 -    /** Name of arguments property. */
   36.95 -    private final static String  PROP_ARGV = "Arguments"; // NOI18N
   36.96 -    /** Name of execution property. */
   36.97 -    private final static String  PROP_EXECUTION = "Execution"; // NOI18N
   36.98 -
   36.99 -    // variables ...................................................................................
  36.100 -
  36.101 -    // constructors ...................................................................................
  36.102 -
  36.103 -    /** Constructs a new ClassDataObject */
  36.104 -    public CompiledDataObject(final FileObject fo,final ClassDataLoader loader) throws org.openide.loaders.DataObjectExistsException {
  36.105 -        super (fo, loader);
  36.106 -        initCookies();
  36.107 -    }
  36.108 -    
  36.109 -    /** Performs cookie initialization. */
  36.110 -    protected void initCookies () {
  36.111 -        super.initCookies();
  36.112 -
  36.113 -        CookieSet cs = getCookieSet();
  36.114 -        // only JavaBeans should offer `Customize Bean' action
  36.115 -        cs.add(InstanceCookie.class, this);
  36.116 -    }
  36.117 -    
  36.118 -    protected Node.Cookie createBeanInstanceSupport() {
  36.119 -	if (isJavaBean()) {
  36.120 -	    return createInstanceSupport();
  36.121 -	} else {
  36.122 -	    return null;
  36.123 -	}
  36.124 -    }
  36.125 -    
  36.126 -    public Node.Cookie createCookie(Class c) {
  36.127 -        if (InstanceCookie.class.isAssignableFrom(c)) {
  36.128 -	    return createBeanInstanceSupport();
  36.129 -	}
  36.130 -        return super.createCookie(c);
  36.131 -    }
  36.132 -
  36.133 -
  36.134 -    /**
  36.135 -    * @return class data node
  36.136 -    */
  36.137 -    protected Node createNodeDelegate () {
  36.138 -        return new CompiledDataNode (this);
  36.139 -    }
  36.140 -
  36.141 -    // Properties implementation .....................................................................
  36.142 -
  36.143 -    boolean isExecutable () {
  36.144 -        return createInstanceSupport().isExecutable ();
  36.145 -    }
  36.146 -
  36.147 -    // other methods ..............................................................................
  36.148 -
  36.149 -    /** Check if in specific folder exists .ser fileobject with the same name.
  36.150 -    * If it exists user is asked for confirmation to rewrite, rename or
  36.151 -    * cancel operation. Throws UserCancelException if user pressed cancel
  36.152 -    * button.
  36.153 -    * @param f destination folder
  36.154 -    * @return new Name of file in destination
  36.155 -    */
  36.156 -    protected String existInFolder(DataFolder f) throws UserCancelException {
  36.157 -        FileObject fo = getPrimaryFile();
  36.158 -        String name = fo.getName();
  36.159 -        String ext = "ser"; // NOI18N
  36.160 -        String destName = fo.getName();
  36.161 -        if (f.getPrimaryFile().getFileObject(name, ext) != null) {
  36.162 -            // file with the same name exists - ask user what to do
  36.163 -            ResourceBundle bundle = NbBundle.getBundle(ClassDataObject.class);
  36.164 -            String rewriteStr = bundle.getString("CTL_Rewrite");
  36.165 -            String renameStr = bundle.getString("CTL_Rename");
  36.166 -            String cancelStr = bundle.getString("CTL_Cancel");
  36.167 -            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
  36.168 -                                      new MessageFormat(bundle.getString("MSG_SerExists")).
  36.169 -                                      format(new Object[] { name, f.getName() }));
  36.170 -            nd.setOptions(new Object[] { rewriteStr, renameStr, cancelStr });
  36.171 -            String retStr = (String)DialogDisplayer.getDefault().notify(nd);
  36.172 -            if (cancelStr.equals(retStr)) // user cancelled the dialog
  36.173 -                throw new UserCancelException();
  36.174 -            if (renameStr.equals(retStr))
  36.175 -                destName = FileUtil.findFreeFileName (
  36.176 -                               f.getPrimaryFile(), destName, ext);
  36.177 -            if (rewriteStr.equals(retStr)) {
  36.178 -                try {
  36.179 -                    FileObject dest = f.getPrimaryFile().getFileObject(name, ext);
  36.180 -                    FileLock lock = dest.lock();
  36.181 -                    dest.delete(lock);
  36.182 -                    lock.releaseLock();
  36.183 -                }
  36.184 -                catch (IOException e) {
  36.185 -                    return null;
  36.186 -                }
  36.187 -            }
  36.188 -        }
  36.189 -        return destName;
  36.190 -    }
  36.191 -}
  36.192 -
    37.1 --- a/clazz/src/org/netbeans/modules/clazz/ConstructorElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,181 +0,0 @@
    37.4 -/*
    37.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    37.6 - *
    37.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    37.8 - *
    37.9 - * The contents of this file are subject to the terms of either the GNU
   37.10 - * General Public License Version 2 only ("GPL") or the Common
   37.11 - * Development and Distribution License("CDDL") (collectively, the
   37.12 - * "License"). You may not use this file except in compliance with the
   37.13 - * License. You can obtain a copy of the License at
   37.14 - * http://www.netbeans.org/cddl-gplv2.html
   37.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   37.16 - * specific language governing permissions and limitations under the
   37.17 - * License.  When distributing the software, include this License Header
   37.18 - * Notice in each file and include the License file at
   37.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   37.20 - * particular file as subject to the "Classpath" exception as provided
   37.21 - * by Sun in the GPL Version 2 section of the License file that
   37.22 - * accompanied this code. If applicable, add the following below the
   37.23 - * License Header, with the fields enclosed by brackets [] replaced by
   37.24 - * your own identifying information:
   37.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   37.26 - *
   37.27 - * Contributor(s):
   37.28 - *
   37.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   37.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   37.31 - * Microsystems, Inc. All Rights Reserved.
   37.32 - *
   37.33 - * If you wish your version of this file to be governed by only the CDDL
   37.34 - * or only the GPL Version 2, indicate your decision by adding
   37.35 - * "[Contributor] elects to include this software in this distribution
   37.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   37.37 - * single choice of license, a recipient has the option to distribute
   37.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   37.39 - * to extend the choice of license to its licensees as provided above.
   37.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   37.41 - * Version 2 license, then the option applies only if the new code is
   37.42 - * made subject to such option by the copyright holder.
   37.43 - */
   37.44 -
   37.45 -package org.netbeans.modules.clazz;
   37.46 -
   37.47 -import org.netbeans.api.mdr.MDRepository;
   37.48 -import org.netbeans.jmi.javamodel.CallableFeature;
   37.49 -import org.openide.src.*;
   37.50 -import org.netbeans.jmi.javamodel.JavaClass;
   37.51 -import org.netbeans.jmi.javamodel.Parameter;
   37.52 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   37.53 -
   37.54 -/** Implementation of the constructor element for class objects.
   37.55 -* It's simple bridge to the java reflection Constructor, delegates
   37.56 -* all tasks to it.
   37.57 -*
   37.58 -* @author Dafe Simonek
   37.59 -*/
   37.60 -class ConstructorElementImpl extends MemberElementImpl
   37.61 -    implements ConstructorElement.Impl {
   37.62 -
   37.63 -    /** The array of parameters of this constructor (or method)*/
   37.64 -    private MethodParameter[] parameters;
   37.65 -    /** The array of exceptions which can be thrown */
   37.66 -    private Identifier[] exceptions;
   37.67 -    /** One JavaDoc empty implementation for all objects */
   37.68 -    private static final ClassJavaDocImpl.Method METHOD_JAVADOC_IMPL = new ClassJavaDocImpl.Method();
   37.69 -    
   37.70 -    static final long serialVersionUID =5714347955571851240L;
   37.71 -    
   37.72 -    ConstructorElementImpl (final CallableFeature data ) {
   37.73 -        super(data);
   37.74 -    }
   37.75 -
   37.76 -    CallableFeature getBehavioral() {
   37.77 -        return (CallableFeature)data;
   37.78 -    }
   37.79 -    
   37.80 -    public void initializeData() {
   37.81 -        super.initializeData();
   37.82 -        getExceptions();
   37.83 -        getParameters();
   37.84 -    }
   37.85 -    
   37.86 -    /** @return the array specifying the parameters
   37.87 -    */
   37.88 -    public MethodParameter[] getParameters () {
   37.89 -        if (parameters == null) {
   37.90 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
   37.91 -            repo.beginTrans(false);
   37.92 -            try {
   37.93 -                if (!isValid()) {
   37.94 -                    parameters = new MethodParameter[0];
   37.95 -                } else {
   37.96 -                    Parameter[] pars = (Parameter[])getBehavioral().getParameters().toArray(new Parameter[0]);
   37.97 -                    MethodParameter[] mp = new MethodParameter[pars.length];
   37.98 -                    for (int i = 0; i < pars.length; i++) {
   37.99 -                        Parameter p=pars[i];
  37.100 -                        mp[i] = new MethodParameter(p.getName(), Util.createType(p.getType()), p.isFinal());
  37.101 -                    }
  37.102 -                    parameters = mp;
  37.103 -                }
  37.104 -            } finally {
  37.105 -                repo.endTrans();
  37.106 -            }
  37.107 -        }
  37.108 -        return parameters;
  37.109 -    }
  37.110 -    
  37.111 -    protected Identifier createName(Object data) {
  37.112 -	if (this instanceof MethodElementImpl) {
  37.113 -	    return super.createName(data);
  37.114 -	}
  37.115 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  37.116 -        repo.beginTrans(false);
  37.117 -        try {
  37.118 -            if (!isValid()) {
  37.119 -                return Identifier.create(""); // NOI18N
  37.120 -            }
  37.121 -            return Identifier.create(((JavaClass)(getBehavioral().getDeclaringClass())).getSimpleName());
  37.122 -        } finally {
  37.123 -            repo.endTrans();
  37.124 -        }
  37.125 -    }
  37.126 -
  37.127 -    /** Unsupported, throws SourceException
  37.128 -    */
  37.129 -    public void setParameters (MethodParameter[] params) throws SourceException {
  37.130 -        throwReadOnlyException();
  37.131 -    }
  37.132 -
  37.133 -    /** @return the array of the exceptions throwed by the method.
  37.134 -    */
  37.135 -    public Identifier[] getExceptions () {
  37.136 -        if (exceptions == null) {
  37.137 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  37.138 -            repo.beginTrans(false);
  37.139 -            try {
  37.140 -                if (!isValid()) {
  37.141 -                    return new Identifier[0];
  37.142 -                }
  37.143 -                JavaClass[] reflEx = (JavaClass[])getBehavioral().getExceptions().toArray(new JavaClass[0]);
  37.144 -                exceptions = new Identifier[reflEx.length];
  37.145 -                // build our exception types
  37.146 -                for (int i = 0; i < reflEx.length; i++) {
  37.147 -                    exceptions[i] = Identifier.create(Util.createClassName(reflEx[i].getName()));
  37.148 -                }
  37.149 -            } finally {
  37.150 -                repo.endTrans();
  37.151 -            }
  37.152 -        }
  37.153 -        return exceptions;
  37.154 -    }
  37.155 -
  37.156 -    /** Unsupported, throws SourceException
  37.157 -    */
  37.158 -    public void setExceptions (Identifier[] exceptions) throws SourceException {
  37.159 -        throwReadOnlyException();
  37.160 -    }
  37.161 -
  37.162 -    /** Unsupported, throws SourceException
  37.163 -    */
  37.164 -    public void setBody (String s) throws SourceException {
  37.165 -        throwReadOnlyException();
  37.166 -    }
  37.167 -
  37.168 -    /** Unsupported, always return empty string.
  37.169 -    */
  37.170 -    public String getBody () {
  37.171 -        return ""; // NOI18N
  37.172 -    }
  37.173 -
  37.174 -    /** Empty implementation
  37.175 -    * @return Empty JavaDoc implementation.
  37.176 -    */
  37.177 -    public JavaDoc.Method getJavaDoc () {
  37.178 -        return METHOD_JAVADOC_IMPL;
  37.179 -    }
  37.180 -
  37.181 -    public Object readResolve() {
  37.182 -        return new ConstructorElement(this, null);
  37.183 -    }
  37.184 -}
    38.1 --- a/clazz/src/org/netbeans/modules/clazz/ElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,131 +0,0 @@
    38.4 -/*
    38.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    38.6 - *
    38.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    38.8 - *
    38.9 - * The contents of this file are subject to the terms of either the GNU
   38.10 - * General Public License Version 2 only ("GPL") or the Common
   38.11 - * Development and Distribution License("CDDL") (collectively, the
   38.12 - * "License"). You may not use this file except in compliance with the
   38.13 - * License. You can obtain a copy of the License at
   38.14 - * http://www.netbeans.org/cddl-gplv2.html
   38.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   38.16 - * specific language governing permissions and limitations under the
   38.17 - * License.  When distributing the software, include this License Header
   38.18 - * Notice in each file and include the License file at
   38.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   38.20 - * particular file as subject to the "Classpath" exception as provided
   38.21 - * by Sun in the GPL Version 2 section of the License file that
   38.22 - * accompanied this code. If applicable, add the following below the
   38.23 - * License Header, with the fields enclosed by brackets [] replaced by
   38.24 - * your own identifying information:
   38.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   38.26 - *
   38.27 - * Contributor(s):
   38.28 - *
   38.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   38.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   38.31 - * Microsystems, Inc. All Rights Reserved.
   38.32 - *
   38.33 - * If you wish your version of this file to be governed by only the CDDL
   38.34 - * or only the GPL Version 2, indicate your decision by adding
   38.35 - * "[Contributor] elects to include this software in this distribution
   38.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   38.37 - * single choice of license, a recipient has the option to distribute
   38.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   38.39 - * to extend the choice of license to its licensees as provided above.
   38.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   38.41 - * Version 2 license, then the option applies only if the new code is
   38.42 - * made subject to such option by the copyright holder.
   38.43 - */
   38.44 -
   38.45 -package org.netbeans.modules.clazz;
   38.46 -
   38.47 -import java.io.ObjectInput;
   38.48 -import java.io.ObjectOutput;
   38.49 -import java.io.IOException;
   38.50 -import java.io.Externalizable;
   38.51 -import java.beans.PropertyChangeSupport;
   38.52 -import java.beans.PropertyChangeListener;
   38.53 -
   38.54 -import org.openide.ErrorManager;
   38.55 -import org.openide.nodes.CookieSet;
   38.56 -import org.openide.nodes.Node;
   38.57 -import org.openide.src.Element;
   38.58 -import org.openide.src.SourceException;
   38.59 -import org.openide.util.NbBundle;
   38.60 -
   38.61 -/** Implementation of Element for classes.
   38.62 -*
   38.63 -* @author Dafe Simonek
   38.64 -*/
   38.65 -public abstract class ElementImpl extends Object implements Element.Impl, Externalizable {
   38.66 -
   38.67 -    /** The element we are asociated to. We provide an implementation
   38.68 -    * to that element */
   38.69 -    protected Element element;
   38.70 -    
   38.71 -    private PropertyChangeSupport support;
   38.72 -    
   38.73 -    static final long serialVersionUID =6363778502021582852L;
   38.74 -
   38.75 -    /** Default constructor
   38.76 -    */
   38.77 -    public ElementImpl () {
   38.78 -    }
   38.79 -
   38.80 -    /** Attaches this implementation to the element.
   38.81 -    *
   38.82 -    * @param element the element we are attached to
   38.83 -    */
   38.84 -    public void attachedToElement (Element element) {
   38.85 -        this.element = element;
   38.86 -    }
   38.87 -
   38.88 -    /** We don't support property changes - does nothing */
   38.89 -    public void addPropertyChangeListener (PropertyChangeListener l) {
   38.90 -        if (support == null) 
   38.91 -            synchronized (this) {
   38.92 -                if (support == null)
   38.93 -                    support = new PropertyChangeSupport(this);
   38.94 -            }
   38.95 -        support.addPropertyChangeListener(l);
   38.96 -    }
   38.97 -
   38.98 -    /** We don't support property changes - does nothing */
   38.99 -    public void removePropertyChangeListener (PropertyChangeListener l) {
  38.100 -        if (support != null)
  38.101 -            support.addPropertyChangeListener(l);
  38.102 -    }
  38.103 -    
  38.104 -    protected void firePropertyChange(String propName, Object old, Object n) {
  38.105 -        if (support != null)
  38.106 -            support.firePropertyChange(propName, old, n);
  38.107 -    }
  38.108 -
  38.109 -    /** No cookie supported.
  38.110 -    * @return null
  38.111 -    */
  38.112 -    public Node.Cookie getCookie (Class type) {
  38.113 -        return null;
  38.114 -    }
  38.115 -    
  38.116 -    /** Mark the current element in the context of this element.
  38.117 -    * The current element means the position for inserting new elements.
  38.118 -    * @param beforeAfter <CODE>true</CODE> means that new element is inserted before
  38.119 -    *        the specified element, <CODE>false</CODE> means after.
  38.120 -    */
  38.121 -    public void markCurrent(boolean beforeAfter) {
  38.122 -        // nothing to do - class is not editable
  38.123 -    }
  38.124 -
  38.125 -    
  38.126 -    protected final void throwReadOnlyException() throws SourceException {
  38.127 -        throw (SourceException)ErrorManager.getDefault().annotate(
  38.128 -            new SourceException("Read-only element"), // NOI18N
  38.129 -            ErrorManager.USER,
  38.130 -            null, NbBundle.getMessage(ElementImpl.class, "MSG_CantModify"),
  38.131 -            null, null
  38.132 -        );
  38.133 -    }        
  38.134 -}
    39.1 --- a/clazz/src/org/netbeans/modules/clazz/FieldElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,131 +0,0 @@
    39.4 -/*
    39.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    39.6 - *
    39.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    39.8 - *
    39.9 - * The contents of this file are subject to the terms of either the GNU
   39.10 - * General Public License Version 2 only ("GPL") or the Common
   39.11 - * Development and Distribution License("CDDL") (collectively, the
   39.12 - * "License"). You may not use this file except in compliance with the
   39.13 - * License. You can obtain a copy of the License at
   39.14 - * http://www.netbeans.org/cddl-gplv2.html
   39.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   39.16 - * specific language governing permissions and limitations under the
   39.17 - * License.  When distributing the software, include this License Header
   39.18 - * Notice in each file and include the License file at
   39.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   39.20 - * particular file as subject to the "Classpath" exception as provided
   39.21 - * by Sun in the GPL Version 2 section of the License file that
   39.22 - * accompanied this code. If applicable, add the following below the
   39.23 - * License Header, with the fields enclosed by brackets [] replaced by
   39.24 - * your own identifying information:
   39.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   39.26 - *
   39.27 - * Contributor(s):
   39.28 - *
   39.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   39.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   39.31 - * Microsystems, Inc. All Rights Reserved.
   39.32 - *
   39.33 - * If you wish your version of this file to be governed by only the CDDL
   39.34 - * or only the GPL Version 2, indicate your decision by adding
   39.35 - * "[Contributor] elects to include this software in this distribution
   39.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   39.37 - * single choice of license, a recipient has the option to distribute
   39.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   39.39 - * to extend the choice of license to its licensees as provided above.
   39.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   39.41 - * Version 2 license, then the option applies only if the new code is
   39.42 - * made subject to such option by the copyright holder.
   39.43 - */
   39.44 -
   39.45 -package org.netbeans.modules.clazz;
   39.46 -
   39.47 -import org.netbeans.api.mdr.MDRepository;
   39.48 -import org.netbeans.jmi.javamodel.Field;
   39.49 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   39.50 -import org.openide.src.*;
   39.51 -
   39.52 -/** The implementation of the field element for class objects.
   39.53 -*
   39.54 -* @author Dafe Simonek
   39.55 -*/
   39.56 -final class FieldElementImpl extends MemberElementImpl
   39.57 -    implements FieldElement.Impl {
   39.58 -    /** Cached type of this field */
   39.59 -    private Type type;
   39.60 -
   39.61 -    /** One JavaDoc empty implementation for all objects */
   39.62 -    private static final ClassJavaDocImpl.Field FIELD_JAVADOC_IMPL = new ClassJavaDocImpl.Field();
   39.63 -
   39.64 -    static final long serialVersionUID =-4800326520399939102L;
   39.65 -    /** Default constructor. Asociates with given
   39.66 -    * reflection Field data.
   39.67 -    */
   39.68 -    public FieldElementImpl (final org.netbeans.modules.classfile.Field data) {
   39.69 -        super(data);
   39.70 -    }
   39.71 -    
   39.72 -    FieldElementImpl(final Field data) {
   39.73 -        super(data);
   39.74 -    }
   39.75 -    
   39.76 -    private Field getField() {
   39.77 -        return (Field)data;
   39.78 -    }
   39.79 -
   39.80 -    public void initializeData() {
   39.81 -        super.initializeData();
   39.82 -        getType();
   39.83 -    }
   39.84 -    
   39.85 -    /** Type of the variable.
   39.86 -    * @return the type
   39.87 -    */
   39.88 -    public Type getType () {
   39.89 -        if (type == null) {
   39.90 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
   39.91 -            repo.beginTrans(false);
   39.92 -            try {
   39.93 -                if (!isValid()) {
   39.94 -                    type = org.openide.src.Type.VOID;
   39.95 -                } else {
   39.96 -                    type = Util.createType(getField().getType());
   39.97 -                }
   39.98 -                //XXX
   39.99 -                //type = Type.createFromClass(((org.netbeans.modules.classfile.Field)data).getType());
  39.100 -            } finally {
  39.101 -                repo.endTrans();
  39.102 -            }
  39.103 -        }
  39.104 -        return type;
  39.105 -    }
  39.106 -
  39.107 -    /** Not supported. Throws SourceException.
  39.108 -    */
  39.109 -    public void setType (Type type) throws SourceException {
  39.110 -        throwReadOnlyException();
  39.111 -    }
  39.112 -
  39.113 -    /** PENDING - don't know how to implement...
  39.114 -    */
  39.115 -    public String getInitValue () {
  39.116 -        return ""; // NOI18N
  39.117 -    }
  39.118 -
  39.119 -    /** Not supported. Throws SourceException.
  39.120 -    */
  39.121 -    public void setInitValue (String value) throws SourceException {
  39.122 -        throwReadOnlyException();
  39.123 -    }
  39.124 -
  39.125 -    /** @return java doc for the field
  39.126 -    */
  39.127 -    public JavaDoc.Field getJavaDoc () {
  39.128 -        return FIELD_JAVADOC_IMPL;
  39.129 -    }
  39.130 -
  39.131 -    public Object readResolve() {
  39.132 -        return new FieldElement(this, null);
  39.133 -    }
  39.134 -}
    40.1 --- a/clazz/src/org/netbeans/modules/clazz/LazySourceChildren.java	Wed Sep 15 11:58:07 2010 +0530
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,104 +0,0 @@
    40.4 -/*
    40.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    40.6 - *
    40.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    40.8 - *
    40.9 - * The contents of this file are subject to the terms of either the GNU
   40.10 - * General Public License Version 2 only ("GPL") or the Common
   40.11 - * Development and Distribution License("CDDL") (collectively, the
   40.12 - * "License"). You may not use this file except in compliance with the
   40.13 - * License. You can obtain a copy of the License at
   40.14 - * http://www.netbeans.org/cddl-gplv2.html
   40.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   40.16 - * specific language governing permissions and limitations under the
   40.17 - * License.  When distributing the software, include this License Header
   40.18 - * Notice in each file and include the License file at
   40.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   40.20 - * particular file as subject to the "Classpath" exception as provided
   40.21 - * by Sun in the GPL Version 2 section of the License file that
   40.22 - * accompanied this code. If applicable, add the following below the
   40.23 - * License Header, with the fields enclosed by brackets [] replaced by
   40.24 - * your own identifying information:
   40.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   40.26 - *
   40.27 - * Contributor(s):
   40.28 - *
   40.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   40.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   40.31 - * Microsystems, Inc. All Rights Reserved.
   40.32 - *
   40.33 - * If you wish your version of this file to be governed by only the CDDL
   40.34 - * or only the GPL Version 2, indicate your decision by adding
   40.35 - * "[Contributor] elects to include this software in this distribution
   40.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   40.37 - * single choice of license, a recipient has the option to distribute
   40.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   40.39 - * to extend the choice of license to its licensees as provided above.
   40.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   40.41 - * Version 2 license, then the option applies only if the new code is
   40.42 - * made subject to such option by the copyright holder.
   40.43 - */
   40.44 -
   40.45 -package org.netbeans.modules.clazz;
   40.46 -
   40.47 -import org.openide.cookies.SourceCookie;
   40.48 -import org.openide.loaders.DataObject;
   40.49 -import org.openide.nodes.Node;
   40.50 -import org.openide.src.SourceElement;
   40.51 -import org.openide.src.nodes.ElementNodeFactory;
   40.52 -import org.openide.src.nodes.SourceChildren;
   40.53 -
   40.54 -/**
   40.55 - * LazySourceChildren is used as a Children of {@link ClassDataNode}
   40.56 - * to defer creation of {@link SourceElement} and reading of class file.
   40.57 - * @author Tomas Zezula
   40.58 - */
   40.59 -final class LazySourceChildren extends SourceChildren {
   40.60 -
   40.61 -    private DataObject data;
   40.62 -
   40.63 -    /** Creates a new instance of LazySourceChildren 
   40.64 -     *  @param data the source of the {@link SourceCookie} to take the
   40.65 -     *  @param ElementNodeFactory factory
   40.66 -     *  {@link SourceElement} from
   40.67 -     */
   40.68 -    public LazySourceChildren (DataObject data, ElementNodeFactory factory) {
   40.69 -        super (factory);
   40.70 -        assert data != null;
   40.71 -        this.data = data;
   40.72 -    }
   40.73 -
   40.74 -    public SourceElement getElement() {        
   40.75 -        SourceElement retValue = super.getElement();
   40.76 -        if (retValue == null) {
   40.77 -            retValue = initElement ();
   40.78 -        }
   40.79 -        return retValue;
   40.80 -    }
   40.81 -    
   40.82 -    
   40.83 -    protected void addNotify() {
   40.84 -        this.getElement();  //Lazy Initialize the SourceElement
   40.85 -        super.addNotify();
   40.86 -    }
   40.87 -    
   40.88 -    public Node[] getNodes(boolean initialize) {
   40.89 -        this.getElement();  //Lazy Initialize the SourceElement
   40.90 -        return super.getNodes (initialize);
   40.91 -    }
   40.92 -    
   40.93 -    public Node findChild(String name) {
   40.94 -        this.getElement();  //Lazy Initialize the SourceElement
   40.95 -        return super.findChild(name);
   40.96 -    }
   40.97 -    
   40.98 -    private SourceElement initElement () {
   40.99 -        SourceCookie sc = (SourceCookie) this.data.getCookie(SourceCookie.class);
  40.100 -        SourceElement srcElement = sc.getSource();
  40.101 -        this.setElement(srcElement);
  40.102 -        return srcElement;
  40.103 -    }    
  40.104 -
  40.105 -    
  40.106 -    
  40.107 -}
    41.1 --- a/clazz/src/org/netbeans/modules/clazz/MemberElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,224 +0,0 @@
    41.4 -/*
    41.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    41.6 - *
    41.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    41.8 - *
    41.9 - * The contents of this file are subject to the terms of either the GNU
   41.10 - * General Public License Version 2 only ("GPL") or the Common
   41.11 - * Development and Distribution License("CDDL") (collectively, the
   41.12 - * "License"). You may not use this file except in compliance with the
   41.13 - * License. You can obtain a copy of the License at
   41.14 - * http://www.netbeans.org/cddl-gplv2.html
   41.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   41.16 - * specific language governing permissions and limitations under the
   41.17 - * License.  When distributing the software, include this License Header
   41.18 - * Notice in each file and include the License file at
   41.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   41.20 - * particular file as subject to the "Classpath" exception as provided
   41.21 - * by Sun in the GPL Version 2 section of the License file that
   41.22 - * accompanied this code. If applicable, add the following below the
   41.23 - * License Header, with the fields enclosed by brackets [] replaced by
   41.24 - * your own identifying information:
   41.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   41.26 - *
   41.27 - * Contributor(s):
   41.28 - *
   41.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   41.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   41.31 - * Microsystems, Inc. All Rights Reserved.
   41.32 - *
   41.33 - * If you wish your version of this file to be governed by only the CDDL
   41.34 - * or only the GPL Version 2, indicate your decision by adding
   41.35 - * "[Contributor] elects to include this software in this distribution
   41.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   41.37 - * single choice of license, a recipient has the option to distribute
   41.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   41.39 - * to extend the choice of license to its licensees as provided above.
   41.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   41.41 - * Version 2 license, then the option applies only if the new code is
   41.42 - * made subject to such option by the copyright holder.
   41.43 - */
   41.44 -
   41.45 -package org.netbeans.modules.clazz;
   41.46 -
   41.47 -import java.io.ObjectInput;
   41.48 -import java.io.ObjectOutput;
   41.49 -import java.io.IOException;
   41.50 -
   41.51 -import org.openide.src.MemberElement;
   41.52 -import org.openide.src.SourceException;
   41.53 -import org.openide.src.Identifier;
   41.54 -import org.openide.src.ClassElement;
   41.55 -import org.openide.src.SourceElement;
   41.56 -import org.openide.nodes.Node;
   41.57 -import org.openide.util.Task;
   41.58 -
   41.59 -import javax.jmi.reflect.RefObject;
   41.60 -import org.netbeans.api.mdr.MDRepository;
   41.61 -import org.netbeans.jmi.javamodel.Feature;
   41.62 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   41.63 -import org.openide.util.RequestProcessor;
   41.64 -
   41.65 -/** Implementation of the MemberElement.Impl for the class objects.
   41.66 -*
   41.67 -* @author Dafe Simonek
   41.68 -*/
   41.69 -public abstract class MemberElementImpl extends ElementImpl implements MemberElement.Impl, Node.Cookie {
   41.70 -    /** Asociated java reflection data */
   41.71 -    protected Object data;
   41.72 -    /** Cached name identifier */
   41.73 -    private transient Identifier name;
   41.74 -    
   41.75 -    private int modifiers = -1;
   41.76 -
   41.77 -    static final long serialVersionUID =-6841890195552268874L;
   41.78 -    /** Constructor, asociates this impl with java reflection
   41.79 -    * Member element, which acts as data source.
   41.80 -    */
   41.81 -    public MemberElementImpl (final Object data) {
   41.82 -        super();
   41.83 -        this.data = data;
   41.84 -    }
   41.85 -    
   41.86 -    Feature getClassFeature() {
   41.87 -        return (Feature)data;
   41.88 -    }
   41.89 -
   41.90 -    public void initializeData() {
   41.91 -        getName();
   41.92 -        getModifiers();
   41.93 -    }
   41.94 -    
   41.95 -    /** @return Modifiers for this element.
   41.96 -    */
   41.97 -    public int getModifiers () {
   41.98 -        if (modifiers == -1) {
   41.99 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  41.100 -            repo.beginTrans(false);
  41.101 -            try {
  41.102 -                if (!isValid()) {
  41.103 -                    return 0;
  41.104 -                }
  41.105 -                Feature f = getClassFeature();
  41.106 -                modifiers = f.getModifiers();
  41.107 -            } finally {
  41.108 -                repo.endTrans();
  41.109 -            }
  41.110 -        }
  41.111 -        return modifiers;
  41.112 -    }
  41.113 -
  41.114 -    /** Unsupported. Throws SourceException
  41.115 -    */
  41.116 -    public void setModifiers (int mod) throws SourceException {
  41.117 -        throwReadOnlyException();
  41.118 -    }
  41.119 -
  41.120 -    /** Getter for name of the field.
  41.121 -    * @return the name
  41.122 -    */
  41.123 -    public Identifier getName () {
  41.124 -        if (name == null) {
  41.125 -	    name = createName(this.data);
  41.126 -	}
  41.127 -        return name;
  41.128 -    }
  41.129 -    
  41.130 -    protected Identifier createName(Object data) {
  41.131 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  41.132 -        repo.beginTrans(false);
  41.133 -        try {
  41.134 -            if (!isValid()) {
  41.135 -                return Identifier.create(""); // NOI18N
  41.136 -            }
  41.137 -            String name = getClassFeature().getName();
  41.138 -            return Identifier.create(name);
  41.139 -        } finally {
  41.140 -            repo.endTrans();
  41.141 -        }
  41.142 -    }
  41.143 -
  41.144 -    /** Unsupported. Throws SourceException.
  41.145 -    */
  41.146 -    public void setName (Identifier name) throws SourceException {
  41.147 -        throwReadOnlyException();
  41.148 -    }
  41.149 -
  41.150 -    /** Delegates to source element implementation class,
  41.151 -    * if it's possible.
  41.152 -    */
  41.153 -    public Node.Cookie getCookie (Class type) {
  41.154 -        if (type == org.openide.src.Element.Impl.class)
  41.155 -            return this;
  41.156 -        ClassElement ce = ((MemberElement)element).getDeclaringClass();
  41.157 -        if ((ce == null) && (element instanceof ClassElement)) {
  41.158 -            ce = (ClassElement)element;
  41.159 -        }
  41.160 -        if (ce != null) {
  41.161 -            SourceElement se = ce.getSource();
  41.162 -            if (se != null) {
  41.163 -                return se.getCookie(type);
  41.164 -            }
  41.165 -        }
  41.166 -        return null;
  41.167 -    }
  41.168 -
  41.169 -    org.netbeans.jmi.javamodel.Element getJMIElement() {
  41.170 -        return data instanceof org.netbeans.jmi.javamodel.Element ?
  41.171 -            (org.netbeans.jmi.javamodel.Element) data : null;
  41.172 -    }
  41.173 -    
  41.174 -    public void writeExternal (ObjectOutput oi) throws IOException {
  41.175 -        oi.writeObject(data);
  41.176 -    }
  41.177 -
  41.178 -    public void readExternal (ObjectInput oi) throws IOException, ClassNotFoundException {
  41.179 -        data = oi.readObject();
  41.180 -    }
  41.181 -
  41.182 -    
  41.183 -    public RefObject getRefObject() {
  41.184 -        if (data instanceof RefObject)
  41.185 -            return (RefObject)data;
  41.186 -        return null;
  41.187 -    }
  41.188 -    
  41.189 -    public boolean isValid() {
  41.190 -        if (data instanceof org.netbeans.jmi.javamodel.Element) {
  41.191 -            boolean valid = ((org.netbeans.jmi.javamodel.Element) data).isValid();
  41.192 -            /*
  41.193 -            if (!valid) {
  41.194 -                final SourceElementImpl source = (SourceElementImpl)getCookie(SourceElement.Impl.class);
  41.195 -                if (source != null) {
  41.196 -                    RequestProcessor.getDefault().post(new Runnable() {
  41.197 -                        public void run() {
  41.198 -                            source.refreshData();
  41.199 -                        }
  41.200 -                    });
  41.201 -                }
  41.202 -            }
  41.203 -             */
  41.204 -            return valid;
  41.205 -        }
  41.206 -        return false;
  41.207 -    }
  41.208 -    
  41.209 -    public ElementImpl getDeclaringElement() {
  41.210 -        if ((element == null) || !(element instanceof MemberElement))
  41.211 -            return null;
  41.212 -        ClassElement declClass = ((MemberElement)element).getDeclaringClass();
  41.213 -        if (declClass != null)
  41.214 -            return (ElementImpl) declClass.getCookie(org.openide.src.Element.Impl.class);
  41.215 -        if (element instanceof ClassElement) {
  41.216 -            SourceElement source = ((ClassElement) element).getSource();
  41.217 -            if (source != null)
  41.218 -                return (ElementImpl) source.getCookie(org.openide.src.Element.Impl.class);
  41.219 -        }
  41.220 -        return null;
  41.221 -    }
  41.222 -    
  41.223 -    public Task refresh() {
  41.224 -        return Task.EMPTY;
  41.225 -    }
  41.226 -    
  41.227 -}
    42.1 --- a/clazz/src/org/netbeans/modules/clazz/MethodElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,101 +0,0 @@
    42.4 -/*
    42.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    42.6 - *
    42.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    42.8 - *
    42.9 - * The contents of this file are subject to the terms of either the GNU
   42.10 - * General Public License Version 2 only ("GPL") or the Common
   42.11 - * Development and Distribution License("CDDL") (collectively, the
   42.12 - * "License"). You may not use this file except in compliance with the
   42.13 - * License. You can obtain a copy of the License at
   42.14 - * http://www.netbeans.org/cddl-gplv2.html
   42.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   42.16 - * specific language governing permissions and limitations under the
   42.17 - * License.  When distributing the software, include this License Header
   42.18 - * Notice in each file and include the License file at
   42.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   42.20 - * particular file as subject to the "Classpath" exception as provided
   42.21 - * by Sun in the GPL Version 2 section of the License file that
   42.22 - * accompanied this code. If applicable, add the following below the
   42.23 - * License Header, with the fields enclosed by brackets [] replaced by
   42.24 - * your own identifying information:
   42.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   42.26 - *
   42.27 - * Contributor(s):
   42.28 - *
   42.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   42.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   42.31 - * Microsystems, Inc. All Rights Reserved.
   42.32 - *
   42.33 - * If you wish your version of this file to be governed by only the CDDL
   42.34 - * or only the GPL Version 2, indicate your decision by adding
   42.35 - * "[Contributor] elects to include this software in this distribution
   42.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   42.37 - * single choice of license, a recipient has the option to distribute
   42.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   42.39 - * to extend the choice of license to its licensees as provided above.
   42.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   42.41 - * Version 2 license, then the option applies only if the new code is
   42.42 - * made subject to such option by the copyright holder.
   42.43 - */
   42.44 -
   42.45 -package org.netbeans.modules.clazz;
   42.46 -
   42.47 -import org.netbeans.api.mdr.MDRepository;
   42.48 -import org.openide.src.*;
   42.49 -import org.netbeans.jmi.javamodel.Method;
   42.50 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   42.51 -
   42.52 -/** Implementation of method element for class objects.
   42.53 -*
   42.54 -* @author Dafe Simonek
   42.55 -*/
   42.56 -final class MethodElementImpl extends ConstructorElementImpl
   42.57 -    implements MethodElement.Impl {
   42.58 -    /** Return type of the method */
   42.59 -    private Type returnType;
   42.60 -
   42.61 -    static final long serialVersionUID =7928961724192084484L;
   42.62 -
   42.63 -    MethodElementImpl(final Method data) {
   42.64 -        super(data);
   42.65 -    }    
   42.66 -    
   42.67 -    Method getMethod() {
   42.68 -        return (Method)data;
   42.69 -    }
   42.70 -
   42.71 -    public void initializeData() {
   42.72 -        super.initializeData();
   42.73 -        getReturn();
   42.74 -    }
   42.75 -    
   42.76 -    /** @return returns teh Type representing return type of this method.
   42.77 -    */
   42.78 -    public Type getReturn () {
   42.79 -        if (returnType == null) {
   42.80 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
   42.81 -            repo.beginTrans(false);
   42.82 -            try {
   42.83 -                if (!isValid()) {
   42.84 -                    returnType = org.openide.src.Type.VOID;
   42.85 -                } else {
   42.86 -                    returnType = Util.createType(getMethod().getType());
   42.87 -                }
   42.88 -            } finally {
   42.89 -                repo.endTrans();
   42.90 -            }
   42.91 -        }
   42.92 -        return returnType;
   42.93 -    }
   42.94 -
   42.95 -    /** Unsupported. Throws an Source exception. */
   42.96 -    public void setReturn (Type ret) throws SourceException {
   42.97 -        throwReadOnlyException();
   42.98 -    }
   42.99 -
  42.100 -    public Object readResolve() {
  42.101 -        return new MethodElement(this, null);
  42.102 -    }
  42.103 -
  42.104 -}
    43.1 --- a/clazz/src/org/netbeans/modules/clazz/NodeFactoryPool.java	Wed Sep 15 11:58:07 2010 +0530
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,198 +0,0 @@
    43.4 -/*
    43.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    43.6 - *
    43.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    43.8 - *
    43.9 - * The contents of this file are subject to the terms of either the GNU
   43.10 - * General Public License Version 2 only ("GPL") or the Common
   43.11 - * Development and Distribution License("CDDL") (collectively, the
   43.12 - * "License"). You may not use this file except in compliance with the
   43.13 - * License. You can obtain a copy of the License at
   43.14 - * http://www.netbeans.org/cddl-gplv2.html
   43.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   43.16 - * specific language governing permissions and limitations under the
   43.17 - * License.  When distributing the software, include this License Header
   43.18 - * Notice in each file and include the License file at
   43.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   43.20 - * particular file as subject to the "Classpath" exception as provided
   43.21 - * by Sun in the GPL Version 2 section of the License file that
   43.22 - * accompanied this code. If applicable, add the following below the
   43.23 - * License Header, with the fields enclosed by brackets [] replaced by
   43.24 - * your own identifying information:
   43.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   43.26 - *
   43.27 - * Contributor(s):
   43.28 - *
   43.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   43.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   43.31 - * Microsystems, Inc. All Rights Reserved.
   43.32 - *
   43.33 - * If you wish your version of this file to be governed by only the CDDL
   43.34 - * or only the GPL Version 2, indicate your decision by adding
   43.35 - * "[Contributor] elects to include this software in this distribution
   43.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   43.37 - * single choice of license, a recipient has the option to distribute
   43.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   43.39 - * to extend the choice of license to its licensees as provided above.
   43.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   43.41 - * Version 2 license, then the option applies only if the new code is
   43.42 - * made subject to such option by the copyright holder.
   43.43 - */
   43.44 -
   43.45 -package org.netbeans.modules.clazz;
   43.46 -
   43.47 -import java.io.IOException;
   43.48 -import java.util.*;
   43.49 -
   43.50 -import org.openide.util.Task;
   43.51 -import org.openide.ErrorManager;
   43.52 -import org.openide.cookies.InstanceCookie;
   43.53 -import org.openide.ErrorManager;
   43.54 -import org.openide.loaders.DataFolder;
   43.55 -import org.openide.loaders.FolderInstance;
   43.56 -import org.openide.src.nodes.FilterFactory;
   43.57 -import org.openide.src.nodes.ElementNodeFactory;
   43.58 -import org.openide.util.TaskListener;
   43.59 -
   43.60 -/**
   43.61 - * A pool for registering FilterFactories for the object browser and the
   43.62 - * explorer.
   43.63 - *
   43.64 - * @author  Svatopluk Dedic
   43.65 - */
   43.66 -class NodeFactoryPool extends FolderInstance {
   43.67 -    static final FilterFactory[] EMPTY = new FilterFactory[0];
   43.68 -
   43.69 -    /**
   43.70 -     * Base factory, which serves as a default and the tail of the chain.
   43.71 -     */
   43.72 -    ElementNodeFactory  base;
   43.73 -    
   43.74 -    /**
   43.75 -     * Factories, which were explicitly added by calls to {@link #addFactory}
   43.76 -     */
   43.77 -    LinkedList          explicit;
   43.78 -    
   43.79 -    /**
   43.80 -     * State of the underlying folder. Contains list of factories registered
   43.81 -     * through the SFS.
   43.82 -     */
   43.83 -    FilterFactory[]     factories = EMPTY;
   43.84 -    
   43.85 -    /**
   43.86 -     * Computed head of the factory chain.
   43.87 -     */
   43.88 -    ElementNodeFactory  head;
   43.89 -    
   43.90 -    /**
   43.91 -     * True, if the folder scan was triggered at least once.
   43.92 -     */
   43.93 -    boolean             initialized;
   43.94 -    
   43.95 -    NodeFactoryPool(DataFolder storage, ElementNodeFactory base) {
   43.96 -        super(storage);
   43.97 -        this.base = base;
   43.98 -        head = base;
   43.99 -    }
  43.100 -    
  43.101 -    final Object sync() {
  43.102 -        return base;
  43.103 -    }
  43.104 -
  43.105 -    /**
  43.106 -     * Returns the head of the current factory list. Except for the initialization,
  43.107 -     * the method does not block.
  43.108 -     */
  43.109 -    ElementNodeFactory getHead() {
  43.110 -        // force folder scan the first time the Pool is queried
  43.111 -        if (!initialized) {
  43.112 -            recreate();
  43.113 -            waitFinished();
  43.114 -            initialized = true;
  43.115 -        }
  43.116 -        return head;
  43.117 -    }
  43.118 -
  43.119 -    /**
  43.120 -     * Creates an array of factories from the underlying folder. The "product" of
  43.121 -     * the method is the head of the factory list.
  43.122 -     */
  43.123 -    protected Object createInstance(InstanceCookie[] cookies) 
  43.124 -    throws java.io.IOException, ClassNotFoundException {
  43.125 -        Collection l = new ArrayList(cookies.length);
  43.126 -        for (int i = 0; i < cookies.length; i++) {
  43.127 -            try {
  43.128 -                Object o = cookies[i].instanceCreate();
  43.129 -                if (!(o instanceof FilterFactory))
  43.130 -                    continue;
  43.131 -                l.add(o);
  43.132 -            } catch (IOException ex) {
  43.133 -                logError(ex);
  43.134 -            } catch (ClassNotFoundException ex) {
  43.135 -                logError(ex);
  43.136 -            }
  43.137 -        }
  43.138 -        synchronized (sync()) {
  43.139 -            ElementNodeFactory f = relinkFactories(l);
  43.140 -            this.factories = (FilterFactory[])l.toArray(new FilterFactory[l.size()]);
  43.141 -            return head = f;
  43.142 -        }
  43.143 -    }
  43.144 -
  43.145 -    /**
  43.146 -     * Reattaches factories in the logicall factory chain to each other.
  43.147 -     */
  43.148 -    private ElementNodeFactory relinkFactories(Collection first) {
  43.149 -        ElementNodeFactory previous = base;
  43.150 -        FilterFactory f = null;
  43.151 -        Iterator it;
  43.152 -        Collection next = explicit;
  43.153 -        
  43.154 -        if (first == null)
  43.155 -            first = Arrays.asList(factories);
  43.156 -        
  43.157 -        for (it = first.iterator(); it.hasNext(); ) {
  43.158 -            f = (FilterFactory)it.next();
  43.159 -            f.attachTo(previous);
  43.160 -            previous = f;
  43.161 -        }
  43.162 -        if (next != null) {
  43.163 -            for (it = next.iterator(); it.hasNext(); ) {
  43.164 -                f = (FilterFactory)it.next();
  43.165 -                f.attachTo(previous);
  43.166 -                previous = f;
  43.167 -            }
  43.168 -        }
  43.169 -        return f != null ? f : base;
  43.170 -    }
  43.171 -
  43.172 -    /**
  43.173 -     * Adds an explicit factory and the head of the chain. Relinks the entire
  43.174 -     * chain as well.
  43.175 -     */
  43.176 -    void addFactory(FilterFactory f) {
  43.177 -        synchronized (sync()) {
  43.178 -            if (explicit == null) {
  43.179 -                explicit = new LinkedList();
  43.180 -            }
  43.181 -            explicit.add(f);
  43.182 -            head = relinkFactories(null);
  43.183 -        }
  43.184 -    }
  43.185 -
  43.186 -    /**
  43.187 -     * Removes one factory from the explicit list. Relinks the chain, if the
  43.188 -     * factory was, actually, on the list.
  43.189 -     */
  43.190 -    void removeFactory(FilterFactory f) {
  43.191 -        synchronized (sync()) {
  43.192 -            if (!explicit.remove(f))
  43.193 -                return;
  43.194 -            relinkFactories(null);
  43.195 -        }
  43.196 -    }
  43.197 -    
  43.198 -    void logError(Exception ex) {
  43.199 -        ErrorManager.getDefault().notify(ex);
  43.200 -    }
  43.201 -}
    44.1 --- a/clazz/src/org/netbeans/modules/clazz/SerDataNode.java	Wed Sep 15 11:58:07 2010 +0530
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,114 +0,0 @@
    44.4 -/*
    44.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    44.6 - *
    44.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    44.8 - *
    44.9 - * The contents of this file are subject to the terms of either the GNU
   44.10 - * General Public License Version 2 only ("GPL") or the Common
   44.11 - * Development and Distribution License("CDDL") (collectively, the
   44.12 - * "License"). You may not use this file except in compliance with the
   44.13 - * License. You can obtain a copy of the License at
   44.14 - * http://www.netbeans.org/cddl-gplv2.html
   44.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   44.16 - * specific language governing permissions and limitations under the
   44.17 - * License.  When distributing the software, include this License Header
   44.18 - * Notice in each file and include the License file at
   44.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   44.20 - * particular file as subject to the "Classpath" exception as provided
   44.21 - * by Sun in the GPL Version 2 section of the License file that
   44.22 - * accompanied this code. If applicable, add the following below the
   44.23 - * License Header, with the fields enclosed by brackets [] replaced by
   44.24 - * your own identifying information:
   44.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   44.26 - *
   44.27 - * Contributor(s):
   44.28 - *
   44.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   44.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   44.31 - * Microsystems, Inc. All Rights Reserved.
   44.32 - *
   44.33 - * If you wish your version of this file to be governed by only the CDDL
   44.34 - * or only the GPL Version 2, indicate your decision by adding
   44.35 - * "[Contributor] elects to include this software in this distribution
   44.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   44.37 - * single choice of license, a recipient has the option to distribute
   44.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   44.39 - * to extend the choice of license to its licensees as provided above.
   44.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   44.41 - * Version 2 license, then the option applies only if the new code is
   44.42 - * made subject to such option by the copyright holder.
   44.43 - */
   44.44 -
   44.45 -package org.netbeans.modules.clazz;
   44.46 -
   44.47 -import java.awt.Image;
   44.48 -import java.awt.Toolkit;
   44.49 -import java.awt.datatransfer.Transferable;
   44.50 -import java.beans.BeanInfo;
   44.51 -import java.io.IOException;
   44.52 -
   44.53 -import org.openide.ErrorManager;
   44.54 -import org.openide.src.nodes.SourceChildren;
   44.55 -
   44.56 -/** Exetends ClassDataNode, adds behaviour specific to serialized objects.
   44.57 -* This class is final only for performance reasons,
   44.58 -* can be happily unfinaled if desired.
   44.59 -*
   44.60 -* @author Jaroslav Tulach, Dafe Simonek
   44.61 -*/
   44.62 -final class SerDataNode extends ClassDataNode {
   44.63 -    /** generated Serialized Version UID */
   44.64 -    static final long serialVersionUID = -2645179282674800246L;
   44.65 -
   44.66 -    private static final String SER_BASE =
   44.67 -        "org/netbeans/modules/clazz/resources/ser"; // NOI18N
   44.68 -    private static final String SER_MAIN_BASE =
   44.69 -        "org/netbeans/modules/clazz/resources/serMain"; // NOI18N
   44.70 -    private static final String SER_ERROR_BASE =
   44.71 -        "org/netbeans/modules/clazz/resources/serError"; // NOI18N
   44.72 -
   44.73 -    /** Constructs bean data node with asociated data object.
   44.74 -    */
   44.75 -    public SerDataNode(final SerDataObject obj) {
   44.76 -        super(obj, new SerTopChildren(obj, new SourceChildren(ClassDataObject.getExplorerFactory())));
   44.77 -    }
   44.78 -    
   44.79 -    protected SourceChildren getSourceChildren() {
   44.80 -        return ((SerTopChildren)getChildren()).getSourceChildren();
   44.81 -    }
   44.82 -
   44.83 -    // ----------------------------------------------------------------------------------
   44.84 -    // methods
   44.85 -
   44.86 -    /** Returns initial icon base string for ser node.
   44.87 -    */
   44.88 -    protected String initialIconBase () {
   44.89 -        return SER_BASE;
   44.90 -    }
   44.91 -    
   44.92 -    protected void resolveIcons () {
   44.93 -    }
   44.94 -
   44.95 -    protected void requestResolveIcon() {
   44.96 -        try {
   44.97 -            ClassDataObject dataObj = (ClassDataObject)getDataObject();
   44.98 -            dataObj.getBeanClass(); // check exception
   44.99 -            setIconBase(SER_BASE);
  44.100 -        } catch (IOException ex) {
  44.101 -            // log exception only and set error tooltip
  44.102 -            ErrorManager.getDefault().notify(
  44.103 -                ErrorManager.INFORMATIONAL, ex
  44.104 -            );
  44.105 -            setIconBase(SER_ERROR_BASE);
  44.106 -            setErrorToolTip(ex);
  44.107 -        } catch (ClassNotFoundException ex) {
  44.108 -            // log exception only and set error tooltip
  44.109 -            ErrorManager.getDefault().notify(
  44.110 -                ErrorManager.INFORMATIONAL, ex
  44.111 -            );
  44.112 -            setIconBase(SER_ERROR_BASE);
  44.113 -            setErrorToolTip(ex);
  44.114 -        }
  44.115 -        iconResolved = true;
  44.116 -    }
  44.117 -}
    45.1 --- a/clazz/src/org/netbeans/modules/clazz/SerDataObject.java	Wed Sep 15 11:58:07 2010 +0530
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,139 +0,0 @@
    45.4 -/*
    45.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    45.6 - *
    45.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    45.8 - *
    45.9 - * The contents of this file are subject to the terms of either the GNU
   45.10 - * General Public License Version 2 only ("GPL") or the Common
   45.11 - * Development and Distribution License("CDDL") (collectively, the
   45.12 - * "License"). You may not use this file except in compliance with the
   45.13 - * License. You can obtain a copy of the License at
   45.14 - * http://www.netbeans.org/cddl-gplv2.html
   45.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   45.16 - * specific language governing permissions and limitations under the
   45.17 - * License.  When distributing the software, include this License Header
   45.18 - * Notice in each file and include the License file at
   45.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   45.20 - * particular file as subject to the "Classpath" exception as provided
   45.21 - * by Sun in the GPL Version 2 section of the License file that
   45.22 - * accompanied this code. If applicable, add the following below the
   45.23 - * License Header, with the fields enclosed by brackets [] replaced by
   45.24 - * your own identifying information:
   45.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   45.26 - *
   45.27 - * Contributor(s):
   45.28 - *
   45.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   45.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   45.31 - * Microsystems, Inc. All Rights Reserved.
   45.32 - *
   45.33 - * If you wish your version of this file to be governed by only the CDDL
   45.34 - * or only the GPL Version 2, indicate your decision by adding
   45.35 - * "[Contributor] elects to include this software in this distribution
   45.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   45.37 - * single choice of license, a recipient has the option to distribute
   45.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   45.39 - * to extend the choice of license to its licensees as provided above.
   45.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   45.41 - * Version 2 license, then the option applies only if the new code is
   45.42 - * made subject to such option by the copyright holder.
   45.43 - */
   45.44 -
   45.45 -package org.netbeans.modules.clazz;
   45.46 -
   45.47 -import org.openide.util.HelpCtx;
   45.48 -import org.netbeans.modules.classfile.ClassFile;
   45.49 -import org.openide.loaders.InstanceSupport;
   45.50 -import org.openide.loaders.DataObjectExistsException;
   45.51 -import org.openide.nodes.Node;
   45.52 -import org.openide.nodes.CookieSet;
   45.53 -import java.io.InputStream;
   45.54 -import org.openide.filesystems.FileObject;
   45.55 -import org.openide.ErrorManager;
   45.56 -import org.openide.cookies.InstanceCookie;
   45.57 -import java.io.IOException;
   45.58 -import org.openide.util.NbBundle;
   45.59 -
   45.60 -
   45.61 -/** DataObject which represents JavaBeans (".ser" files).
   45.62 -* This class is final only for performance reasons,
   45.63 -* can be happily unfinaled if desired.
   45.64 -*
   45.65 -* @author Jan Jancura, Ian Formanek, Dafe Simonek
   45.66 -*/
   45.67 -public final class SerDataObject extends ClassDataObject {
   45.68 -    /** generated Serialized Version UID */
   45.69 -    static final long serialVersionUID = 8229229209013849842L;
   45.70 -
   45.71 -    /** Constructs a new BeanDataObject */
   45.72 -    public SerDataObject(FileObject fo, ClassDataLoader loader) throws DataObjectExistsException {
   45.73 -        super (fo, loader);
   45.74 -        initCookies();
   45.75 -    }
   45.76 -    
   45.77 -    /** Performs cookie initialization. */
   45.78 -    protected void initCookies () {
   45.79 -        super.initCookies();
   45.80 -
   45.81 -        CookieSet cs = getCookieSet();
   45.82 -        cs.add(InstanceCookie.class, this);
   45.83 -    }
   45.84 -    
   45.85 -    /**
   45.86 -     * All serialized objects are treated as JavaBeans since the instance of
   45.87 -     * the object can be obtained (using deserialization).
   45.88 -     * @returns true
   45.89 -     */
   45.90 -    public boolean isJavaBean() {
   45.91 -        return true;
   45.92 -    }
   45.93 -
   45.94 -    /** 
   45.95 -     * Creates NodeDelegate for this DataObject
   45.96 -     * @returns node that represent the obejct
   45.97 -    */
   45.98 -    protected Node createNodeDelegate () {
   45.99 -        return new SerDataNode (this);
  45.100 -    }
  45.101 -
  45.102 -
  45.103 -    protected ClassFile loadClassFile() throws IOException,ClassNotFoundException {
  45.104 -        Class clazz = createInstanceSupport().instanceClass();
  45.105 -        String resourceName='/'+clazz.getName().replace('.','/')+".class"; // NOI18N
  45.106 -        InputStream stream=clazz.getResourceAsStream(resourceName);
  45.107 -
  45.108 -        if (stream==null)
  45.109 -            return null;
  45.110 -        try {
  45.111 -            return new ClassFile(stream,false);
  45.112 -        } finally {
  45.113 -            stream.close();
  45.114 -        }
  45.115 -    }
  45.116 -
  45.117 -    /**
  45.118 -     * Provides special processing for the serialized objects:
  45.119 -     * if the help can be found for the class that is serialized inside
  45.120 -     * the ser file, returns that help. The default is the help for SerDataObject.
  45.121 -     * @returns appropriate HelpCtx
  45.122 -     */
  45.123 -    public HelpCtx getHelpCtx () {
  45.124 -        HelpCtx test = InstanceSupport.findHelp (createInstanceSupport());
  45.125 -        if (test != null)
  45.126 -            return test;
  45.127 -        else
  45.128 -            return super.getHelpCtx();
  45.129 -    }
  45.130 -
  45.131 -    protected FileObject handleRename (String name) throws IOException {
  45.132 -        if (name.indexOf(".")!=-1) { // NOI18N
  45.133 -            throw (IOException)ErrorManager.getDefault().annotate(
  45.134 -            new IOException("Dot in name"), // NOI18N
  45.135 -            ErrorManager.USER,
  45.136 -            null, NbBundle.getMessage(SerDataObject.class, "MSG_INVName"),
  45.137 -            null, null
  45.138 -	    );
  45.139 -        }
  45.140 -        return super.handleRename(name);
  45.141 -    }
  45.142 -}
    46.1 --- a/clazz/src/org/netbeans/modules/clazz/SerParser.java	Wed Sep 15 11:58:07 2010 +0530
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,605 +0,0 @@
    46.4 -/*
    46.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    46.6 - *
    46.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    46.8 - *
    46.9 - * The contents of this file are subject to the terms of either the GNU
   46.10 - * General Public License Version 2 only ("GPL") or the Common
   46.11 - * Development and Distribution License("CDDL") (collectively, the
   46.12 - * "License"). You may not use this file except in compliance with the
   46.13 - * License. You can obtain a copy of the License at
   46.14 - * http://www.netbeans.org/cddl-gplv2.html
   46.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   46.16 - * specific language governing permissions and limitations under the
   46.17 - * License.  When distributing the software, include this License Header
   46.18 - * Notice in each file and include the License file at
   46.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   46.20 - * particular file as subject to the "Classpath" exception as provided
   46.21 - * by Sun in the GPL Version 2 section of the License file that
   46.22 - * accompanied this code. If applicable, add the following below the
   46.23 - * License Header, with the fields enclosed by brackets [] replaced by
   46.24 - * your own identifying information:
   46.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   46.26 - *
   46.27 - * Contributor(s):
   46.28 - *
   46.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   46.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   46.31 - * Microsystems, Inc. All Rights Reserved.
   46.32 - *
   46.33 - * If you wish your version of this file to be governed by only the CDDL
   46.34 - * or only the GPL Version 2, indicate your decision by adding
   46.35 - * "[Contributor] elects to include this software in this distribution
   46.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   46.37 - * single choice of license, a recipient has the option to distribute
   46.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   46.39 - * to extend the choice of license to its licensees as provided above.
   46.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   46.41 - * Version 2 license, then the option applies only if the new code is
   46.42 - * made subject to such option by the copyright holder.
   46.43 - */
   46.44 -
   46.45 -package org.netbeans.modules.clazz;
   46.46 -
   46.47 -import java.io.*;
   46.48 -import java.util.*;
   46.49 -import org.openide.util.NotImplementedException;
   46.50 -
   46.51 -/* The following may be useful to Emacs users:
   46.52 -
   46.53 -(defun comma-sep-decimal-encode ()
   46.54 -  (interactive)
   46.55 -  (while
   46.56 -      (let ((p (point)))
   46.57 -        (and (re-search-forward "\\(-?[0-9][0-9]?[0-9]?\\),?" nil t)
   46.58 -             (= p (match-beginning 0))))
   46.59 -    (replace-match (char-to-string
   46.60 -                    (let ((x (string-to-int (match-string 1))))
   46.61 -                      (when (< x 0) (setq x (+ x 256)))
   46.62 -                      x))
   46.63 -                   t t)))
   46.64 -
   46.65 -After evaluating this, go into an old cpanel.xml or similar
   46.66 -(M-x find-file-literally, by the way) and type
   46.67 -M-x comma-sep-decimal-encode right after the opening quote
   46.68 -of the value. The contents will be converted to raw binary and
   46.69 -may be saved as a .ser file parsable by this class.
   46.70 -
   46.71 -(defun hex-encode ()
   46.72 -  (interactive)
   46.73 -  (while
   46.74 -      (let ((p (point)))
   46.75 -        (and (re-search-forward "\\s-*\\([a-fA-F0-9][a-fA-F0-9]\\)" nil t)
   46.76 -             (= p (match-beginning 0))))
   46.77 -    (replace-match (char-to-string
   46.78 -                    (string-to-int (match-string 1) 16))
   46.79 -                   t t)))
   46.80 -
   46.81 -Same for hexadecimal serialized data. For .settings files, it is
   46.82 -easier to select Customize Bean... in the IDE and save as *.ser.
   46.83 -*/
   46.84 -
   46.85 -/** Parser for Java serialization files.
   46.86 - * Does no classloading or per-class semantics, simply parses the
   46.87 - * raw serialization structure.
   46.88 - * @author Jesse Glick
   46.89 - */
   46.90 -public final class SerParser implements ObjectStreamConstants {
   46.91 -    
   46.92 -    private static final boolean DEBUG = Boolean.getBoolean("org.netbeans.modules.clazz.SerParser.DEBUG"); // NOI18N
   46.93 -    
   46.94 -    private final InputStream is;
   46.95 -    private int seq = 0;
   46.96 -    private final List refs = new ArrayList(100); // List<Object>
   46.97 -    
   46.98 -    public SerParser(InputStream is) {
   46.99 -        this.is = is;
  46.100 -    }
  46.101 -    
  46.102 -    private int makeRef(Object o) {
  46.103 -        refs.add(o);
  46.104 -        int i = seq;
  46.105 -        seq++;
  46.106 -        if (DEBUG) System.err.println("makeRef[" + i + "]=" + o); // NOI18N
  46.107 -        return i;
  46.108 -    }
  46.109 -    
  46.110 -    private Object getRef(int i) throws CorruptException {
  46.111 -        int idx = i - baseWireHandle;
  46.112 -        if (idx < 0 || idx >= seq) throw new CorruptException("Invalid reference: " + i); // NOI18N
  46.113 -        Object o = refs.get(idx);
  46.114 -        if (o == null) throw new CorruptException("Invalid reference: " + i); // NOI18N
  46.115 -        return o;
  46.116 -    }
  46.117 -    
  46.118 -    public Stream parse() throws IOException, CorruptException {
  46.119 -        Stream s = new Stream();
  46.120 -        s.magic = readShort();
  46.121 -        s.version = readShort();
  46.122 -        if (s.magic != STREAM_MAGIC || s.version != STREAM_VERSION) {
  46.123 -           throw new CorruptException("stream version mismatch: " + hexify(s.magic) + " != " + hexify(STREAM_MAGIC) + " or " + hexify(s.version) + " != " +  hexify(STREAM_VERSION)); // NOI18N
  46.124 -        }
  46.125 -        s.contents = new ArrayList(10);
  46.126 -        while (peek() != -1) {
  46.127 -            s.contents.add(readContent());
  46.128 -        }
  46.129 -        if (DEBUG) System.err.println("parsed: " + s); // NOI18N
  46.130 -        return s;
  46.131 -    }
  46.132 -    
  46.133 -    public static final class CorruptException extends IOException {
  46.134 -        public CorruptException() {
  46.135 -        }
  46.136 -        public CorruptException(String m) {
  46.137 -            super(m);
  46.138 -        }
  46.139 -    }
  46.140 -    
  46.141 -    private int pushback = -1;
  46.142 -    private int rb() throws IOException {
  46.143 -        if (pushback != -1) {
  46.144 -            int c = pushback;
  46.145 -            pushback = -1;
  46.146 -            return c;
  46.147 -        }
  46.148 -        int c = is.read();
  46.149 -        if (DEBUG) System.err.println("read: " + Integer.toHexString(c)); // NOI18N
  46.150 -        if (c == -1) {
  46.151 -            throw new EOFException();
  46.152 -        } else {
  46.153 -            return c;
  46.154 -        }
  46.155 -    }
  46.156 -    private int peek() throws IOException {
  46.157 -        if (pushback != -1) throw new IllegalStateException("can only peek once"); // NOI18N
  46.158 -        pushback = is.read();
  46.159 -        if (DEBUG) System.err.println("read: " + Integer.toHexString(pushback)); // NOI18N
  46.160 -        return pushback;
  46.161 -    }
  46.162 -    
  46.163 -    static String hexify(byte b) {
  46.164 -        int i = b;
  46.165 -        if (i < 0) i += 256;
  46.166 -        String s = Integer.toHexString(i).toUpperCase(Locale.US);
  46.167 -        return "0x" + pad(s, 2); // NOI18N
  46.168 -    }
  46.169 -    static String hexify(short s) {
  46.170 -        int i = s;
  46.171 -        if (i < 0) i += 65536;
  46.172 -        String st = Integer.toHexString(i).toUpperCase(Locale.US);
  46.173 -        return "0x" + pad(st, 4); // NOI18N
  46.174 -    }
  46.175 -    static String hexify(int i) {
  46.176 -        String s = Integer.toHexString(i).toUpperCase(Locale.US);
  46.177 -        return "0x" + pad(s, 4); // NOI18N
  46.178 -    }
  46.179 -    static String hexify(long l) {
  46.180 -        String s1 = Integer.toHexString((int)((l & 0xFFFFFFFF00000000L) << 32)).toUpperCase(Locale.US);
  46.181 -        String s2 = Integer.toHexString((int)(l & 0x00000000FFFFFFFFL)).toUpperCase(Locale.US);
  46.182 -        return "0x" + pad(s1, 4) + pad(s2, 4); // NOI18N
  46.183 -    }
  46.184 -    static String hexify(byte[] b) {
  46.185 -        StringBuffer buf = new StringBuffer(2 + b.length * 2);
  46.186 -        buf.append("0x"); // NOI18N
  46.187 -        for (int i = 0; i < b.length; i++) {
  46.188 -            int x = b[i];
  46.189 -            if (x < 0) x += 256;
  46.190 -            buf.append(pad(Integer.toHexString(x).toUpperCase(Locale.US), 2));
  46.191 -        }
  46.192 -        return buf.toString();
  46.193 -    }
  46.194 -    private static String pad(String s, int size) {
  46.195 -        int i = s.length();
  46.196 -        if (i == size) {
  46.197 -            return s;
  46.198 -        } else {
  46.199 -            StringBuffer b = new StringBuffer(size);
  46.200 -            for (int k = 0; k < size - i; k++) {
  46.201 -                b.append('0'); // NOI18N
  46.202 -            }
  46.203 -            b.append(s);
  46.204 -            return b.toString();
  46.205 -        }
  46.206 -    }
  46.207 -    
  46.208 -    private long readLong() throws IOException {
  46.209 -        long x1 = rb();
  46.210 -        long x2 = rb();
  46.211 -        long x3 = rb();
  46.212 -        long x4 = rb();
  46.213 -        long x5 = rb();
  46.214 -        long x6 = rb();
  46.215 -        long x7 = rb();
  46.216 -        long x8 = rb();
  46.217 -        long l = (x1 << 56) + (x2 << 48) + (x3 << 40) + (x4 << 32) + (x5 << 24) + (x6 << 16) + (x7 << 8) + x8;
  46.218 -        if (DEBUG) System.err.println("readLong: " + l); // NOI18N
  46.219 -        return l;
  46.220 -    }
  46.221 -    
  46.222 -    private int readInt() throws IOException {
  46.223 -        int x1 = rb();
  46.224 -        int x2 = rb();
  46.225 -        int x3 = rb();
  46.226 -        int x4 = rb();
  46.227 -        int i = (x1 << 24) + (x2 << 16) + (x3 << 8) + x4;
  46.228 -        if (DEBUG) System.err.println("readInt: " + i); // NOI18N
  46.229 -        return i;
  46.230 -    }
  46.231 -    
  46.232 -    private short readShort() throws IOException {
  46.233 -        int x1 = rb();
  46.234 -        int x2 = rb();
  46.235 -        short s = (short)((x1 << 8) + x2);
  46.236 -        //System.err.println("x1=" + hexify(x1) + " x2=" + hexify(x2) + " s=" + hexify(s));
  46.237 -        //if (DEBUG) System.err.println("x1=" + x1 + " x2=" + x2 + " s=" + s);
  46.238 -        if (DEBUG) System.err.println("readShort: " + s); // NOI18N
  46.239 -        return s;
  46.240 -    }
  46.241 -    
  46.242 -    private byte readByte() throws IOException {
  46.243 -        return (byte)rb();
  46.244 -    }
  46.245 -    
  46.246 -    private String readUTF() throws IOException {
  46.247 -        short len = readShort();
  46.248 -        if (len < 0) throw new NotImplementedException();//XXX
  46.249 -        byte[] buf = new byte[len];
  46.250 -        for (int i = 0; i < len; i++) {
  46.251 -            buf[i] = readByte();
  46.252 -        }
  46.253 -        String s = new String(buf, "UTF-8"); // NOI18N
  46.254 -        if (DEBUG) System.err.println("readUTF: " + s); // NOI18N
  46.255 -        return s;
  46.256 -    }
  46.257 -    
  46.258 -    private String readLongUTF() throws IOException {
  46.259 -        long len = readLong();
  46.260 -        if (len < 0) throw new NotImplementedException();//XXX
  46.261 -        if (len > Integer.MAX_VALUE) throw new NotImplementedException();// XXX
  46.262 -        int ilen = (int)len;
  46.263 -        byte[] buf = new byte[ilen];
  46.264 -        for (int i = 0; i < ilen; i++) {
  46.265 -            buf[i] = readByte();
  46.266 -        }
  46.267 -        String s = new String(buf, "UTF-8"); // NOI18N
  46.268 -        if (DEBUG) System.err.println("readUTF: " + s); // NOI18N
  46.269 -        return s;
  46.270 -    }
  46.271 -    
  46.272 -    // See "Rules of the Grammar" in Java Object Serialization Specification
  46.273 -    // for explanation of all these objects.
  46.274 -    
  46.275 -    public static final class Stream /*extends Thing*/ {
  46.276 -        public short magic;
  46.277 -        public short version;
  46.278 -        public List contents; // List<Object>
  46.279 -        public String toString() {
  46.280 -            return "Stream[contents=" + contents + "]"; // NOI18N
  46.281 -        }
  46.282 -    }
  46.283 -    
  46.284 -    public static final Object NULL = "null"; // NOI18N
  46.285 -    
  46.286 -    private Object readContent() throws IOException {
  46.287 -        byte tc = readByte();
  46.288 -        switch (tc) {
  46.289 -        case TC_OBJECT:
  46.290 -            return readNewObject();
  46.291 -        case TC_CLASS:
  46.292 -            return readNewClass();
  46.293 -        case TC_ARRAY:
  46.294 -            return readNewArray();
  46.295 -        case TC_CLASSDESC:
  46.296 -            return readNewClassDesc();
  46.297 -        case TC_PROXYCLASSDESC:
  46.298 -            // XXX too complicated:
  46.299 -            throw new NotImplementedException("TC_PROXYCLASSDESC"); // NOI18N
  46.300 -            //return readNewProxyClassDesc();
  46.301 -        case TC_STRING:
  46.302 -            return readNewString();
  46.303 -        case TC_LONGSTRING:
  46.304 -            // XXX later
  46.305 -            throw new NotImplementedException("TC_LONGSTRING"); // NOI18N
  46.306 -            //return readNewLongString();
  46.307 -        case TC_REFERENCE:
  46.308 -            return readReference();
  46.309 -        case TC_NULL:
  46.310 -            return NULL;
  46.311 -        case TC_EXCEPTION:
  46.312 -            // XXX what is this??
  46.313 -            throw new NotImplementedException("TC_EXCEPTION"); // NOI18N
  46.314 -        case TC_RESET:
  46.315 -            // XXX what is this??
  46.316 -            throw new NotImplementedException("TC_RESET"); // NOI18N
  46.317 -        case TC_BLOCKDATA:
  46.318 -            return readBlockData();
  46.319 -        case TC_BLOCKDATALONG:
  46.320 -            return readBlockDataLong();
  46.321 -        default:
  46.322 -            throw new CorruptException("Unknown typecode: " + hexify(tc)); // NOI18N
  46.323 -        }
  46.324 -    }
  46.325 -    
  46.326 -    public static final class ObjectWrapper {
  46.327 -        public ClassDesc classdesc;
  46.328 -        public List data; // List<NameValue|Object>
  46.329 -        public String toString() {
  46.330 -            return "Object[class=" + classdesc.name + ",data=" + data + "]"; // NOI18N
  46.331 -        }
  46.332 -    }
  46.333 -    
  46.334 -    public static final class NameValue {
  46.335 -        public NameValue(FieldDesc name, Object value) {
  46.336 -            this.name = name;
  46.337 -            this.value = value;
  46.338 -        }
  46.339 -        public final FieldDesc name;
  46.340 -        public final Object value;
  46.341 -        public String toString() {
  46.342 -            return name.toString() + "=" + value.toString(); // NOI18N
  46.343 -        }
  46.344 -    }
  46.345 -    
  46.346 -    public static final class ClassDesc {
  46.347 -        public String name;
  46.348 -        public long svuid;
  46.349 -        public boolean writeMethod;
  46.350 -        public boolean blockData;
  46.351 -        public boolean serializable;
  46.352 -        public boolean externalizable;
  46.353 -        public List fields; // List<FieldDesc>
  46.354 -        public List annotation; // List<Object>
  46.355 -        public ClassDesc superclass;
  46.356 -        public String toString() {
  46.357 -            return "Class[name=" + name + "]"; // NOI18N
  46.358 -        }
  46.359 -    }
  46.360 -    
  46.361 -    private ObjectWrapper readNewObject() throws IOException {
  46.362 -        ObjectWrapper ow = new ObjectWrapper();
  46.363 -        ow.classdesc = readClassDesc();
  46.364 -        makeRef(ow);
  46.365 -        ow.data = new ArrayList (10);
  46.366 -        LinkedList hier = new LinkedList();
  46.367 -        for (ClassDesc cd = ow.classdesc; cd != null; cd = cd.superclass) {
  46.368 -            hier.addFirst(cd);
  46.369 -        }
  46.370 -        Iterator it = hier.iterator();
  46.371 -        while (it.hasNext()) {
  46.372 -            ClassDesc cd = (ClassDesc)it.next();
  46.373 -            if (cd.serializable) {
  46.374 -                ow.data.addAll(readNoWrClass(cd));
  46.375 -                if (cd.writeMethod) {
  46.376 -                    ow.data.addAll(readContents());
  46.377 -                }
  46.378 -            } else {
  46.379 -                if (cd.blockData) {
  46.380 -                    ow.data.addAll(readContents());
  46.381 -                } else {
  46.382 -                    // Old externalization. If this is not object content,
  46.383 -                    // the stream could now become corrupted. Oh well.
  46.384 -                    ow.data.add(readContent());
  46.385 -                }
  46.386 -            }
  46.387 -        }
  46.388 -        if (DEBUG) System.err.println("readNewObject: " + ow); // NOI18N
  46.389 -        return ow;
  46.390 -    }
  46.391 -    
  46.392 -    private ClassDesc readClassDesc() throws IOException {
  46.393 -        Object o = readContent();
  46.394 -        if (o instanceof ClassDesc) {
  46.395 -            return (ClassDesc)o;
  46.396 -        } else if (o == NULL) {
  46.397 -            return null;
  46.398 -        } else {
  46.399 -            throw new CorruptException("Expected class desc, got: " + o); // NOI18N
  46.400 -        }
  46.401 -    }
  46.402 -    
  46.403 -    private ClassDesc readNewClass() throws IOException {
  46.404 -        ClassDesc cd = readClassDesc();
  46.405 -        makeRef(cd);
  46.406 -        return cd;
  46.407 -    }
  46.408 -    
  46.409 -    private ClassDesc readNewClassDesc() throws IOException {
  46.410 -        ClassDesc cd = new ClassDesc();
  46.411 -        cd.name = readUTF();
  46.412 -        if (! cd.name.startsWith("[") && // NOI18N
  46.413 -                ! (cd.name.length() == 1 && "BSIJFDCZ".indexOf(cd.name) != -1) && // NOI18N
  46.414 -                ! cd.name.endsWith(";")) { // NOI18N
  46.415 -            // Canonicalize. It seems class names read normally need this; those
  46.416 -            // read as part of an array do not. ??
  46.417 -            cd.name = "L" + cd.name + ";"; // NOI18N
  46.418 -        }
  46.419 -        cd.svuid = readLong();
  46.420 -        makeRef(cd);
  46.421 -        byte cdf = readByte();
  46.422 -        cd.writeMethod = (cdf & SC_WRITE_METHOD) != 0;
  46.423 -        cd.blockData = (cdf & SC_BLOCK_DATA) != 0;
  46.424 -        cd.serializable = (cdf & SC_SERIALIZABLE) != 0;
  46.425 -        cd.externalizable = (cdf & SC_EXTERNALIZABLE) != 0;
  46.426 -        short count = readShort();
  46.427 -        cd.fields = new ArrayList(count);
  46.428 -        for (int i = 0; i < count; i++) {
  46.429 -            cd.fields.add(readFieldDesc());
  46.430 -        }
  46.431 -        cd.annotation = readContents();
  46.432 -        cd.superclass = readClassDesc();
  46.433 -        if (DEBUG) System.err.println("readNewClassDesc: " + cd); // NOI18N
  46.434 -        return cd;
  46.435 -    }
  46.436 -    
  46.437 -    public static class FieldDesc {
  46.438 -        public String name;
  46.439 -        public String type;
  46.440 -        public String toString() {
  46.441 -            return "Field[name=" + name + ",type=" + type + "]"; // NOI18N
  46.442 -        }
  46.443 -    }
  46.444 -    public static final class ObjFieldDesc extends FieldDesc {
  46.445 -        public boolean array;
  46.446 -        public String toString() {
  46.447 -            return "Field[name=" + name + ",type=" + type + (array ? "[]" : "") + "]"; // NOI18N
  46.448 -        }
  46.449 -    }
  46.450 -    
  46.451 -    private FieldDesc readFieldDesc() throws IOException {
  46.452 -        char tc = (char)readByte();
  46.453 -        FieldDesc fd;
  46.454 -        switch (tc) {
  46.455 -        case 'B':
  46.456 -        case 'C':
  46.457 -        case 'D':
  46.458 -        case 'F':
  46.459 -        case 'I':
  46.460 -        case 'J':
  46.461 -        case 'S':
  46.462 -        case 'Z':
  46.463 -            fd = new FieldDesc();
  46.464 -            fd.type = new String(new char[] {tc});
  46.465 -            break;
  46.466 -        case '[':
  46.467 -            fd = new ObjFieldDesc();
  46.468 -            ((ObjFieldDesc)fd).array = true;
  46.469 -            break;
  46.470 -        case 'L':
  46.471 -            fd = new ObjFieldDesc();
  46.472 -            ((ObjFieldDesc)fd).array = false;
  46.473 -            break;
  46.474 -        default:
  46.475 -            throw new CorruptException("Strange field type: " + tc); // NOI18N
  46.476 -        }
  46.477 -        fd.name = readUTF();
  46.478 -        if (fd instanceof ObjFieldDesc) {
  46.479 -            String clazz = (String)readContent();
  46.480 -            /*
  46.481 -            if (((ObjFieldDesc)fd).array) {
  46.482 -                if (! clazz.startsWith("[")) throw new CorruptException("Field type: " + clazz); // NOI18N
  46.483 -                clazz = clazz.substring(1, clazz.length());
  46.484 -            }
  46.485 -            if (! (clazz.startsWith("L") && clazz.endsWith(";"))) throw new CorruptException("Field type: " + clazz); // NOI18N
  46.486 -            fd.type = clazz.substring(1, clazz.length() - 1).replace('/', '.'); // NOI18N
  46.487 -             */
  46.488 -            fd.type = clazz;
  46.489 -        }
  46.490 -        if (DEBUG) System.err.println("readFieldDesc: " + fd); // NOI18N
  46.491 -        return fd;
  46.492 -    }
  46.493 -    
  46.494 -    private List readContents() throws IOException {
  46.495 -        List l = new ArrayList(10);
  46.496 -        while (peek() != TC_ENDBLOCKDATA) {
  46.497 -            l.add(readContent());
  46.498 -        }
  46.499 -        if (readByte() != TC_ENDBLOCKDATA) throw new IllegalStateException();
  46.500 -        if (DEBUG) System.err.println("readContents: " + l); // NOI18N
  46.501 -        return l;
  46.502 -    }
  46.503 -    
  46.504 -    public static final class ArrayWrapper {
  46.505 -        public ClassDesc classdesc;
  46.506 -        public List values;
  46.507 -        public String toString() {
  46.508 -            return classdesc.name + "{" + values + "}"; // NOI18N
  46.509 -        }
  46.510 -    }
  46.511 -    
  46.512 -    private ArrayWrapper readNewArray() throws IOException {
  46.513 -        ArrayWrapper aw = new ArrayWrapper();
  46.514 -        aw.classdesc = readClassDesc();
  46.515 -        makeRef(aw);
  46.516 -        int size = readInt();
  46.517 -        if (size < 0) throw new NotImplementedException();
  46.518 -        aw.values = new ArrayList(size);
  46.519 -        for (int i = 0; i < size; i++) {
  46.520 -            if (aw.classdesc.name.equals("[B")) { // NOI18N
  46.521 -                aw.values.add(new Byte(readByte()));
  46.522 -            } else if (aw.classdesc.name.equals("[S")) { // NOI18N
  46.523 -                aw.values.add(new Short(readShort()));
  46.524 -            } else if (aw.classdesc.name.equals("[I")) { // NOI18N
  46.525 -                aw.values.add(new Integer(readInt()));
  46.526 -            } else if (aw.classdesc.name.equals("[J")) { // NOI18N
  46.527 -                aw.values.add(new Long(readLong()));
  46.528 -            } else if (aw.classdesc.name.equals("[F")) { // NOI18N
  46.529 -                aw.values.add(new Float(Float.intBitsToFloat(readInt())));
  46.530 -            } else if (aw.classdesc.name.equals("[D")) { // NOI18N
  46.531 -                aw.values.add(new Double(Double.longBitsToDouble(readLong())));
  46.532 -            } else if (aw.classdesc.name.equals("[C")) { // NOI18N
  46.533 -                aw.values.add(new Character((char)readShort()));
  46.534 -            } else if (aw.classdesc.name.equals("[Z")) { // NOI18N
  46.535 -                aw.values.add(readByte() == 1 ? Boolean.TRUE : Boolean.FALSE);
  46.536 -            } else {
  46.537 -                aw.values.add(readContent());
  46.538 -            }
  46.539 -        }
  46.540 -        if (DEBUG) System.err.println("readNewArray: " + aw); // NOI18N
  46.541 -        return aw;
  46.542 -    }
  46.543 -    
  46.544 -    private String readNewString() throws IOException {
  46.545 -        String s = readUTF();
  46.546 -        makeRef(s);
  46.547 -        return s;
  46.548 -    }
  46.549 -    
  46.550 -    private Object readReference() throws IOException {
  46.551 -        int i = readInt();
  46.552 -        Object r = getRef(i);
  46.553 -        if (DEBUG) System.err.println("readReference: " + r); // NOI18N
  46.554 -        return r;
  46.555 -    }
  46.556 -    
  46.557 -    private byte[] readBlockData() throws IOException {
  46.558 -        int size = readByte();
  46.559 -        if (size < 0) size += 256;
  46.560 -        byte[] b = new byte[size];
  46.561 -        for (int i = 0; i < size; i++) {
  46.562 -            b[i] = readByte();
  46.563 -        }
  46.564 -        if (DEBUG) System.err.println("readBlockData: " + size + " bytes"); // NOI18N
  46.565 -        return b;
  46.566 -    }
  46.567 -    
  46.568 -    private byte[] readBlockDataLong() throws IOException {
  46.569 -        int size = readInt();
  46.570 -        if (size < 0) throw new NotImplementedException();
  46.571 -        byte[] b = new byte[size];
  46.572 -        for (int i = 0; i < size; i++) {
  46.573 -            b[i] = readByte();
  46.574 -        }
  46.575 -        if (DEBUG) System.err.println("readBlockDataLong: " + size + " bytes"); // NOI18N
  46.576 -        return b;
  46.577 -    }
  46.578 -    
  46.579 -    private List/*<NameValue>*/ readNoWrClass(ClassDesc cd) throws IOException {
  46.580 -        List fields = cd.fields;
  46.581 -        List values = new ArrayList(fields.size());
  46.582 -        for (int i = 0; i < fields.size(); i++) {
  46.583 -            FieldDesc fd = (FieldDesc)fields.get(i);
  46.584 -            if (fd.type.equals("B")) { // NOI18N
  46.585 -                values.add(new NameValue(fd, new Byte(readByte())));
  46.586 -            } else if (fd.type.equals("S")) { // NOI18N
  46.587 -                values.add(new NameValue(fd, new Short(readShort())));
  46.588 -            } else if (fd.type.equals("I")) { // NOI18N
  46.589 -                values.add(new NameValue(fd, new Integer(readInt())));
  46.590 -            } else if (fd.type.equals("J")) { // NOI18N
  46.591 -                values.add(new NameValue(fd, new Long(readLong())));
  46.592 -            } else if (fd.type.equals("F")) { // NOI18N
  46.593 -                values.add(new NameValue(fd, new Float(Float.intBitsToFloat(readInt()))));
  46.594 -            } else if (fd.type.equals("D")) { // NOI18N
  46.595 -                values.add(new NameValue(fd, new Double(Double.longBitsToDouble(readLong()))));
  46.596 -            } else if (fd.type.equals("C")) { // NOI18N
  46.597 -                values.add(new NameValue(fd, new Character((char)readShort())));
  46.598 -            } else if (fd.type.equals("Z")) { // NOI18N
  46.599 -                values.add(new NameValue(fd, readByte() == 1 ? Boolean.TRUE : Boolean.FALSE));
  46.600 -            } else {
  46.601 -                values.add(new NameValue(fd, readContent()));
  46.602 -            }
  46.603 -        }
  46.604 -        if (DEBUG) System.err.println("readNoWrClass: " + values); // NOI18N
  46.605 -        return values;
  46.606 -    }
  46.607 -
  46.608 -}
    47.1 --- a/clazz/src/org/netbeans/modules/clazz/SerStructureNode.java	Wed Sep 15 11:58:07 2010 +0530
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,228 +0,0 @@
    47.4 -/*
    47.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    47.6 - *
    47.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    47.8 - *
    47.9 - * The contents of this file are subject to the terms of either the GNU
   47.10 - * General Public License Version 2 only ("GPL") or the Common
   47.11 - * Development and Distribution License("CDDL") (collectively, the
   47.12 - * "License"). You may not use this file except in compliance with the
   47.13 - * License. You can obtain a copy of the License at
   47.14 - * http://www.netbeans.org/cddl-gplv2.html
   47.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   47.16 - * specific language governing permissions and limitations under the
   47.17 - * License.  When distributing the software, include this License Header
   47.18 - * Notice in each file and include the License file at
   47.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   47.20 - * particular file as subject to the "Classpath" exception as provided
   47.21 - * by Sun in the GPL Version 2 section of the License file that
   47.22 - * accompanied this code. If applicable, add the following below the
   47.23 - * License Header, with the fields enclosed by brackets [] replaced by
   47.24 - * your own identifying information:
   47.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   47.26 - *
   47.27 - * Contributor(s):
   47.28 - *
   47.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   47.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   47.31 - * Microsystems, Inc. All Rights Reserved.
   47.32 - *
   47.33 - * If you wish your version of this file to be governed by only the CDDL
   47.34 - * or only the GPL Version 2, indicate your decision by adding
   47.35 - * "[Contributor] elects to include this software in this distribution
   47.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   47.37 - * single choice of license, a recipient has the option to distribute
   47.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   47.39 - * to extend the choice of license to its licensees as provided above.
   47.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   47.41 - * Version 2 license, then the option applies only if the new code is
   47.42 - * made subject to such option by the copyright holder.
   47.43 - */
   47.44 -
   47.45 -package org.netbeans.modules.clazz;
   47.46 -
   47.47 -import java.io.*;
   47.48 -import java.util.*;
   47.49 -
   47.50 -import org.openide.*;
   47.51 -import org.openide.nodes.*;
   47.52 -import org.openide.util.NbBundle;
   47.53 -
   47.54 -/** Nodes representing pieces of a serialized file structurally.
   47.55 - * @author Jesse Glick
   47.56 - */
   47.57 -public abstract class SerStructureNode {
   47.58 -
   47.59 -    private SerStructureNode() {/* do not instantiate me */}
   47.60 -
   47.61 -    public static final class StreamNode extends AbstractNode {
   47.62 -        public StreamNode(SerParser.Stream s) {
   47.63 -            super(new GeneralChildren(s.contents));
   47.64 -            setName(NbBundle.getMessage(SerStructureNode.class, "LBL_ser_stream"));
   47.65 -            setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
   47.66 -        }
   47.67 -    }
   47.68 -    
   47.69 -    private static class GeneralChildren extends Children.Keys {
   47.70 -        private final List things;
   47.71 -        public GeneralChildren(List things) {
   47.72 -            this.things = things;
   47.73 -        }
   47.74 -        protected void addNotify() {
   47.75 -            super.addNotify();
   47.76 -            setKeys(things);
   47.77 -        }
   47.78 -        protected void removeNotify() {
   47.79 -            setKeys(Collections.EMPTY_SET);
   47.80 -            super.removeNotify();
   47.81 -        }
   47.82 -        protected Node[] createNodes(Object key) {
   47.83 -            return new Node[] {createNode(key)};
   47.84 -        }
   47.85 -        protected Node createNode(Object key) {
   47.86 -            if (key instanceof SerParser.NameValue) {
   47.87 -                SerParser.NameValue nv = (SerParser.NameValue)key;
   47.88 -                Node n = createNode(nv.value);
   47.89 -                n.setName(prettify(nv.name.type) + " " + nv.name.name + " = " + n.getName()); // NOI18N
   47.90 -                return n;
   47.91 -            } else if (key instanceof SerParser.ObjectWrapper) {
   47.92 -                SerParser.ObjectWrapper ow = (SerParser.ObjectWrapper)key;
   47.93 -                String name = prettify(ow.classdesc.name);
   47.94 -                Children ch;
   47.95 -                if (name.equals("org.openide.util.io.NbMarshalledObject")) { // NOI18N
   47.96 -                    // This is special!
   47.97 -                    ch = new NbMarshalledObjectChildren(ow);
   47.98 -                } else {
   47.99 -                    ch = new GeneralChildren(ow.data);
  47.100 -                }
  47.101 -                AbstractNode n = new AbstractNode(ch);
  47.102 -                n.setName(NbBundle.getMessage(SerStructureNode.class, "LBL_instance_of", name));
  47.103 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.104 -                return n;
  47.105 -            } else if (key instanceof SerParser.ArrayWrapper) {
  47.106 -                SerParser.ArrayWrapper aw = (SerParser.ArrayWrapper)key;
  47.107 -                AbstractNode n = new AbstractNode(new GeneralChildren(aw.values));
  47.108 -                if (! aw.classdesc.name.startsWith("[")) throw new IllegalStateException("Strange array name: " + aw.classdesc.name); // NOI18N
  47.109 -                n.setName(prettify(aw.classdesc.name.substring(1, aw.classdesc.name.length())) + "[" + aw.values.size() + "]"); // NOI18N
  47.110 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.111 -                return n;
  47.112 -            } else if (key instanceof byte[]) {
  47.113 -                // Block data.
  47.114 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.115 -                n.setName(SerParser.hexify((byte[])key));
  47.116 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.117 -                return n;
  47.118 -            } else if (key instanceof SerParser.ClassDesc) {
  47.119 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.120 -                n.setName("class " + prettify(((SerParser.ClassDesc)key).name)); // NOI18N
  47.121 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.122 -                return n;
  47.123 -            } else if (key == SerParser.NULL) {
  47.124 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.125 -                n.setName("null"); // NOI18N
  47.126 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.127 -                return n;
  47.128 -            } else if (key instanceof String) {
  47.129 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.130 -                n.setName("\"" + (String)key + "\""); // NOI18N
  47.131 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.132 -                return n;
  47.133 -            } else if ((key instanceof Boolean) || (key instanceof Character) ||
  47.134 -                       (key instanceof Byte) || (key instanceof Short) ||
  47.135 -                       (key instanceof Integer) || (key instanceof Long) ||
  47.136 -                       (key instanceof Float) || (key instanceof Double)) {
  47.137 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.138 -                n.setName(key.toString());
  47.139 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.140 -                return n;
  47.141 -            } else {
  47.142 -                // ????
  47.143 -                AbstractNode n = new AbstractNode(Children.LEAF);
  47.144 -                n.setName("What is this? " + key + " [" + key.getClass().getName() + "]"); // NOI18N
  47.145 -                n.setIconBase("org/netbeans/modules/clazz/resources/serAlone"); // NOI18N
  47.146 -                return n;
  47.147 -            }
  47.148 -        }
  47.149 -    }
  47.150 -    
  47.151 -    private static String prettify(String type) {
  47.152 -        if (type.equals("B")) { // NOI18N
  47.153 -            return "byte"; // NOI18N
  47.154 -        } else if (type.equals("S")) { // NOI18N
  47.155 -            return "short"; // NOI18N
  47.156 -        } else if (type.equals("I")) { // NOI18N
  47.157 -            return "int"; // NOI18N
  47.158 -        } else if (type.equals("J")) { // NOI18N
  47.159 -            return "long"; // NOI18N
  47.160 -        } else if (type.equals("F")) { // NOI18N
  47.161 -            return "float"; // NOI18N
  47.162 -        } else if (type.equals("D")) { // NOI18N
  47.163 -            return "double"; // NOI18N
  47.164 -        } else if (type.equals("C")) { // NOI18N
  47.165 -            return "char"; // NOI18N
  47.166 -        } else if (type.equals("Z")) { // NOI18N
  47.167 -            return "boolean"; // NOI18N
  47.168 -        } else if (type.startsWith("L") && type.endsWith(";")) { // NOI18N
  47.169 -            String fqn = type.substring(1, type.length() - 1).replace('/', '.').replace('$', '.'); // NOI18N
  47.170 -            if (fqn.startsWith("java.lang.")) { // NOI18N
  47.171 -                fqn = fqn.substring(10, fqn.length());
  47.172 -            }
  47.173 -            return fqn;
  47.174 -        } else if (type.startsWith("[")) { // NOI18N
  47.175 -            return prettify(type.substring(1, type.length())) + "[]"; // NOI18N
  47.176 -        } else {
  47.177 -            // Should not happen.
  47.178 -            return "ILLEGAL<" + type + ">"; // NOI18N
  47.179 -        }
  47.180 -    }
  47.181 -    
  47.182 -    private static final class NbMarshalledObjectChildren extends Children.Keys {
  47.183 -        private final SerParser.ObjectWrapper ow;
  47.184 -        public NbMarshalledObjectChildren(SerParser.ObjectWrapper ow) {
  47.185 -            this.ow = ow;
  47.186 -        }
  47.187 -        protected void addNotify() {
  47.188 -            super.addNotify();
  47.189 -            setKeys(Collections.singleton(Boolean.TRUE));
  47.190 -        }
  47.191 -        protected void removeNotify() {
  47.192 -            setKeys(Collections.EMPTY_SET);
  47.193 -            super.removeNotify();
  47.194 -        }
  47.195 -        protected Node[] createNodes(Object key) {
  47.196 -            List pairs = ow.data;
  47.197 -            Iterator it = pairs.iterator();
  47.198 -            while (it.hasNext()) {
  47.199 -                Object pair = (Object)it.next();
  47.200 -                if (pair instanceof SerParser.NameValue) {
  47.201 -                    SerParser.NameValue nv = (SerParser.NameValue)pair;
  47.202 -                    if (nv.name.name.equals("objBytes") && nv.name.type.equals("[B")) { // NOI18N
  47.203 -                        SerParser.ArrayWrapper aw = (SerParser.ArrayWrapper)nv.value;
  47.204 -                        List vals = aw.values;
  47.205 -                        byte[] b = new byte[vals.size()];
  47.206 -                        for (int i = 0; i < b.length; i++) {
  47.207 -                            b[i] = ((Byte)vals.get(i)).byteValue();
  47.208 -                        }
  47.209 -                        InputStream is = new ByteArrayInputStream(b);
  47.210 -                        try {
  47.211 -                            SerParser.Stream stream = new SerParser(is).parse();
  47.212 -                            return new Node[] {new SerStructureNode.StreamNode(stream)};
  47.213 -                        } catch (SerParser.CorruptException spce) {
  47.214 -                            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, spce);
  47.215 -                            return new Node[] {};
  47.216 -                        } catch (IOException ioe) {
  47.217 -                            ErrorManager.getDefault().notify(ioe);
  47.218 -                            return new Node[] {};
  47.219 -                        } catch (RuntimeException re) {
  47.220 -                            ErrorManager.getDefault().notify(re);
  47.221 -                            return new Node[] {};
  47.222 -                        }
  47.223 -                    }
  47.224 -                }
  47.225 -            }
  47.226 -            // Improper ser state.
  47.227 -            return new Node[] {};
  47.228 -        }
  47.229 -    }
  47.230 -    
  47.231 -}
    48.1 --- a/clazz/src/org/netbeans/modules/clazz/SerTopChildren.java	Wed Sep 15 11:58:07 2010 +0530
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,138 +0,0 @@
    48.4 -/*
    48.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    48.6 - *
    48.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    48.8 - *
    48.9 - * The contents of this file are subject to the terms of either the GNU
   48.10 - * General Public License Version 2 only ("GPL") or the Common
   48.11 - * Development and Distribution License("CDDL") (collectively, the
   48.12 - * "License"). You may not use this file except in compliance with the
   48.13 - * License. You can obtain a copy of the License at
   48.14 - * http://www.netbeans.org/cddl-gplv2.html
   48.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   48.16 - * specific language governing permissions and limitations under the
   48.17 - * License.  When distributing the software, include this License Header
   48.18 - * Notice in each file and include the License file at
   48.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   48.20 - * particular file as subject to the "Classpath" exception as provided
   48.21 - * by Sun in the GPL Version 2 section of the License file that
   48.22 - * accompanied this code. If applicable, add the following below the
   48.23 - * License Header, with the fields enclosed by brackets [] replaced by
   48.24 - * your own identifying information:
   48.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   48.26 - *
   48.27 - * Contributor(s):
   48.28 - *
   48.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   48.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   48.31 - * Microsystems, Inc. All Rights Reserved.
   48.32 - *
   48.33 - * If you wish your version of this file to be governed by only the CDDL
   48.34 - * or only the GPL Version 2, indicate your decision by adding
   48.35 - * "[Contributor] elects to include this software in this distribution
   48.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   48.37 - * single choice of license, a recipient has the option to distribute
   48.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   48.39 - * to extend the choice of license to its licensees as provided above.
   48.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   48.41 - * Version 2 license, then the option applies only if the new code is
   48.42 - * made subject to such option by the copyright holder.
   48.43 - */
   48.44 -
   48.45 -package org.netbeans.modules.clazz;
   48.46 -
   48.47 -import java.beans.PropertyChangeEvent;
   48.48 -import java.io.*;
   48.49 -import java.util.Collections;
   48.50 -
   48.51 -import org.openide.ErrorManager;
   48.52 -import org.openide.loaders.DataObject;
   48.53 -import org.openide.nodes.*;
   48.54 -import org.openide.src.nodes.*;
   48.55 -
   48.56 -/** Children for a SerDataNode, including the SourceChildren and
   48.57 - * a node for the serialized structure.
   48.58 - * @author Jesse Glick
   48.59 - */
   48.60 -public class SerTopChildren extends Children.Keys implements NodeListener {
   48.61 -
   48.62 -    private final static Object SUPER_KEY = "sourcechildren"; // NOI18N
   48.63 -    private final static Object ADDED_KEY = "added"; // NOI18N
   48.64 -    
   48.65 -    private final DataObject obj;
   48.66 -    private final SourceChildren src;
   48.67 -    private Node dummy;
   48.68 -    
   48.69 -    public SerTopChildren(DataObject obj, SourceChildren src) {
   48.70 -        this.obj = obj;
   48.71 -        this.src = src;
   48.72 -    }
   48.73 -    
   48.74 -    public final SourceChildren getSourceChildren() {
   48.75 -        return src;
   48.76 -    }
   48.77 -    
   48.78 -    protected void addNotify() {
   48.79 -        super.addNotify();
   48.80 -        setKeys(new Object[] {SUPER_KEY, ADDED_KEY});
   48.81 -        if (dummy == null) {
   48.82 -            dummy = new AbstractNode(src);
   48.83 -        }
   48.84 -        dummy.addNodeListener(this);
   48.85 -    }
   48.86 -    
   48.87 -    protected void removeNotify() {
   48.88 -        dummy.removeNodeListener(this);
   48.89 -        setKeys(Collections.EMPTY_SET);
   48.90 -        super.removeNotify();
   48.91 -    }
   48.92 -    
   48.93 -    protected Node[] createNodes(Object key) {
   48.94 -        if (key == SUPER_KEY) {
   48.95 -            Node[] supe = src.getNodes();
   48.96 -            Node[] mine = new Node[supe.length];
   48.97 -            for (int i = 0; i < supe.length; i++) {
   48.98 -                mine[i] = supe[i].cloneNode();
   48.99 -            }
  48.100 -            return mine;
  48.101 -        } else if (key == ADDED_KEY) {
  48.102 -            try {
  48.103 -                InputStream is = obj.getPrimaryFile().getInputStream();
  48.104 -                try {
  48.105 -                    SerParser.Stream stream = new SerParser(is).parse();
  48.106 -                    return new Node[] {new SerStructureNode.StreamNode(stream)};
  48.107 -                } finally {
  48.108 -                    is.close();
  48.109 -                }
  48.110 -            } catch (SerParser.CorruptException spce) {
  48.111 -                ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, spce);
  48.112 -                return new Node[] {};
  48.113 -            } catch (IOException ioe) {
  48.114 -                ErrorManager.getDefault().notify(ioe);
  48.115 -                return new Node[] {};
  48.116 -            } catch (RuntimeException re) {
  48.117 -                ErrorManager.getDefault().notify(re);
  48.118 -                return new Node[] {};
  48.119 -            }
  48.120 -        } else {
  48.121 -            throw new IllegalStateException();
  48.122 -        }
  48.123 -    }
  48.124 -
  48.125 -    public void childrenAdded(NodeMemberEvent ev) {
  48.126 -        refreshKey(SUPER_KEY);
  48.127 -    }
  48.128 -    public void childrenRemoved(NodeMemberEvent ev) {
  48.129 -        refreshKey(SUPER_KEY);
  48.130 -    }
  48.131 -    public void childrenReordered(NodeReorderEvent ev) {
  48.132 -        refreshKey(SUPER_KEY);
  48.133 -    }
  48.134 -    public void nodeDestroyed(NodeEvent ev) {
  48.135 -        // ignore
  48.136 -    }
  48.137 -    public void propertyChange(PropertyChangeEvent evt) {
  48.138 -        // ignore
  48.139 -    }
  48.140 -    
  48.141 -}
    49.1 --- a/clazz/src/org/netbeans/modules/clazz/SourceElementImpl.java	Wed Sep 15 11:58:07 2010 +0530
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,501 +0,0 @@
    49.4 -/*
    49.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    49.6 - *
    49.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    49.8 - *
    49.9 - * The contents of this file are subject to the terms of either the GNU
   49.10 - * General Public License Version 2 only ("GPL") or the Common
   49.11 - * Development and Distribution License("CDDL") (collectively, the
   49.12 - * "License"). You may not use this file except in compliance with the
   49.13 - * License. You can obtain a copy of the License at
   49.14 - * http://www.netbeans.org/cddl-gplv2.html
   49.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   49.16 - * specific language governing permissions and limitations under the
   49.17 - * License.  When distributing the software, include this License Header
   49.18 - * Notice in each file and include the License file at
   49.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   49.20 - * particular file as subject to the "Classpath" exception as provided
   49.21 - * by Sun in the GPL Version 2 section of the License file that
   49.22 - * accompanied this code. If applicable, add the following below the
   49.23 - * License Header, with the fields enclosed by brackets [] replaced by
   49.24 - * your own identifying information:
   49.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   49.26 - *
   49.27 - * Contributor(s):
   49.28 - *
   49.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   49.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   49.31 - * Microsystems, Inc. All Rights Reserved.
   49.32 - *
   49.33 - * If you wish your version of this file to be governed by only the CDDL
   49.34 - * or only the GPL Version 2, indicate your decision by adding
   49.35 - * "[Contributor] elects to include this software in this distribution
   49.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   49.37 - * single choice of license, a recipient has the option to distribute
   49.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   49.39 - * to extend the choice of license to its licensees as provided above.
   49.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   49.41 - * Version 2 license, then the option applies only if the new code is
   49.42 - * made subject to such option by the copyright holder.
   49.43 - */
   49.44 -
   49.45 -package org.netbeans.modules.clazz;
   49.46 -
   49.47 -import java.lang.ref.SoftReference;
   49.48 -import java.util.Collections;
   49.49 -import java.util.HashMap;
   49.50 -import java.util.Iterator;
   49.51 -import java.util.Map;
   49.52 -import javax.swing.SwingUtilities;
   49.53 -import org.netbeans.api.java.classpath.ClassPath;
   49.54 -import org.netbeans.api.mdr.MDRepository;
   49.55 -import org.netbeans.jmi.javamodel.JavaClass;
   49.56 -import org.netbeans.jmi.javamodel.JavaPackage;
   49.57 -import org.netbeans.jmi.javamodel.NamedElement;
   49.58 -import org.netbeans.jmi.javamodel.Resource;
   49.59 -import org.netbeans.modules.javacore.internalapi.JavaMetamodel;
   49.60 -import org.openide.filesystems.FileObject;
   49.61 -import org.openide.loaders.DataObject;
   49.62 -import org.openide.loaders.MultiDataObject;
   49.63 -import org.openide.nodes.Node;
   49.64 -import org.openide.src.*;
   49.65 -import org.openide.util.Task;
   49.66 -import org.openide.util.TaskListener;
   49.67 -
   49.68 -/** The implementation of source element for class objects.
   49.69 -* This class is final only for performance reasons,
   49.70 -* can be happily unfinaled if desired.
   49.71 -*
   49.72 -* @author Dafe Simonek, Jan Jancura
   49.73 -*/
   49.74 -final class SourceElementImpl extends MemberElementImpl
   49.75 -    implements SourceElement.Impl, ElementProperties, TaskListener {
   49.76 -
   49.77 -    private static final Map EMPTY_MAP = Collections.unmodifiableMap(new HashMap(0));
   49.78 -    
   49.79 -    /** Empty array of imports - constant to return fro getImports() */
   49.80 -    static final Import[] EMPTY_IMPORTS = new Import[0];
   49.81 -    static final ClassElement[] NO_CLASSES = new ClassElement[0];
   49.82 -    
   49.83 -    /* Soft reference to the class element */
   49.84 -    private SoftReference topClass;
   49.85 -    /** Soft ref to the map holding all inners */
   49.86 -    private SoftReference allClasses;
   49.87 -    /** The identifier of the package of the class data */
   49.88 -    private Identifier packg;
   49.89 -    /** Association with the class data object (can be null) */
   49.90 -    private ClassDataObject cdo;
   49.91 -
   49.92 -    private ClassLoader loader;
   49.93 -    
   49.94 -    Task    loadingTask;
   49.95 -    
   49.96 -    int     status = -1;
   49.97 -    
   49.98 -    private transient boolean attached;
   49.99 -    
  49.100 -    private boolean isEmpty = false;
  49.101 -    
  49.102 -    private ClassPath classPath = null;
  49.103 -    
  49.104 -    static final long serialVersionUID =-4870331896218546842L;
  49.105 -    
  49.106 -    SourceElementImpl (ClassDataObject cdo) {
  49.107 -        this((Resource)null, cdo);
  49.108 -    }
  49.109 -        
  49.110 -    /** Creates object with asociated class and with asociated
  49.111 -    * class data object which created this source element (can be null).
  49.112 -    */
  49.113 -    public SourceElementImpl (Resource res, ClassDataObject cdo) {
  49.114 -        super(res);
  49.115 -        this.cdo = cdo;
  49.116 -        FileObject fo = cdo.getPrimaryFile();
  49.117 -        classPath = ClassPath.getClassPath(fo, ClassPath.EXECUTE); // hard reference to class path prevents unmounting of related extent
  49.118 -    }
  49.119 -
  49.120 -    public void attachedToElement (Element element) {
  49.121 -        super.attachedToElement(element);
  49.122 -        initializeData();
  49.123 -        
  49.124 -    }
  49.125 -    
  49.126 -    public void initializeData() {
  49.127 -        JavaMetamodel model = JavaMetamodel.getManager();
  49.128 -        FileObject fo = cdo.getPrimaryFile();
  49.129 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  49.130 -        repo.beginTrans(false);
  49.131 -        try {
  49.132 -            Resource resource = model.getResource(fo);
  49.133 -            if (resource == null || !resource.isValid()) {
  49.134 -                return;
  49.135 -            }
  49.136 -            data = resource;
  49.137 -            getPackage();
  49.138 -            ClassElement elem = getClassElement();
  49.139 -            if (elem!=null) {
  49.140 -                ClassElementImpl impl = (ClassElementImpl) elem.getCookie(org.openide.src.Element.Impl.class);
  49.141 -                impl.initializeData();
  49.142 -            }
  49.143 -        } finally {
  49.144 -            repo.endTrans();
  49.145 -        }
  49.146 -    }
  49.147 -    
  49.148 -    public void refreshData() {
  49.149 -        boolean fireChange = false;
  49.150 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  49.151 -        repo.beginTrans(false);
  49.152 -        try {
  49.153 -            // System.out.println("refreshing ...");
  49.154 -            Object oldData = data;
  49.155 -            
  49.156 -            FileObject fo = cdo.getPrimaryFile();
  49.157 -            data = JavaMetamodel.getManager().getResource(fo);
  49.158 -            
  49.159 -            // System.out.println("  " + (data != null ? "" + ((Resource)data).isValid() : "null") + "  eq: " + (oldData == data));
  49.160 -            
  49.161 -            if (data != null && ((Resource) data).isValid()) {
  49.162 -                // check features validity
  49.163 -//                for (Iterator iter = ((Resource) data).getClassifiers().iterator(); iter.hasNext();) {
  49.164 -//                    NamedElement cm = (NamedElement) iter.next();
  49.165 -//                    System.out.println("  " + cm.getClass().getName() + " " + cm.isValid());
  49.166 -//                }
  49.167 -                
  49.168 -                topClass = null;
  49.169 -                allClasses = null;
  49.170 -                fireChange = true;
  49.171 -                
  49.172 -                ClassElement cls = getClassElement();
  49.173 -                if (cls!=null) {
  49.174 -                    ClassElementImpl impl = (ClassElementImpl) cls.getCookie(org.openide.src.Element.Impl.class);
  49.175 -                    // System.out.println("cls impl: " + (impl != null));
  49.176 -                    if (impl != null) {
  49.177 -                        impl.refreshData();
  49.178 -                    }
  49.179 -                }
  49.180 -            }
  49.181 -        } finally {
  49.182 -            repo.endTrans();
  49.183 -        }
  49.184 -        if (fireChange) {
  49.185 -            firePropertyChange(PROP_CLASSES, null, null);
  49.186 -            firePropertyChange(PROP_ALL_CLASSES, null, null);
  49.187 -        }
  49.188 -    }
  49.189 -    
  49.190 -    public void setResource(Resource data) {
  49.191 -        int oldStatus;
  49.192 -        int newStatus;
  49.193 -
  49.194 -        synchronized (this) {
  49.195 -            oldStatus = getStatus();
  49.196 -            this.data = data;
  49.197 -            topClass = null;
  49.198 -            allClasses = null;
  49.199 -            newStatus = getStatus();
  49.200 -            loadingTask = null;
  49.201 -        }
  49.202 -        initializeData();
  49.203 -        if (oldStatus != SourceElement.STATUS_NOT) {
  49.204 -            firePropertyChange(PROP_CLASSES, null, null);
  49.205 -            firePropertyChange(PROP_ALL_CLASSES, null, null);
  49.206 -        }
  49.207 -        firePropertyChange(PROP_STATUS, new Integer(oldStatus), new Integer(newStatus));
  49.208 -    }
  49.209 -
  49.210 -    /** Not supported. Throws SourceException.
  49.211 -    */
  49.212 -    public void setPackage (Identifier id) throws SourceException {
  49.213 -        throwReadOnlyException();
  49.214 -    }
  49.215 -    
  49.216 -    Resource getResource() {
  49.217 -        checkData();
  49.218 -        return (Resource)data;
  49.219 -    }
  49.220 -
  49.221 -    /** @return The package of class which we are representing.
  49.222 -    */
  49.223 -    public Identifier getPackage () {
  49.224 -        if (packg != null)
  49.225 -            return packg;
  49.226 -        MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  49.227 -        repo.beginTrans(false);
  49.228 -        try {
  49.229 -            if ((getResource() == null) || !isValid())
  49.230 -                return null;
  49.231 -            JavaPackage p = (JavaPackage) getResource().refImmediateComposite();
  49.232 -            if (p == null)
  49.233 -                return null;
  49.234 -            return packg = Identifier.create(p.getName());
  49.235 -        } finally {
  49.236 -            repo.endTrans();
  49.237 -        }
  49.238 -    }
  49.239 -
  49.240 -    /** @return always returns empty array
  49.241 -    */
  49.242 -    public Import[] getImports () {
  49.243 -        return EMPTY_IMPORTS;
  49.244 -    }
  49.245 -
  49.246 -    /** Not supported. Throws SourceException.
  49.247 -    */
  49.248 -    public void changeImports (Import[] elems, int action) throws SourceException {
  49.249 -        throwReadOnlyException();
  49.250 -    }
  49.251 -
  49.252 -    /** Not supported. Throws SourceException.
  49.253 -    */
  49.254 -    public void changeClasses (ClassElement[] elems, int action) throws SourceException {
  49.255 -        throwReadOnlyException();
  49.256 -    }
  49.257 -
  49.258 -    /** Always returns only one class element which belongs to the
  49.259 -    * class data we were given in constructor.
  49.260 -    */
  49.261 -    public ClassElement[] getClasses () {
  49.262 -        checkData();
  49.263 -        if (data == null)
  49.264 -            return NO_CLASSES;
  49.265 -        ClassElement clsElem = getClassElement();
  49.266 -        if (clsElem == null)
  49.267 -            return NO_CLASSES;
  49.268 -        return new ClassElement[] { clsElem };
  49.269 -    }
  49.270 -
  49.271 -    /** Finds an inner class with given name.
  49.272 -    * @param name the name to look for
  49.273 -    * @return the element or null if such class does not exist
  49.274 -    */
  49.275 -    public ClassElement getClass (Identifier name) {
  49.276 -        ClassElement el = getClassElement();
  49.277 -        if (el != null) {
  49.278 -            String srcName = name.getSourceName();
  49.279 -            String fullName = name.getFullName();
  49.280 -            Identifier idEl = el.getName();
  49.281 -            String srcEl = idEl.getSourceName();
  49.282 -            String fullEl = idEl.getFullName();
  49.283 -
  49.284 -            if (srcEl.equals(srcName)) {
  49.285 -                if (srcName.equals(fullName) || fullEl.equals(fullName))
  49.286 -                    return el;
  49.287 -                else
  49.288 -                    return null;
  49.289 -            } else if (fullEl.equals(fullName)) {
  49.290 -                return el;
  49.291 -            }
  49.292 -        }
  49.293 -        return null;
  49.294 -    }
  49.295 -
  49.296 -    /** @return Top level class which we are asociated with
  49.297 -    * and all its innerclasses and innerinterfaces.
  49.298 -    */
  49.299 -    public ClassElement[] getAllClasses () {
  49.300 -        if (isEmpty) {
  49.301 -            return new ClassElement[0];
  49.302 -        }
  49.303 -        return (ClassElement[])getAllClassesMap ().values().toArray (new ClassElement[0]);
  49.304 -    }
  49.305 -
  49.306 -    /** @return Always returns STATUS_OK, 'cause we always have the class...
  49.307 -    */
  49.308 -    public int getStatus () {
  49.309 -        if (status != -1) {
  49.310 -            return status;
  49.311 -        }
  49.312 -        int s;
  49.313 -        if (data != null) {
  49.314 -            s = SourceElement.STATUS_OK;
  49.315 -        } else {
  49.316 -            Task t = prepare();
  49.317 -            if (t.isFinished()) {
  49.318 -                checkData();
  49.319 -                s = data == null ? SourceElement.STATUS_ERROR : SourceElement.STATUS_OK;
  49.320 -            } else {
  49.321 -                synchronized (this) {
  49.322 -                    if (!attached) {
  49.323 -                        attached = true;
  49.324 -                        t.addTaskListener(this);
  49.325 -                    }
  49.326 -                }
  49.327 -                s = SourceElement.STATUS_NOT;
  49.328 -            }
  49.329 -        }
  49.330 -        setStatus(s);
  49.331 -        return s;
  49.332 -    }
  49.333 -    
  49.334 -    void setStatus(int newStatus) {
  49.335 -        int old;
  49.336 -        
  49.337 -        synchronized (this) {
  49.338 -            if (status == newStatus)
  49.339 -                return;
  49.340 -            old = status;
  49.341 -            status = newStatus;
  49.342 -        }
  49.343 -        if (old != -1)
  49.344 -            firePropertyChange(ElementProperties.PROP_STATUS, new Integer(old), new Integer(newStatus));
  49.345 -    }
  49.346 -    
  49.347 -    void checkData() {
  49.348 -        if (data == null) {
  49.349 -            FileObject fo=cdo.getPrimaryFile();
  49.350 -            data=JavaMetamodel.getManager().getResource(fo);
  49.351 -        }
  49.352 -    }
  49.353 -
  49.354 -    /** Returns empty task, because we don't need any preparation.
  49.355 -    */
  49.356 -    public Task prepare() {
  49.357 -        return Task.EMPTY;
  49.358 -    }
  49.359 -    
  49.360 -    /** .class file are always read only for Java Hierarchy API
  49.361 -    */
  49.362 -    public boolean isReadOnly() {
  49.363 -	return true;
  49.364 -    }
  49.365 -
  49.366 -    /************* utility methods *********/
  49.367 -
  49.368 -    /** Returns class element for asociated class data.
  49.369 -    * Care must be taken, 'cause we are playing with soft reference.
  49.370 -    */
  49.371 -    private ClassElement getClassElement () {
  49.372 -        if (isEmpty) {
  49.373 -            return null;
  49.374 -        }
  49.375 -        ClassElement result = (topClass == null) ? null : (ClassElement)topClass.get();
  49.376 -        if (result == null) {
  49.377 -            MDRepository repo = JavaMetamodel.getManager().getDefaultRepository();
  49.378 -            repo.beginTrans(false);
  49.379 -            try {
  49.380 -                if (!isValid()) {
  49.381 -                    return null;
  49.382 -                }
  49.383 -                if (getResource() == null)
  49.384 -                    return null;
  49.385 -                JavaClass[] c = (JavaClass[])getResource().getClassifiers().toArray(new JavaClass[0]);
  49.386 -                if (c.length != 1)
  49.387 -                    return null;
  49.388 -                result = new ClassElement(new ClassElementImpl(c[0]), (SourceElement)element);
  49.389 -                topClass = new SoftReference(result);
  49.390 -            } finally {
  49.391 -                repo.endTrans();
  49.392 -            }
  49.393 -        }
  49.394 -        return result;
  49.395 -    }
  49.396 -
  49.397 -    /** Returns map with all innerclasses.
  49.398 -    * @return map with all innerclasses.
  49.399 -    */
  49.400 -    private Map getAllClassesMap () {
  49.401 -        Map allClassesMap = (allClasses == null) ? null : (Map)allClasses.get();
  49.402 -        if (allClassesMap == null) {
  49.403 -            checkData();
  49.404 -            if (data != null) {
  49.405 -                // soft ref null, we must recreate
  49.406 -                allClassesMap = createClassesMap();
  49.407 -                // remember it, please ...
  49.408 -                allClasses = new SoftReference(allClassesMap);
  49.409 -            } else {
  49.410 -                // can't really do anything - return empty map:
  49.411 -                return EMPTY_MAP;
  49.412 -            }
  49.413 -        }
  49.414 -        return allClassesMap;
  49.415 -    }
  49.416 -
  49.417 -    /** Recursively creates the map of all classes.
  49.418 -    * The entries in the map are built from
  49.419 -    * identifier - class element pairs.
  49.420 -    */
  49.421 -    private Map createClassesMap () {
  49.422 -        Map result = new HashMap(15);
  49.423 -        ClassElement clsElem = getClassElement();
  49.424 -        if (clsElem != null) {
  49.425 -            addClassElement(result, clsElem);
  49.426 -        }
  49.427 -        return result;
  49.428 -    }
  49.429 -
  49.430 -    /** Adds given class element to the output map and
  49.431 -    * recurses on its inner classes and interfaces.
  49.432 -    */
  49.433 -    private void addClassElement (Map map, final ClassElement outer) {
  49.434 -        map.put(outer.getName(), outer);
  49.435 -        // recurse on inners
  49.436 -        ClassElement[] inners = null;
  49.437 -        try {
  49.438 -            inners = outer.getClasses();
  49.439 -        } catch (Throwable exc) {
  49.440 -            // rethrow only ThreadDeath, ignore otherwise
  49.441 -            if (exc instanceof ThreadDeath)
  49.442 -                throw (ThreadDeath)exc;
  49.443 -            return;
  49.444 -        }
  49.445 -        for (int i = 0; i < inners.length; i++) {
  49.446 -            addClassElement(map, inners[i]);
  49.447 -        }
  49.448 -    }
  49.449 -
  49.450 -    /** Lock the underlaing document to have exclusive access to it and could make changes
  49.451 -    * on this SourceElement.
  49.452 -    *
  49.453 -    * @param run the action to run
  49.454 -    */
  49.455 -    public void runAtomic (Runnable run) {
  49.456 -        run.run();
  49.457 -    }
  49.458 -
  49.459 -    /** Executes given runnable in "user mode" does not allowing any modifications
  49.460 -    * to parts of text marked as guarded. The actions should be run as "atomic" so
  49.461 -    * either happen all at once or none at all (if a guarded block should be modified).
  49.462 -    *
  49.463 -    * @param run the action to run
  49.464 -    */
  49.465 -    public void runAtomicAsUser (Runnable run) {
  49.466 -        run.run();
  49.467 -    }
  49.468 -
  49.469 -    /** DataObject cookie supported.
  49.470 -    * @return data object cookie or null
  49.471 -    */
  49.472 -    public Node.Cookie getCookie (Class type) {
  49.473 -        if (type.equals(DataObject.class) || type.equals(MultiDataObject.class) ||
  49.474 -                ClassDataObject.class.isAssignableFrom(type)) {
  49.475 -            return cdo;
  49.476 -        } else if (type == SourceElement.Impl.class || type == Element.Impl.class) {
  49.477 -            return this;
  49.478 -        }
  49.479 -        return null;
  49.480 -    }
  49.481 -    
  49.482 -    public Object readResolve() {
  49.483 -        return new SourceElement(this);
  49.484 -    }
  49.485 -
  49.486 -    /**
  49.487 -     * Tries to acquire data file from the owning DataObject, and parse
  49.488 -     * it using Classfile library.
  49.489 -     */
  49.490 -    public void run() {
  49.491 -        if (cdo == null) {
  49.492 -            throw new IllegalStateException("Cannot load classfile without " // NOI18N
  49.493 -                + "the DataObject"); // NOI18N
  49.494 -        }
  49.495 -        setResource(null);
  49.496 -    }
  49.497 -    
  49.498 -    public void taskFinished(Task task) {
  49.499 -        checkData();
  49.500 -        attached = false;
  49.501 -        task.removeTaskListener(this);
  49.502 -        setStatus(data == null ? SourceElement.STATUS_ERROR : SourceElement.STATUS_OK);
  49.503 -    }
  49.504 -}
    50.1 --- a/clazz/src/org/netbeans/modules/clazz/Util.java	Wed Sep 15 11:58:07 2010 +0530
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,121 +0,0 @@
    50.4 -/*
    50.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    50.6 - *
    50.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    50.8 - *
    50.9 - * The contents of this file are subject to the terms of either the GNU
   50.10 - * General Public License Version 2 only ("GPL") or the Common
   50.11 - * Development and Distribution License("CDDL") (collectively, the
   50.12 - * "License"). You may not use this file except in compliance with the
   50.13 - * License. You can obtain a copy of the License at
   50.14 - * http://www.netbeans.org/cddl-gplv2.html
   50.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   50.16 - * specific language governing permissions and limitations under the
   50.17 - * License.  When distributing the software, include this License Header
   50.18 - * Notice in each file and include the License file at
   50.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   50.20 - * particular file as subject to the "Classpath" exception as provided
   50.21 - * by Sun in the GPL Version 2 section of the License file that
   50.22 - * accompanied this code. If applicable, add the following below the
   50.23 - * License Header, with the fields enclosed by brackets [] replaced by
   50.24 - * your own identifying information:
   50.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   50.26 - *
   50.27 - * Contributor(s):
   50.28 - *
   50.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   50.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   50.31 - * Microsystems, Inc. All Rights Reserved.
   50.32 - *
   50.33 - * If you wish your version of this file to be governed by only the CDDL
   50.34 - * or only the GPL Version 2, indicate your decision by adding
   50.35 - * "[Contributor] elects to include this software in this distribution
   50.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   50.37 - * single choice of license, a recipient has the option to distribute
   50.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   50.39 - * to extend the choice of license to its licensees as provided above.
   50.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   50.41 - * Version 2 license, then the option applies only if the new code is
   50.42 - * made subject to such option by the copyright holder.
   50.43 - */
   50.44 -
   50.45 -package org.netbeans.modules.clazz;
   50.46 -
   50.47 -import java.util.ResourceBundle;
   50.48 -import java.util.*;
   50.49 -import org.netbeans.jmi.javamodel.Array;
   50.50 -import org.netbeans.jmi.javamodel.JavaClass;
   50.51 -import org.netbeans.jmi.javamodel.PrimitiveType;
   50.52 -import org.netbeans.jmi.javamodel.PrimitiveTypeKind;
   50.53 -import org.netbeans.jmi.javamodel.PrimitiveTypeKindEnum;
   50.54 -import org.netbeans.jmi.javamodel.Resource;
   50.55 -
   50.56 -import org.openide.filesystems.Repository;
   50.57 -import org.openide.filesystems.FileSystem;
   50.58 -import org.openide.filesystems.FileObject;
   50.59 -import org.openide.filesystems.FileStateInvalidException;
   50.60 -
   50.61 -import org.openide.util.Lookup;
   50.62 -import org.openide.util.NbBundle;
   50.63 -import org.openide.util.RequestProcessor;
   50.64 -
   50.65 -import org.openide.loaders.DataObject;
   50.66 -import org.openide.loaders.DataFolder;
   50.67 -import org.openide.loaders.DataObjectNotFoundException;
   50.68 -import org.netbeans.modules.classfile.Method;
   50.69 -import org.openide.src.Type;
   50.70 -import org.openide.src.MethodParameter;
   50.71 -import org.openide.src.Identifier;
   50.72 -
   50.73 -/**
   50.74 - *
   50.75 - * @author  sdedic
   50.76 - */
   50.77 -final class Util {
   50.78 -
   50.79 -    private static RequestProcessor classProcessor;
   50.80 -        
   50.81 -    static String createClassName(String signature) {
   50.82 -        return signature.replace('/', '.').replace('$', '.');
   50.83 -    }
   50.84 -
   50.85 -    static Type createType(org.netbeans.jmi.javamodel.Type t) {
   50.86 -        if (t == null)
   50.87 -            return null;
   50.88 -        if (t instanceof Array) {
   50.89 -            return Type.createArray(createType(((Array)t).getType()));
   50.90 -        } else if (t instanceof JavaClass) {
   50.91 -            JavaClass ct=(JavaClass)t;
   50.92 -                return Type.createClass(
   50.93 -                    Identifier.create(createClassName(ct.getName())));
   50.94 -        } else if (t instanceof PrimitiveType) {
   50.95 -            PrimitiveTypeKind tag = ((PrimitiveType)t).getKind();
   50.96 -            if (tag == PrimitiveTypeKindEnum.BOOLEAN) {
   50.97 -                return Type.BOOLEAN;
   50.98 -            } else if (tag == PrimitiveTypeKindEnum.BYTE) {
   50.99 -                return Type.BYTE;
  50.100 -            } else if (tag == PrimitiveTypeKindEnum.CHAR) {
  50.101 -                return Type.CHAR;
  50.102 -            } else if (tag == PrimitiveTypeKindEnum.DOUBLE) {
  50.103 -                return Type.DOUBLE;
  50.104 -            } else if (tag == PrimitiveTypeKindEnum.FLOAT) {
  50.105 -                return Type.FLOAT;
  50.106 -            } else if (tag == PrimitiveTypeKindEnum.INT) {
  50.107 -                return Type.INT;
  50.108 -            } else if (tag == PrimitiveTypeKindEnum.LONG) {
  50.109 -                return Type.LONG;
  50.110 -            } else if (tag == PrimitiveTypeKindEnum.SHORT) {
  50.111 -                return Type.SHORT;
  50.112 -            } else if (tag == PrimitiveTypeKindEnum.VOID) {
  50.113 -                return Type.VOID;
  50.114 -            }
  50.115 -        }
  50.116 -        throw new IllegalArgumentException("Invalid TypeDescriptor: " + t); // NOI18N
  50.117 -    }
  50.118 -    
  50.119 -    static RequestProcessor getClassProcessor() {
  50.120 -        if (classProcessor==null)
  50.121 -            classProcessor=new RequestProcessor("Clazz",5); // NOI18N
  50.122 -        return classProcessor;
  50.123 -    }
  50.124 -}
    51.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/bean.gif has changed
    52.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/bean32.gif has changed
    53.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/beanMain.gif has changed
    54.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/beanMain32.gif has changed
    55.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/class.gif has changed
    56.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/class32.gif has changed
    57.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/classBr.gif has changed
    58.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/classError.gif has changed
    59.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/classError32.gif has changed
    60.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/classMain.gif has changed
    61.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/classMain32.gif has changed
    62.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/interfaceBr.gif has changed
    63.1 --- a/clazz/src/org/netbeans/modules/clazz/resources/mf-layer.xml	Wed Sep 15 11:58:07 2010 +0530
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,119 +0,0 @@
    63.4 -<?xml version="1.0" encoding="UTF-8"?>
    63.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" "http://www.netbeans.org/dtds/filesystem-1_0.dtd">
    63.6 -<!--
    63.7 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    63.8 -
    63.9 -Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
   63.10 -
   63.11 -
   63.12 -The contents of this file are subject to the terms of either the GNU
   63.13 -General Public License Version 2 only ("GPL") or the Common
   63.14 -Development and Distribution License("CDDL") (collectively, the
   63.15 -"License"). You may not use this file except in compliance with the
   63.16 -License. You can obtain a copy of the License at
   63.17 -http://www.netbeans.org/cddl-gplv2.html
   63.18 -or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   63.19 -specific language governing permissions and limitations under the
   63.20 -License.  When distributing the software, include this License Header
   63.21 -Notice in each file and include the License file at
   63.22 -nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   63.23 -particular file as subject to the "Classpath" exception as provided
   63.24 -by Sun in the GPL Version 2 section of the License file that
   63.25 -accompanied this code. If applicable, add the following below the
   63.26 -License Header, with the fields enclosed by brackets [] replaced by
   63.27 -your own identifying information:
   63.28 -"Portions Copyrighted [year] [name of copyright owner]"
   63.29 -
   63.30 -Contributor(s):
   63.31 -
   63.32 -The Original Software is NetBeans. The Initial Developer of the Original
   63.33 -Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   63.34 -Microsystems, Inc. All Rights Reserved.
   63.35 -
   63.36 -If you wish your version of this file to be governed by only the CDDL
   63.37 -or only the GPL Version 2, indicate your decision by adding
   63.38 -"[Contributor] elects to include this software in this distribution
   63.39 -under the [CDDL or GPL Version 2] license." If you do not indicate a
   63.40 -single choice of license, a recipient has the option to distribute
   63.41 -your version of this file under either the CDDL, the GPL Version 2 or
   63.42 -to extend the choice of license to its licensees as provided above.
   63.43 -However, if you add GPL Version 2 code and therefore, elected the GPL
   63.44 -Version 2 license, then the option applies only if the new code is
   63.45 -made subject to such option by the copyright holder.
   63.46 --->
   63.47 -<filesystem>
   63.48 -  <folder name="NodeFactories">
   63.49 -    <folder name="clazz">
   63.50 -        <folder name="explorer"/>
   63.51 -        <folder name="objectbrowser"/>
   63.52 -    </folder>
   63.53 -  </folder>
   63.54 -    <!--folder name="Services">
   63.55 -        <file name="ProjectModel.settings" url="../../classmodel/resources/ProjectModel.settings">
   63.56 -            <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.classmodel.Bundle"/>
   63.57 -            <attr name="SystemFileSystem.icon" urlvalue="nbres:/org/netbeans/modules/classmodel/resources/projectModelSettings.gif"/>
   63.58 -
   63.59 -            <attr name="instanceOf" stringvalue="org.netbeans.modules.classmodel.ProjectModel"/>
   63.60 -            <attr name="instanceClass" stringvalue="org.netbeans.modules.classmodel.ProjectModel"/>
   63.61 -        </file>
   63.62 -    </folder-->
   63.63 -    <folder name="Loaders">
   63.64 -        <folder name="application">
   63.65 -            <folder name="x-java-class">
   63.66 -                <folder name="Actions">
   63.67 -                    <attr boolvalue="true" name="OpenAction.instance/FileSystemAction.instance"/>
   63.68 -                    <attr boolvalue="true" name="FileSystemAction.instance/Separator0.instance"/>
   63.69 -                    <file name="CopyAction.shadow">
   63.70 -                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CopyAction.instance"/>
   63.71 -                    </file>
   63.72 -                    <file name="CutAction.shadow">
   63.73 -                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CutAction.instance"/>
   63.74 -                    </file>
   63.75 -                    <file name="DeleteAction.shadow">
   63.76 -                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-DeleteAction.instance"/>
   63.77 -                    </file>
   63.78 -                    <file name="FileSystemAction.shadow">
   63.79 -                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-FileSystemAction.instance"/>
   63.80 -                    </file>
   63.81 -                    <file name="OpenAction.shadow">
   63.82 -                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-OpenAction.instance"/>
   63.83 -                    </file>
   63.84 -                    <file name="PasteAction.shadow">
   63.85 -                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-PasteAction.instance"/>
   63.86 -                    </file>
   63.87 -                    <file name="PropertiesAction.shadow">
   63.88 -                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-PropertiesAction.instance"/>
   63.89 -                    </file>
   63.90 -                    <file name="SaveAsTemplateAction.shadow">
   63.91 -                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-SaveAsTemplateAction.instance"/>
   63.92 -                    </file>
   63.93 -                    <file name="Separator0.instance">
   63.94 -                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
   63.95 -                    </file>
   63.96 -                    <attr boolvalue="true" name="Separator0.instance/CutAction.instance"/>
   63.97 -                    <attr boolvalue="true" name="CutAction.instance/CopyAction.instance"/>
   63.98 -                    <attr boolvalue="true" name="CopyAction.instance/PasteAction.instance"/>
   63.99 -                    <attr boolvalue="true" name="PasteAction.instance/Separator1.instance"/>
  63.100 -                    <file name="Separator1.instance">
  63.101 -                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
  63.102 -                    </file>
  63.103 -                    <attr boolvalue="true" name="Separator1.instance/DeleteAction.instance"/>
  63.104 -                    <attr boolvalue="true" name="DeleteAction.instance/Separator2.instance"/>
  63.105 -                    <file name="Separator2.instance">
  63.106 -                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
  63.107 -                    </file>
  63.108 -                    <attr boolvalue="true" name="Separator2.instance/SaveAsTemplateAction.instance"/>
  63.109 -                    <attr boolvalue="true" name="SaveAsTemplateAction.instance/Separator3.instance"/>
  63.110 -                    <file name="Separator3.instance">
  63.111 -                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
  63.112 -                    </file>
  63.113 -                    <attr boolvalue="true" name="Separator3.instance/ToolsAction.instance"/>
  63.114 -                    <attr boolvalue="true" name="ToolsAction.instance/PropertiesAction.instance"/>
  63.115 -                    <file name="ToolsAction.shadow">
  63.116 -                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-ToolsAction.instance"/>
  63.117 -                    </file>
  63.118 -                </folder> <!-- Actions -->
  63.119 -            </folder> <!-- application -->
  63.120 -        </folder> <!-- x-java-class -->
  63.121 -    </folder> <!-- Loaders -->
  63.122 -</filesystem>
    64.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/ser.gif has changed
    65.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/ser32.gif has changed
    66.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/serAlone.gif has changed
    67.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/serError.gif has changed
    68.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/serError32.gif has changed
    69.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/serMain.gif has changed
    70.1 Binary file clazz/src/org/netbeans/modules/clazz/resources/serMain32.gif has changed
    71.1 --- a/clazz/sub.locale.xml	Wed Sep 15 11:58:07 2010 +0530
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,24 +0,0 @@
    71.4 -<?xml version="1.0" encoding="UTF-8" ?>
    71.5 -
    71.6 -<!-- arguments below are taken form the upper ANT task -->
    71.7 -
    71.8 -<!-- basedir == directory, where the localizable files are -->
    71.9 -<!-- destdir == directory, where will be saved final JAR file -->
   71.10 -<!-- locale  == a locale ... files with these locale will be added to the archive (JAR file) -->
   71.11 -
   71.12 -<!-- idedir  == part in the IDE, where will be stored final file -->
   71.13 -
   71.14 -
   71.15 -<project name="Sub_clazz" default="sub_clazz" basedir="${dir}">
   71.16 -
   71.17 -	<!-- setup the destination directory -->
   71.18 -	<property name="idedir" value="modules/locale" />
   71.19 -        
   71.20 -	<target name="sub_clazz">
   71.21 -                <!-- create full destination directory -->
   71.22 -                <mkdir dir="${destdir}/${idedir}" />
   71.23 -                <!-- create final jar file -->
   71.24 -                <jar jarfile="${destdir}/${idedir}/clazz_${locale}.jar" basedir="${basedir}/src" includes="**/*_${locale}.*" />
   71.25 -        </target>
   71.26 -
   71.27 -</project>
    72.1 Binary file clazz/test/qa-functional/src/org/netbeans/test/ClazzTest$InnerClass.class has changed
    73.1 Binary file clazz/test/qa-functional/src/org/netbeans/test/ClazzTest$InnerInterface.class has changed
    74.1 Binary file clazz/test/qa-functional/src/org/netbeans/test/ClazzTest.class has changed
    75.1 --- a/clazz/test/qa-functional/src/org/netbeans/test/clazz/ClazzNodeTest.java	Wed Sep 15 11:58:07 2010 +0530
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,195 +0,0 @@
    75.4 -/*
    75.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    75.6 - *
    75.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    75.8 - *
    75.9 - * The contents of this file are subject to the terms of either the GNU
   75.10 - * General Public License Version 2 only ("GPL") or the Common
   75.11 - * Development and Distribution License("CDDL") (collectively, the
   75.12 - * "License"). You may not use this file except in compliance with the
   75.13 - * License. You can obtain a copy of the License at
   75.14 - * http://www.netbeans.org/cddl-gplv2.html
   75.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   75.16 - * specific language governing permissions and limitations under the
   75.17 - * License.  When distributing the software, include this License Header
   75.18 - * Notice in each file and include the License file at
   75.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   75.20 - * particular file as subject to the "Classpath" exception as provided
   75.21 - * by Sun in the GPL Version 2 section of the License file that
   75.22 - * accompanied this code. If applicable, add the following below the
   75.23 - * License Header, with the fields enclosed by brackets [] replaced by
   75.24 - * your own identifying information:
   75.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   75.26 - *
   75.27 - * Contributor(s):
   75.28 - *
   75.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   75.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   75.31 - * Microsystems, Inc. All Rights Reserved.
   75.32 - *
   75.33 - * If you wish your version of this file to be governed by only the CDDL
   75.34 - * or only the GPL Version 2, indicate your decision by adding
   75.35 - * "[Contributor] elects to include this software in this distribution
   75.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   75.37 - * single choice of license, a recipient has the option to distribute
   75.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   75.39 - * to extend the choice of license to its licensees as provided above.
   75.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   75.41 - * Version 2 license, then the option applies only if the new code is
   75.42 - * made subject to such option by the copyright holder.
   75.43 - */
   75.44 -
   75.45 -package org.netbeans.test.clazz;
   75.46 -
   75.47 -import java.io.IOException;
   75.48 -import junit.textui.TestRunner;
   75.49 -import org.netbeans.jellytools.Bundle;
   75.50 -import org.netbeans.jellytools.JellyTestCase;
   75.51 -import org.netbeans.jellytools.NbDialogOperator;
   75.52 -import org.netbeans.jellytools.RepositoryTabOperator;
   75.53 -import org.netbeans.jellytools.nodes.FolderNode;
   75.54 -import org.netbeans.jellytools.nodes.JavaNode;
   75.55 -import org.netbeans.jemmy.EventTool;
   75.56 -import org.netbeans.junit.NbTestSuite;
   75.57 -import org.openide.filesystems.FileObject;
   75.58 -import org.openide.filesystems.Repository;
   75.59 -import org.openide.loaders.DataFolder;
   75.60 -import org.openide.loaders.DataObject;
   75.61 -
   75.62 - 
   75.63 -public class ClazzNodeTest extends JellyTestCase {
   75.64 -    
   75.65 -    private static final String NAME_TEST_FILE = "ClazzTest"; //NOI18N
   75.66 -    private static final String SRC_PACKAGE = "org.netbeans.test"; //NOI18N
   75.67 -    private static final String DST_PACKAGE = "org.netbeans.test.clazz"; //NOI18N
   75.68 -    
   75.69 -    private DataObject srcFile;
   75.70 -    private DataFolder srcFolder;
   75.71 -    private String testFSName;
   75.72 -    
   75.73 -    {
   75.74 -        try {
   75.75 -            srcFolder = DataFolder.findFolder(Repository.getDefault().findResource(SRC_PACKAGE.replace('.','/')));
   75.76 -            testFSName = Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/')).getFileSystem().getDisplayName();
   75.77 -        }
   75.78 -        catch (Exception e) {
   75.79 -            e.printStackTrace();
   75.80 -        }
   75.81 -        
   75.82 -    } 
   75.83 -    
   75.84 -    /** Need to be defined because of JUnit */
   75.85 -    public ClazzNodeTest(String name) {
   75.86 -        super(name);
   75.87 -    }
   75.88 -    
   75.89 -    public static NbTestSuite suite() {
   75.90 -        NbTestSuite suite = new NbTestSuite();
   75.91 -        suite.addTest(new ClazzNodeTest("testCopyPasteCopy")); //NOI18N
   75.92 -        suite.addTest(new ClazzNodeTest("testCopyPasteCreateLink")); //NOI18N
   75.93 -        suite.addTest(new ClazzNodeTest("testCopyPasteSerialize")); //NOI18N
   75.94 -        suite.addTest(new ClazzNodeTest("testCopyPasteDefaultInstance")); //NOI18N
   75.95 -        suite.addTest(new ClazzNodeTest("testCutPasteCopy")); //NOI18N
   75.96 -        return suite;
   75.97 -    }
   75.98 -    
   75.99 -    /** Use for execution inside IDE */
  75.100 -    public static void main(java.lang.String[] args) {
  75.101 -        // run whole suite
  75.102 -        TestRunner.run(suite());
  75.103 -        // run only selected test case
  75.104 -        //junit.textui.TestRunner.run(new BeansTemplates("testJavaBean"));
  75.105 -    }
  75.106 -    
  75.107 -    public void setUp() {
  75.108 -        System.out.println("########  "+getName()+"  #######"); //NOI18N
  75.109 -        RepositoryTabOperator.invoke();
  75.110 -    }
  75.111 -    
  75.112 -    public void testCopyPasteCopy() {
  75.113 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.114 -        srcNode.copy();
  75.115 -        
  75.116 -        FolderNode dstNode = new FolderNode(testFSName + '|' + DST_PACKAGE.replace('.', '|'));
  75.117 -        dstNode.pasteCopy();
  75.118 -        new EventTool().waitNoEvent(1000);
  75.119 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".class")); //NOI18N 
  75.120 -        
  75.121 -        delete(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".class"); //NOI18N
  75.122 -    }
  75.123 -    
  75.124 -    public void testCopyPasteCreateLink() {
  75.125 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.126 -        srcNode.copy();
  75.127 -        
  75.128 -        FolderNode dstNode = new FolderNode(testFSName + "|" + DST_PACKAGE.replace('.', '|'));
  75.129 -        dstNode.pasteLink();
  75.130 -        new EventTool().waitNoEvent(1000);
  75.131 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".shadow")); //NOI18N
  75.132 -        
  75.133 -        delete(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".shadow"); //NOI18N
  75.134 -    }
  75.135 -    
  75.136 -    public void testCopyPasteSerialize() {
  75.137 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.138 -        srcNode.copy();
  75.139 -        
  75.140 -        FolderNode dstNode = new FolderNode(testFSName + '|' + DST_PACKAGE.replace('.', '|'));
  75.141 -        dstNode.performPopupActionNoBlock(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste") + '|' + Bundle.getStringTrimmed("org.openide.loaders.Bundle", "CTL_Serialize"));
  75.142 -        new NbDialogOperator(Bundle.getString("org.openide.loaders.Bundle", "SerializeBean_Title")).ok();
  75.143 -        
  75.144 -        new EventTool().waitNoEvent(1000);
  75.145 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".ser")); //NOI18N
  75.146 -        
  75.147 -        delete(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".ser"); //NOI18N
  75.148 -    }
  75.149 -    
  75.150 -    public void testCopyPasteDefaultInstance() {
  75.151 -        System.out.println("YYYY ->" + testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.152 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.153 -        srcNode.copy();
  75.154 -        
  75.155 -        FolderNode dstNode = new FolderNode(testFSName + '|' + DST_PACKAGE.replace('.', '|'));
  75.156 -        dstNode.performPopupActionNoBlock(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste") + '|' + Bundle.getStringTrimmed("org.openide.loaders.Bundle", "PT_instance"));
  75.157 -        
  75.158 -        new EventTool().waitNoEvent(1000);
  75.159 -        System.out.println("XXX ->" + DST_PACKAGE.replace('.', '/') + '/' + SRC_PACKAGE.replace('.', '-') + '-' + NAME_TEST_FILE + ".instance"); //NOI18N
  75.160 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + SRC_PACKAGE.replace('.', '-') + '-' + NAME_TEST_FILE + ".instance")); //NOI18N
  75.161 -        
  75.162 -        delete(DST_PACKAGE.replace('.', '/') + '/' + SRC_PACKAGE.replace('.', '-') + '-' + NAME_TEST_FILE + ".instance"); //NOI18N
  75.163 -    }
  75.164 -    
  75.165 -    public void testCutPasteCopy() {
  75.166 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.167 -        srcNode.cut();
  75.168 -        new EventTool().waitNoEvent(1000);
  75.169 -        FolderNode dstNode = new FolderNode(testFSName + "|" + DST_PACKAGE.replace('.', '|'));
  75.170 -        System.out.println("AAAAAA");
  75.171 -        dstNode.performPopupAction(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste"));
  75.172 -        System.out.println("BBBBBB");
  75.173 -        srcNode.waitNotPresent();
  75.174 -        new EventTool().waitNoEvent(1000);
  75.175 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".class")); //NOI18N
  75.176 -        assertNull(Repository.getDefault().findResource(SRC_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".class")); //NOI18N
  75.177 -        new EventTool().waitNoEvent(1000);
  75.178 -        srcNode = new JavaNode(testFSName + '|' + DST_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  75.179 -        srcNode.cut();
  75.180 -        new EventTool().waitNoEvent(1000);
  75.181 -        dstNode = new FolderNode(testFSName + "|" + SRC_PACKAGE.replace('.', '|'));
  75.182 -        dstNode.select();
  75.183 -        new EventTool().waitNoEvent(1000);
  75.184 -//        dstNode.performPopupActionNoBlock(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste"));
  75.185 -        dstNode.performPopupAction(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste"));
  75.186 -        srcNode.waitNotPresent();
  75.187 -        new EventTool().waitNoEvent(1000);
  75.188 -    }
  75.189 -
  75.190 -    public static void delete(String file) {
  75.191 -        FileObject fileObject = Repository.getDefault().findResource(file);
  75.192 -        if (fileObject==null) return;
  75.193 -        try {
  75.194 -            DataObject.find(fileObject).delete();
  75.195 -        } catch (IOException e) {
  75.196 -        }
  75.197 -    }
  75.198 -}
    76.1 --- a/clazz/test/qa-functional/src/org/netbeans/test/clazz/ElementRecognitionTest.java	Wed Sep 15 11:58:07 2010 +0530
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,233 +0,0 @@
    76.4 -/*
    76.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    76.6 - *
    76.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    76.8 - *
    76.9 - * The contents of this file are subject to the terms of either the GNU
   76.10 - * General Public License Version 2 only ("GPL") or the Common
   76.11 - * Development and Distribution License("CDDL") (collectively, the
   76.12 - * "License"). You may not use this file except in compliance with the
   76.13 - * License. You can obtain a copy of the License at
   76.14 - * http://www.netbeans.org/cddl-gplv2.html
   76.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   76.16 - * specific language governing permissions and limitations under the
   76.17 - * License.  When distributing the software, include this License Header
   76.18 - * Notice in each file and include the License file at
   76.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   76.20 - * particular file as subject to the "Classpath" exception as provided
   76.21 - * by Sun in the GPL Version 2 section of the License file that
   76.22 - * accompanied this code. If applicable, add the following below the
   76.23 - * License Header, with the fields enclosed by brackets [] replaced by
   76.24 - * your own identifying information:
   76.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   76.26 - *
   76.27 - * Contributor(s):
   76.28 - *
   76.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   76.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   76.31 - * Microsystems, Inc. All Rights Reserved.
   76.32 - *
   76.33 - * If you wish your version of this file to be governed by only the CDDL
   76.34 - * or only the GPL Version 2, indicate your decision by adding
   76.35 - * "[Contributor] elects to include this software in this distribution
   76.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   76.37 - * single choice of license, a recipient has the option to distribute
   76.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   76.39 - * to extend the choice of license to its licensees as provided above.
   76.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   76.41 - * Version 2 license, then the option applies only if the new code is
   76.42 - * made subject to such option by the copyright holder.
   76.43 - */
   76.44 -
   76.45 -/*
   76.46 - * ElementRecognitionTest.java
   76.47 - *
   76.48 - * Created on March 26, 2002, 4:22 PM
   76.49 - */
   76.50 -
   76.51 -package org.netbeans.test.clazz;
   76.52 -
   76.53 -import org.netbeans.junit.NbTestCase;
   76.54 -import org.openide.src.*;
   76.55 -import org.netbeans.junit.NbTest;
   76.56 -import org.netbeans.junit.NbTestSuite;
   76.57 -import java.lang.reflect.Modifier;
   76.58 -
   76.59 -/**
   76.60 - *
   76.61 - * @author  jb105785
   76.62 - */
   76.63 -public class ElementRecognitionTest extends NbTestCase {
   76.64 -
   76.65 -    ClassElement clazz;
   76.66 -    public ElementRecognitionTest() {
   76.67 -        super("");
   76.68 -    }
   76.69 -
   76.70 -    public ElementRecognitionTest(java.lang.String testName) {
   76.71 -        super(testName);
   76.72 -    }
   76.73 -    
   76.74 -    public static NbTest suite() {
   76.75 -        return new NbTestSuite(ElementRecognitionTest.class);
   76.76 -    }
   76.77 -
   76.78 -    public static void main(java.lang.String[] args) {
   76.79 -        junit.textui.TestRunner.run(suite());
   76.80 -    }
   76.81 -    
   76.82 -    public void setUp() throws Exception {
   76.83 -        super.setUp();
   76.84 -        clazz = ClassElement.forName("org.netbeans.test.ClazzTest");
   76.85 -        assertNotNull(clazz);
   76.86 -    }
   76.87 -    
   76.88 -    public void testClass() {
   76.89 -        assertEquals(clazz.getName().getName(), "ClazzTest");
   76.90 -        assertEquals(clazz.getName().getFullName(), "org.netbeans.test.ClazzTest");
   76.91 -        assertEquals(clazz.getSuperclass().getFullName(), "javax.swing.JPanel");
   76.92 -        assertEquals(clazz.getInterfaces().length, 0);
   76.93 -        
   76.94 -        assertEquals(clazz.getModifiers(), Modifier.PUBLIC);
   76.95 -    }
   76.96 -    
   76.97 -    public void testInnerClasses() {
   76.98 -        ClassElement inner = clazz.getClass(Identifier.create("InnerClass"));
   76.99 -        
  76.100 -        assertNotNull(inner);
  76.101 -        assertEquals(inner.getName().getName(), "InnerClass");
  76.102 -        assertEquals(inner.getName().getFullName(), "org.netbeans.test.ClazzTest.InnerClass");
  76.103 -        assertEquals("InnerClass should be public static!", inner.getModifiers(), Modifier.PUBLIC | Modifier.STATIC );
  76.104 -    }
  76.105 -    
  76.106 -    public void testInnerInterfaces() {
  76.107 -        ClassElement inner = clazz.getClass(Identifier.create("InnerInterface"));
  76.108 -        
  76.109 -        assertNotNull(inner);
  76.110 -        assertEquals(inner.getName().getName(), "InnerInterface");
  76.111 -        assertEquals(inner.getName().getFullName(), "org.netbeans.test.ClazzTest.InnerInterface");
  76.112 -        assertEquals(inner.getModifiers(), Modifier.PUBLIC | Modifier.ABSTRACT | Modifier.STATIC );
  76.113 -    }
  76.114 -
  76.115 -    public void testMethods() {
  76.116 -        assertEquals(clazz.getMethods().length, 4);
  76.117 -    }
  76.118 -        
  76.119 -    public void testMethodInitComponents() {
  76.120 -        MethodElement method = clazz.getMethod(Identifier.create("initComponents"), new Type[]{});
  76.121 -        
  76.122 -        assertNotNull(method);
  76.123 -        assertEquals(method.getName().getName(), "initComponents");
  76.124 -        assertEquals(method.getName().getFullName(), "initComponents");
  76.125 -        assertEquals(method.getModifiers(), Modifier.PRIVATE);
  76.126 -        assertEquals(method.getReturn(), Type.VOID);
  76.127 -        assertEquals(method.getParameters().length, 0);
  76.128 -        assertEquals(method.getExceptions().length, 0);
  76.129 -    }
  76.130 -
  76.131 -    public void testMethodIsOk() {
  76.132 -        MethodElement method = clazz.getMethod(Identifier.create("isOk"), new Type[]{});
  76.133 -        
  76.134 -        assertNotNull(method);
  76.135 -        assertEquals(method.getName().getName(), "isOk");
  76.136 -        assertEquals(method.getName().getFullName(), "isOk");
  76.137 -        assertEquals(method.getModifiers(), Modifier.PUBLIC);
  76.138 -        assertEquals(method.getReturn(), Type.BOOLEAN);
  76.139 -        assertEquals(method.getParameters().length, 0);
  76.140 -        assertEquals(method.getExceptions().length, 0);
  76.141 -        
  76.142 -    }
  76.143 -
  76.144 -    public void testMethodSetOk() {
  76.145 -        MethodElement method = clazz.getMethod(Identifier.create("setOk"), new Type[]{Type.BOOLEAN});
  76.146 -        
  76.147 -        assertNotNull(method);
  76.148 -        assertEquals(method.getName().getName(), "setOk");
  76.149 -        assertEquals(method.getName().getFullName(), "setOk");
  76.150 -        assertEquals(method.getModifiers(), Modifier.PUBLIC);
  76.151 -        assertEquals(method.getReturn(), Type.VOID);
  76.152 -        assertEquals(method.getParameters()[0], new MethodParameter(null, Type.BOOLEAN, false));
  76.153 -        assertEquals(method.getExceptions().length, 0);
  76.154 -    }
  76.155 -
  76.156 -    public void testMethodTestMethod() throws IllegalArgumentException {
  76.157 -        MethodElement method = clazz.getMethod(Identifier.create("testMethod"), new Type[]{Type.parse("java.lang.String")});
  76.158 -        
  76.159 -        assertNotNull(method);
  76.160 -        assertEquals(method.getName().getName(), "testMethod");
  76.161 -        assertEquals(method.getName().getFullName(), "testMethod");
  76.162 -        assertEquals(method.getModifiers(), Modifier.STATIC | Modifier.PROTECTED);
  76.163 -        assertEquals(method.getReturn(), Type.VOID);
  76.164 -        assertEquals(method.getParameters()[0], new MethodParameter(null, Type.parse("java.lang.String"), false));
  76.165 -        assertEquals(method.getExceptions()[0], Identifier.create("java.io.IOException"));
  76.166 -    }
  76.167 -    
  76.168 -    public void testFields() {
  76.169 -        assertEquals(clazz.getFields().length, 3);
  76.170 -    }
  76.171 -    
  76.172 -    public void testFieldCONSTANT() {
  76.173 -        FieldElement field = clazz.getField(Identifier.create("CONSTANT"));
  76.174 -        
  76.175 -        assertNotNull(field);
  76.176 -        assertEquals(field.getName().getName(), "CONSTANT");
  76.177 -        assertEquals(field.getName().getFullName(), "CONSTANT");
  76.178 -        assertEquals(field.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
  76.179 -        assertEquals(field.getType(), Type.CHAR);
  76.180 -        assertEquals(field.getInitValue(), "");
  76.181 -    }
  76.182 -    
  76.183 -    public void testFieldTestField() {
  76.184 -        FieldElement field = clazz.getField(Identifier.create("testField"));
  76.185 -        
  76.186 -        assertNotNull(field);
  76.187 -        assertEquals(field.getName().getName(), "testField");
  76.188 -        assertEquals(field.getName().getFullName(), "testField");
  76.189 -        assertEquals(field.getModifiers(), Modifier.PRIVATE);
  76.190 -        assertEquals(field.getType(), Type.parse("java.lang.Object"));
  76.191 -        assertEquals(field.getInitValue(),"");
  76.192 -    }
  76.193 -    
  76.194 -    public void testFieldOk() {
  76.195 -        FieldElement field = clazz.getField(Identifier.create("ok"));
  76.196 -        
  76.197 -        assertNotNull(field);
  76.198 -        assertEquals(field.getName().getName(), "ok");
  76.199 -        assertEquals(field.getName().getFullName(), "ok");
  76.200 -        assertEquals(field.getModifiers(), Modifier.PRIVATE);
  76.201 -        assertEquals(field.getType(), Type.BOOLEAN);
  76.202 -        assertEquals(field.getInitValue(), "");
  76.203 -    }
  76.204 -    
  76.205 -    public void testConstructors() {
  76.206 -        assertEquals(clazz.getConstructors().length, 2);
  76.207 -    }
  76.208 -
  76.209 -     public void testConstructorDefault() {
  76.210 -        ConstructorElement constr = clazz.getConstructor(new Type[]{});
  76.211 -        
  76.212 -        assertNotNull(constr);
  76.213 -        assertEquals(constr.getName().getName(), "ClazzTest");
  76.214 -        assertEquals(constr.getName().getFullName(), "ClazzTest");
  76.215 -        assertEquals(constr.getModifiers(), Modifier.PUBLIC);
  76.216 -        assertEquals(constr.getParameters().length, 0);
  76.217 -        assertEquals(constr.getExceptions().length, 0);
  76.218 -    }
  76.219 -
  76.220 -    public void testConstructorString() {
  76.221 -        ConstructorElement constr = clazz.getConstructor(new Type[]{Type.parse("java.lang.String")});
  76.222 -        
  76.223 -        assertNotNull(constr);
  76.224 -        assertEquals(constr.getName().getName(), "ClazzTest");
  76.225 -        assertEquals(constr.getName().getFullName(), "ClazzTest");
  76.226 -        assertEquals(constr.getModifiers(), Modifier.PUBLIC);
  76.227 -        assertEquals(constr.getParameters()[0], new MethodParameter(null, Type.parse("java.lang.String"), true));
  76.228 -        assertEquals(constr.getExceptions()[0], Identifier.create("java.io.IOException"));
  76.229 -    }
  76.230 -
  76.231 -    
  76.232 -    
  76.233 -    
  76.234 -    
  76.235 -    
  76.236 -}
    77.1 --- a/clazz/test/qa-functional/src/org/netbeans/test/clazz/SerNodeTest.java	Wed Sep 15 11:58:07 2010 +0530
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,189 +0,0 @@
    77.4 -/*
    77.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    77.6 - *
    77.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    77.8 - *
    77.9 - * The contents of this file are subject to the terms of either the GNU
   77.10 - * General Public License Version 2 only ("GPL") or the Common
   77.11 - * Development and Distribution License("CDDL") (collectively, the
   77.12 - * "License"). You may not use this file except in compliance with the
   77.13 - * License. You can obtain a copy of the License at
   77.14 - * http://www.netbeans.org/cddl-gplv2.html
   77.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   77.16 - * specific language governing permissions and limitations under the
   77.17 - * License.  When distributing the software, include this License Header
   77.18 - * Notice in each file and include the License file at
   77.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   77.20 - * particular file as subject to the "Classpath" exception as provided
   77.21 - * by Sun in the GPL Version 2 section of the License file that
   77.22 - * accompanied this code. If applicable, add the following below the
   77.23 - * License Header, with the fields enclosed by brackets [] replaced by
   77.24 - * your own identifying information:
   77.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   77.26 - *
   77.27 - * Contributor(s):
   77.28 - *
   77.29 - * The Original Software is NetBeans. The Initial Developer of the Original
   77.30 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
   77.31 - * Microsystems, Inc. All Rights Reserved.
   77.32 - *
   77.33 - * If you wish your version of this file to be governed by only the CDDL
   77.34 - * or only the GPL Version 2, indicate your decision by adding
   77.35 - * "[Contributor] elects to include this software in this distribution
   77.36 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   77.37 - * single choice of license, a recipient has the option to distribute
   77.38 - * your version of this file under either the CDDL, the GPL Version 2 or
   77.39 - * to extend the choice of license to its licensees as provided above.
   77.40 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   77.41 - * Version 2 license, then the option applies only if the new code is
   77.42 - * made subject to such option by the copyright holder.
   77.43 - */
   77.44 -
   77.45 -package org.netbeans.test.clazz;
   77.46 -
   77.47 -import junit.textui.TestRunner;
   77.48 -import org.netbeans.jellytools.Bundle;
   77.49 -import org.netbeans.jellytools.JellyTestCase;
   77.50 -import org.netbeans.jellytools.NbDialogOperator;
   77.51 -import org.netbeans.jellytools.RepositoryTabOperator;
   77.52 -import org.netbeans.jellytools.nodes.FolderNode;
   77.53 -import org.netbeans.jellytools.nodes.JavaNode;
   77.54 -import org.netbeans.jellytools.nodes.Node;
   77.55 -import org.netbeans.jemmy.EventTool;
   77.56 -import org.netbeans.junit.NbTestSuite;
   77.57 -import org.openide.filesystems.Repository;
   77.58 -import org.openide.loaders.DataFolder;
   77.59 -import org.openide.loaders.DataObject;
   77.60 -
   77.61 - 
   77.62 -public class SerNodeTest extends JellyTestCase {
   77.63 -    
   77.64 -    private static final String NAME_TEST_FILE = "ClazzTest"; //NOI18N
   77.65 -    private static final String SRC_PACKAGE = "org.netbeans.test"; //NOI18N
   77.66 -    private static final String DST_PACKAGE = "org.netbeans.test.clazz"; //NOI18N
   77.67 -    
   77.68 -    private DataObject srcFile;
   77.69 -    private DataFolder srcFolder;
   77.70 -    private String testFSName;
   77.71 -    
   77.72 -    {
   77.73 -        try {
   77.74 -            srcFolder = DataFolder.findFolder(Repository.getDefault().findResource(SRC_PACKAGE.replace('.','/')));
   77.75 -            testFSName = Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/')).getFileSystem().getDisplayName();
   77.76 -        }
   77.77 -        catch (Exception e) {
   77.78 -            e.printStackTrace();
   77.79 -        }
   77.80 -        
   77.81 -    } 
   77.82 -    
   77.83 -    /** Need to be defined because of JUnit */
   77.84 -    public SerNodeTest(String name) {
   77.85 -        super(name);
   77.86 -    }
   77.87 -    
   77.88 -    public static NbTestSuite suite() {
   77.89 -        NbTestSuite suite = new NbTestSuite();
   77.90 -        suite.addTest(new SerNodeTest("testTree")); //NOI18N
   77.91 -        return suite;
   77.92 -    }
   77.93 -    
   77.94 -    /** Use for execution inside IDE */
   77.95 -    public static void main(java.lang.String[] args) {
   77.96 -        // run whole suite
   77.97 -        TestRunner.run(suite());
   77.98 -        // run only selected test case
   77.99 -        //junit.textui.TestRunner.run(new BeansTemplates("testJavaBean"));
  77.100 -    }
  77.101 -    
  77.102 -    /** setUp method  */
  77.103 -    public void setUp() {
  77.104 -        System.out.println("########  "+getName()+"  #######"); //NOI18N
  77.105 -        RepositoryTabOperator.invoke();
  77.106 -    }
  77.107 -    
  77.108 -    /** tearDown method */
  77.109 -    public void tearDown() {
  77.110 -        deleteSer();
  77.111 -    }
  77.112 -    
  77.113 -    private void createSer() {
  77.114 -        JavaNode srcNode = new JavaNode(testFSName + '|' + SRC_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE);
  77.115 -        srcNode.copy();
  77.116 -        
  77.117 -        FolderNode dstNode = new FolderNode(testFSName + '|' + DST_PACKAGE.replace('.', '|'));
  77.118 -        dstNode.performPopupActionNoBlock(Bundle.getStringTrimmed("org.openide.actions.Bundle", "Paste") + '|' + Bundle.getString("org.openide.loaders.Bundle", "CTL_Serialize"));
  77.119 -        new NbDialogOperator(Bundle.getString("org.openide.loaders.Bundle", "SerializeBean_Title")).ok();
  77.120 -        
  77.121 -        new EventTool().waitNoEvent(1000);
  77.122 -        assertNotNull(Repository.getDefault().findResource(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".ser")); //NOI18N
  77.123 -        
  77.124 -    }
  77.125 -    
  77.126 -    private void deleteSer() {
  77.127 -        ClazzNodeTest.delete(DST_PACKAGE.replace('.', '/') + '/' + NAME_TEST_FILE + ".ser"); //NOI18N
  77.128 -    }
  77.129 -    
  77.130 -    public void testTree() {
  77.131 -        createSer();
  77.132 -        workaround();
  77.133 -        dumpNode(new JavaNode(testFSName + '|' + DST_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE), 3);
  77.134 -        compareReferenceFiles();
  77.135 -       
  77.136 -    }
  77.137 -    
  77.138 -    private void workaround() {
  77.139 -        String patterns = Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"); 
  77.140 -        new JavaNode(testFSName + '|' + DST_PACKAGE.replace('.', '|') + '|' + NAME_TEST_FILE + "|class " + NAME_TEST_FILE + "|" + patterns + "|ok").select();
  77.141 -    }
  77.142 -    
  77.143 -    private int tab = -1;
  77.144 -    
  77.145 -    private void writeTabs() {
  77.146 -        int i=0;
  77.147 -        while (i++<tab)
  77.148 -            getRef().print("  ");
  77.149 -    }
  77.150 -    
  77.151 -    private void dumpNode(Node node, int limit) {
  77.152 -        tab++;
  77.153 -        writeTabs();
  77.154 -
  77.155 -        String text = node.getText();
  77.156 -        if (text.startsWith("String country") || text.startsWith("String language")){
  77.157 -            tab--;
  77.158 -            return;
  77.159 -        }
  77.160 -        
  77.161 -        if (isLeaf(node) || tab > limit) {
  77.162 -            getRef().println("<" + text + "/>");
  77.163 -            tab--;
  77.164 -            return;
  77.165 -        }
  77.166 -        
  77.167 -        node.expand();
  77.168 -        node.waitExpanded();
  77.169 -        String[] names = node.getChildren();
  77.170 -
  77.171 -        getRef().println("<" + text + ">");
  77.172 -        
  77.173 -        for (int i=0; i<names.length; i++) {
  77.174 -            dumpNode(new JavaNode(node.getPath() + "|" + names[i]), limit);
  77.175 -        }
  77.176 -
  77.177 -        writeTabs();
  77.178 -        
  77.179 -        int stop = text.indexOf(' ');
  77.180 -        if (stop > 0)
  77.181 -            text = text.substring(0,stop);
  77.182 -              
  77.183 -        getRef().println("</" + text + ">");
  77.184 -        
  77.185 -        tab--;
  77.186 -    }
  77.187 -    
  77.188 -    private static boolean isLeaf(Node node) {
  77.189 -        return ((org.openide.nodes.Node) node.getOpenideNode()).isLeaf();
  77.190 -    }
  77.191 -        
  77.192 -}
    78.1 --- a/clazz/test/qa-functional/src/org/netbeans/test/clazz/data/goldenfiles/SerNodeTest/testTree.pass	Wed Sep 15 11:58:07 2010 +0530
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,148 +0,0 @@
    78.4 -<ClazzTest>
    78.5 -  <class ClazzTest>
    78.6 -    <Fields>
    78.7 -      <CONSTANT/>
    78.8 -      <ok/>
    78.9 -      <testField/>
   78.10 -    </Fields>
   78.11 -    <Constructors>
   78.12 -      <ClazzTest(String)/>
   78.13 -      <ClazzTest()/>
   78.14 -    </Constructors>
   78.15 -    <Methods>
   78.16 -      <initComponents/>
   78.17 -      <isOk/>
   78.18 -      <setOk/>
   78.19 -      <testMethod/>
   78.20 -    </Methods>
   78.21 -    <Bean Patterns>
   78.22 -      <ok/>
   78.23 -    </Bean>
   78.24 -  </class>
   78.25 -  <Serialized stream>
   78.26 -    <instance of org.netbeans.test.ClazzTest>
   78.27 -      <int componentSerializedDataVersion = 4/>
   78.28 -      <boolean enabled = true/>
   78.29 -      <long eventMask = 4104/>
   78.30 -      <boolean focusTraversalKeysEnabled = true/>
   78.31 -      <boolean focusable = true/>
   78.32 -      <int height = 0/>
   78.33 -      <boolean ignoreRepaint = false/>
   78.34 -      <int isFocusTraversableOverridden = 0/>
   78.35 -      <boolean isPacked = false/>
   78.36 -      <boolean nameExplicitlySet = false/>
   78.37 -      <boolean newEventsOnly = true/>
   78.38 -      <boolean valid = false/>
   78.39 -      <boolean visible = true/>
   78.40 -      <int width = 0/>
   78.41 -      <int x = 0/>
   78.42 -      <int y = 0/>
   78.43 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
   78.44 -      <java.awt.Color background = instance of javax.swing.plaf.ColorUIResource>
   78.45 -        <float falpha = 0.0/>
   78.46 -        <int value = -3355444/>
   78.47 -        <java.awt.color.ColorSpace cs = null/>
   78.48 -        <float[] frgbvalue = null/>
   78.49 -        <float[] fvalue = null/>
   78.50 -      </java.awt.Color>
   78.51 -      <java.beans.PropertyChangeSupport changeSupport = null/>
   78.52 -      <java.awt.Cursor cursor = null/>
   78.53 -      <java.awt.dnd.DropTarget dropTarget = null/>
   78.54 -      <java.util.Set[] focusTraversalKeys = null/>
   78.55 -      <java.awt.Font font = instance of javax.swing.plaf.FontUIResource>
   78.56 -        <int fontSerializedDataVersion = 1/>
   78.57 -        <float pointSize = 11.0/>
   78.58 -        <int size = 11/>
   78.59 -        <int style = 0/>
   78.60 -        <java.util.Hashtable fRequestedAttributes = instance of java.util.Hashtable/>
   78.61 -        <String name = "Dialog"/>
   78.62 -      </java.awt.Font>
   78.63 -      <java.awt.Color foreground = instance of javax.swing.plaf.ColorUIResource>
   78.64 -        <float falpha = 0.0/>
   78.65 -        <int value = -16777216/>
   78.66 -        <java.awt.color.ColorSpace cs = null/>
   78.67 -        <float[] frgbvalue = null/>
   78.68 -        <float[] fvalue = null/>
   78.69 -      </java.awt.Color>
   78.70 -      <java.util.Locale locale = instance of java.util.Locale>
   78.71 -        <int hashcode = -1/>
   78.72 -                        <String variant = ""/>
   78.73 -      </java.util.Locale>
   78.74 -      <java.awt.Dimension minSize = null/>
   78.75 -      <String name = null/>
   78.76 -      <java.awt.Font peerFont = null/>
   78.77 -      <java.util.Vector popups = null/>
   78.78 -      <java.awt.Dimension prefSize = null/>
   78.79 -      <"focusL"/>
   78.80 -      <instance of javax.swing.JComponent.EnableSerializationFocusListener>
   78.81 -        <javax.swing.JComponent this$0 = instance of org.netbeans.test.ClazzTest/>
   78.82 -      </instance>
   78.83 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
   78.84 -      <instance of java.awt.ComponentOrientation>
   78.85 -        <int orientation = 7/>
   78.86 -      </instance>
   78.87 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
   78.88 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
   78.89 -      <int containerSerializedDataVersion = 1/>
   78.90 -      <boolean focusCycleRoot = false/>
   78.91 -      <int ncomponents = 0/>
   78.92 -      <java.awt.Component[] component = java.awt.Component[0]>
   78.93 -      </java.awt.Component[]>
   78.94 -      <java.awt.LightweightDispatcher dispatcher = null/>
   78.95 -      <java.awt.LayoutManager layoutMgr = instance of java.awt.BorderLayout>
   78.96 -        <int hgap = 0/>
   78.97 -        <int vgap = 0/>
   78.98 -        <java.awt.Component center = null/>
   78.99 -        <java.awt.Component east = null/>
  78.100 -        <java.awt.Component firstItem = null/>
  78.101 -        <java.awt.Component firstLine = null/>
  78.102 -        <java.awt.Component lastItem = null/>
  78.103 -        <java.awt.Component lastLine = null/>
  78.104 -        <java.awt.Component north = null/>
  78.105 -        <java.awt.Component south = null/>
  78.106 -        <java.awt.Component west = null/>
  78.107 -      </java.awt.LayoutManager>
  78.108 -      <java.awt.Dimension maxSize = null/>
  78.109 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
  78.110 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
  78.111 -      <int flags = 16393/>
  78.112 -      <boolean verifyInputWhenFocusTarget = true/>
  78.113 -      <java.awt.Rectangle _bounds = instance of java.awt.Rectangle>
  78.114 -        <int height = 0/>
  78.115 -        <int width = 0/>
  78.116 -        <int x = 0/>
  78.117 -        <int y = 0/>
  78.118 -      </java.awt.Rectangle>
  78.119 -      <javax.accessibility.AccessibleContext accessibleContext = null/>
  78.120 -      <javax.swing.ActionMap actionMap = null/>
  78.121 -      <Float alignmentX = null/>
  78.122 -      <Float alignmentY = null/>
  78.123 -      <javax.swing.InputMap ancestorInputMap = null/>
  78.124 -      <javax.swing.AncestorNotifier ancestorNotifier = null/>
  78.125 -      <javax.swing.Autoscroller autoscroller = null/>
  78.126 -      <javax.swing.border.Border border = null/>
  78.127 -      <javax.swing.event.SwingPropertyChangeSupport changeSupport = null/>
  78.128 -      <java.util.Hashtable clientProperties = null/>
  78.129 -      <javax.swing.InputMap focusInputMap = null/>
  78.130 -      <Object htmlView = null/>
  78.131 -      <javax.swing.InputVerifier inputVerifier = null/>
  78.132 -      <javax.swing.event.EventListenerList listenerList = instance of javax.swing.event.EventListenerList>
  78.133 -        <null/>
  78.134 -      </javax.swing.event.EventListenerList>
  78.135 -      <java.awt.Dimension maximumSize = null/>
  78.136 -      <java.awt.Dimension minimumSize = null/>
  78.137 -      <java.awt.Rectangle paintImmediatelyClip = instance of java.awt.Rectangle>
  78.138 -        <int height = 0/>
  78.139 -        <int width = 0/>
  78.140 -        <int x = 0/>
  78.141 -        <int y = 0/>
  78.142 -      </java.awt.Rectangle>
  78.143 -      <java.awt.Dimension preferredSize = null/>
  78.144 -      <javax.swing.TransferHandler transfer = null/>
  78.145 -      <java.beans.VetoableChangeSupport vetoableChangeSupport = null/>
  78.146 -      <javax.swing.ComponentInputMap windowInputMap = null/>
  78.147 -      <boolean ok = false/>
  78.148 -      <Object testField = null/>
  78.149 -    </instance>
  78.150 -  </Serialized>
  78.151 -</ClazzTest>