Index: manifest.mf =================================================================== RCS file: /cvs/db/manifest.mf,v retrieving revision 1.61.2.1 diff -u -r1.61.2.1 manifest.mf --- manifest.mf 26 Oct 2005 11:55:41 -0000 1.61.2.1 +++ manifest.mf 3 Apr 2006 14:22:15 -0000 @@ -1,8 +1,7 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.db/0 OpenIDE-Module-Install: org/netbeans/modules/db/DatabaseModule.class -OpenIDE-Module-Implementation-Version: 3 +OpenIDE-Module-Implementation-Version: 4 OpenIDE-Module-Layer: org/netbeans/modules/db/resources/mf-layer.xml OpenIDE-Module-Requires: org.netbeans.api.javahelp.Help, org.openide.windows.IOProvider OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/db/resources/Bundle.properties - Index: src/org/netbeans/modules/db/explorer/DbMetaDataListener.java =================================================================== RCS file: src/org/netbeans/modules/db/explorer/DbMetaDataListener.java diff -N src/org/netbeans/modules/db/explorer/DbMetaDataListener.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/db/explorer/DbMetaDataListener.java 3 Apr 2006 14:22:15 -0000 @@ -0,0 +1,27 @@ +/* + * 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-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.db.explorer; + +import org.netbeans.api.db.explorer.DatabaseConnection; + +/** + * + * @author Andrei Badea + */ +public interface DbMetaDataListener { + + void tablesChanged(DatabaseConnection dbconn); + + void tableChanged(DatabaseConnection dbconn, String tableName); +} Index: src/org/netbeans/modules/db/explorer/DbMetaDataListenerSupport.java =================================================================== RCS file: src/org/netbeans/modules/db/explorer/DbMetaDataListenerSupport.java diff -N src/org/netbeans/modules/db/explorer/DbMetaDataListenerSupport.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/modules/db/explorer/DbMetaDataListenerSupport.java 3 Apr 2006 14:22:15 -0000 @@ -0,0 +1,42 @@ +/* + * 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-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.db.explorer; + +import java.util.Iterator; +import org.netbeans.api.db.explorer.DatabaseConnection; +import org.openide.util.Lookup; + +/** + * + * @author Andrei Badea + */ +public class DbMetaDataListenerSupport { + + private static final Lookup.Result listeners = Lookup.getDefault().lookup(new Lookup.Template(DbMetaDataListener.class)); + + private DbMetaDataListenerSupport() { + } + + public static void fireTablesChanged(DatabaseConnection dbconn) { + for (Iterator i = listeners.allInstances().iterator(); i.hasNext();) { + ((DbMetaDataListener)i.next()).tablesChanged(dbconn); + } + } + + public static void fireTableChanged(DatabaseConnection dbconn, String tableName) { + for (Iterator i = listeners.allInstances().iterator(); i.hasNext();) { + ((DbMetaDataListener)i.next()).tableChanged(dbconn, tableName); + } + } +} Index: src/org/netbeans/modules/db/explorer/infos/ColumnNodeInfo.java =================================================================== RCS file: /cvs/db/src/org/netbeans/modules/db/explorer/infos/ColumnNodeInfo.java,v retrieving revision 1.34 diff -u -r1.34 ColumnNodeInfo.java --- src/org/netbeans/modules/db/explorer/infos/ColumnNodeInfo.java 17 Aug 2005 16:32:04 -0000 1.34 +++ src/org/netbeans/modules/db/explorer/infos/ColumnNodeInfo.java 3 Apr 2006 14:22:15 -0000 @@ -68,8 +68,10 @@ cmd.removeColumn((String) get(code)); cmd.setObjectOwner((String) get(DatabaseNodeInfo.SCHEMA)); cmd.execute(); + // refresh list of columns after column drop //getParent().refreshChildren(); + fireRefresh(); //} catch(DatabaseException exc) { //String message = MessageFormat.format(bundle.getString("ERR_UnableToDeleteColumn"), new String[] {exc.getMessage()}); // NOI18N //Topmanager.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.ERROR_MESSAGE)); Index: src/org/netbeans/modules/db/explorer/infos/DatabaseNodeInfo.java =================================================================== RCS file: /cvs/db/src/org/netbeans/modules/db/explorer/infos/DatabaseNodeInfo.java,v retrieving revision 1.50.2.1 diff -u -r1.50.2.1 DatabaseNodeInfo.java --- src/org/netbeans/modules/db/explorer/infos/DatabaseNodeInfo.java 18 Jan 2006 18:57:56 -0000 1.50.2.1 +++ src/org/netbeans/modules/db/explorer/infos/DatabaseNodeInfo.java 3 Apr 2006 14:22:15 -0000 @@ -32,9 +32,11 @@ import org.netbeans.lib.ddl.impl.DriverSpecification; import org.netbeans.lib.ddl.util.PListReader; import org.netbeans.api.db.explorer.DatabaseException; +import org.netbeans.modules.db.explorer.ConnectionList; import org.netbeans.modules.db.explorer.DatabaseConnection; import org.netbeans.modules.db.explorer.DatabaseDriver; import org.netbeans.modules.db.explorer.DatabaseNodeChildren; +import org.netbeans.modules.db.explorer.DbMetaDataListenerSupport; import org.netbeans.modules.db.explorer.actions.DatabaseAction; import org.netbeans.modules.db.explorer.nodes.DatabaseNode; import org.netbeans.modules.db.explorer.nodes.RootNode; @@ -356,10 +358,38 @@ children.add(subTreeNodes); } }); + + fireRefresh(); } catch (ClassCastException ex) { //PENDING } catch (Exception ex) { org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ex); + } + } + + protected void fireRefresh() { + boolean allTables = true; + + if (!(this instanceof TableListNodeInfo)) { + allTables = false; + if (!(this instanceof TableNodeInfo)) { + return; + } + } + + ConnectionNodeInfo cnnfo = (ConnectionNodeInfo)getParent(DatabaseNode.CONNECTION); + if (cnnfo == null) { + return; + } + + DatabaseConnection dbconn = ConnectionList.getDefault().getConnection(cnnfo.getDatabaseConnection()); + if (dbconn != null) { + if (allTables) { + DbMetaDataListenerSupport.fireTablesChanged(dbconn.getDatabaseConnection()); + } else { + String tableName = (String)get(DatabaseNode.TABLE); + DbMetaDataListenerSupport.fireTableChanged(dbconn.getDatabaseConnection(), tableName); + } } } Index: src/org/netbeans/modules/db/explorer/infos/TableNodeInfo.java =================================================================== RCS file: /cvs/db/src/org/netbeans/modules/db/explorer/infos/TableNodeInfo.java,v retrieving revision 1.39.2.1 diff -u -r1.39.2.1 TableNodeInfo.java --- src/org/netbeans/modules/db/explorer/infos/TableNodeInfo.java 18 Jan 2006 18:57:58 -0000 1.39.2.1 +++ src/org/netbeans/modules/db/explorer/infos/TableNodeInfo.java 3 Apr 2006 14:22:15 -0000 @@ -227,6 +227,8 @@ // add built sub-tree children.add(subTreeNodes); + + fireRefresh(); } catch (Exception ex) { org.openide.ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ex); } @@ -238,6 +240,8 @@ AbstractCommand cmd = spec.createCommandDropTable(getTable()); cmd.setObjectOwner((String)get(DatabaseNodeInfo.SCHEMA)); cmd.execute(); + + fireRefresh(); } catch (Exception e) { org.openide.DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(e.getMessage(), NotifyDescriptor.ERROR_MESSAGE)); }