X-Git-Url: http://secure.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java index 4b42669..6396940 100644 --- a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java @@ -57,6 +57,7 @@ public class Bookmark implements Displayable { private boolean promptForPassword = false; private boolean autoCommit = true; private String autoCommitPreference = IQuantumConstants.autoCommitTrue; + private Database database; public Bookmark() { this(MultiSQLServer.getInstance()); @@ -239,7 +240,7 @@ public class Bookmark implements Displayable { this.connection = connection; } - public void disconnect() throws ConnectionException { + public void disconnect() throws SQLException { boolean isConnected = isConnected(); try { if (this.connection != null) { @@ -247,6 +248,7 @@ public class Bookmark implements Displayable { } } finally { this.connection = null; + this.database = null; if (isConnected() != isConnected) { this.propertyChangeSupport.firePropertyChange( "connected", isConnected, isConnected()); @@ -354,15 +356,15 @@ public class Bookmark implements Displayable { this.propertyChangeSupport.removePropertyChangeListener(listener); } - public void addQuickListEntry(String type, String schemaName, String name) { - Entity entity = EntityFactory.getInstance().create(this, schemaName, name, type); + public void addQuickListEntry(String type, String schemaName, String name, boolean isSynonym) { + Entity entity = EntityFactory.getInstance().create(this, schemaName, name, type, isSynonym); this.quickList.put(entity.getQualifiedName(), entity); this.propertyChangeSupport.firePropertyChange("quickList", null, null); this.changed = true; } public void addQuickListEntry(Entity entity) { - addQuickListEntry(entity.getType(), entity.getSchema(), entity.getName()); + addQuickListEntry(entity.getType(), entity.getSchema(), entity.getName(), entity.isSynonym()); } public void removeQuickListEntry(Entity entity) { @@ -398,7 +400,10 @@ public class Bookmark implements Displayable { if (!isConnected()) { throw new NotConnectedException(); } - return new Database(this); + if (this.database == null) { + this.database = new Database(this); + } + return this.database; } public DatabaseAdapter getAdapter() { @@ -545,4 +550,14 @@ public class Bookmark implements Displayable { public String getDisplayName() { return this.name; } + + /** + * @param query + */ + public void removeQuery(String query) { + if (this.queries.remove(query)) { + this.propertyChangeSupport.firePropertyChange("queries", null, null); + this.changed = true; + } + } }