|
What this is
Other links
The source code/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
/*
* MyListener.java
*
* Created on September 8, 2000, 11:35 AM
*/
package org.netbeans.test.java.eventfiring;
import org.openide.nodes.Node.Handle;
/**
*
* @author jbecicka
* @version
*/
public class MyListener extends org.openide.nodes.AbstractNode implements org.openide.cookies.ConnectionCookie.Listener {
public static final String RESULT_KEY = "ResultKey";
static MyListener me = null;
public MyListener(){
super(org.openide.nodes.Children.LEAF);
getCookieSet().add(this);
me=this;
}
public void notify (org.openide.cookies.ConnectionCookie.Event ev) {
System.setProperty(RESULT_KEY,System.getProperty(RESULT_KEY)+"\nJavaConnection: "+getTextFromType(ev.getType()));
}
public Handle getHandle() {
return new org.netbeans.test.java.eventfiring.MyListener.NodeHandle();
}
// Note that this class should be static and is serializable:
private static class NodeHandle implements Handle {
public NodeHandle () {
}
public org.openide.nodes.Node getNode() throws java.io.IOException {
if (me!=null) return me;
else return new MyListener ();
}
}
String getTextFromType(org.openide.cookies.ConnectionCookie.Type type){
int jct = ((org.netbeans.modules.java.JavaConnections.Type) type).getFilter();
String result="";
for (int i=1,j=0; i<=0x200000; i<<=1,j++){
result+=(i&jct)!=0?tab[j]:"";
}
return result;
}
String[] tab= {
" TYPE_FIELDS_ADD",
" TYPE_FIELDS_REMOVE",
" TYPE_FIELDS_CHANGE",
"",
" TYPE_METHODS_ADD",
" TYPE_METHODS_REMOVE",
" TYPE_METHODS_CHANGE",
"",
" TYPE_CLASSES_ADD",
" TYPE_CLASSES_REMOVE",
" TYPE_CLASSES_CHANGE",
"",
" TYPE_CONSTRUCTORS_ADD",
" TYPE_CONSTRUCTORS_REMOVE",
" TYPE_CONSTRUCTORS_CHANGE",
"",
" TYPE_INITIALIZERS_ADD",
" TYPE_INITIALIZERS_REMOVE",
" TYPE_INITIALIZERS_CHANGE",
};
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.