01: /*
02: * ClearCompletionCacheAction.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.actions;
13:
14: import java.awt.event.ActionEvent;
15: import workbench.db.WbConnection;
16: import workbench.resource.ResourceMgr;
17:
18: /**
19: * Action to clear the cache for code completion
20: *
21: * @see workbench.db.DbObjectCache
22: * @author support@sql-workbench.net
23: */
24: public class ClearCompletionCacheAction extends WbAction {
25: private WbConnection dbConnection;
26:
27: public ClearCompletionCacheAction() {
28: this .initMenuDefinition("MnuTxtClearCompletionCache");
29: this .setMenuItemName(ResourceMgr.MNU_TXT_SQL);
30: this .setEnabled(false);
31: }
32:
33: public void setConnection(WbConnection conn) {
34: this .dbConnection = conn;
35: this .setEnabled(this .dbConnection != null);
36: }
37:
38: public void executeAction(ActionEvent e) {
39: if (this.dbConnection != null)
40: this.dbConnection.getObjectCache().clear();
41: }
42: }
|