|
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-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.db.explorer; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collection; import java.util.Comparator; import java.util.ResourceBundle; import java.util.TreeSet; import java.util.Vector; import org.openide.nodes.AbstractNode; import org.openide.nodes.Node; import org.openide.nodes.Children; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; import org.netbeans.modules.db.DatabaseException; import org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo; import org.netbeans.modules.db.explorer.nodes.DatabaseNode; //import org.openide.util.Mutex; // XXX This entire class is junk. Should have a sensible data model independent of // nodes and display it using Children.Keys (or Looks) and everything would be // much easier. -jglick // I totally agree. It was planed to redesign the module and base it on a data model // unfortunately this project was cancelled. Radko public class DatabaseNodeChildren extends Children.Array { private ResourceBundle bundle = NbBundle.getBundle("org.netbeans.modules.db.resources.Bundle"); //NOI18N private TreeSet children; private transient PropertyChangeSupport propertySupport = new PropertyChangeSupport(this); private static Object sync = new Object(); // synchronizing object private PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals("finished")) { //NOI18N // Mutex.EVENT.writeAccess(new Runnable() { // public void run() { remove(getNodes()); //remove wait node nodes = getCh(); // change children ... refresh(); // ... and refresh them removeListener(); // } // }); } } }; protected Collection initCollection() { propertySupport.addPropertyChangeListener(listener); RequestProcessor.getDefault().post(new Runnable() { public void run () { DatabaseNodeInfo nodeinfo = ((DatabaseNode)getNode()).getInfo(); java.util.Map nodeord = (java.util.Map)nodeinfo.get(DatabaseNodeInfo.CHILDREN_ORDERING); boolean sort = nodeinfo.getName().equals("Drivers") ? false : true; //NOI18N TreeSet children = new TreeSet(new NodeComparator(nodeord, sort)); try { Vector chlist; synchronized (sync) { chlist = nodeinfo.getChildren(); } for (int i=0;i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.