01: /*
02: * ResetHighlightAction.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 javax.swing.event.TableModelEvent;
16: import javax.swing.event.TableModelListener;
17: import workbench.gui.components.WbTable;
18: import workbench.resource.ResourceMgr;
19:
20: /**
21: * Reset the filter defined on a WbTable
22: * @author support@sql-workbench.net
23: */
24: public class ResetHighlightAction extends WbAction implements
25: TableModelListener {
26: private WbTable client;
27:
28: public ResetHighlightAction(WbTable aClient) {
29: super ();
30: this .initMenuDefinition("MnuTxtResetHighlight");
31: this .setClient(aClient);
32: this .setMenuItemName(ResourceMgr.MNU_TXT_DATA);
33: this .setCreateToolbarSeparator(false);
34: this .setEnabled(false);
35: }
36:
37: public void executeAction(ActionEvent e) {
38: this .client.clearHighlightExpression();
39: }
40:
41: public void tableChanged(TableModelEvent tableModelEvent) {
42: this .setEnabled(this .client.isHighlightEnabled());
43: }
44:
45: public void setClient(WbTable c) {
46: if (this.client != null) {
47: this.client.removeTableModelListener(this);
48: }
49: this.client = c;
50: if (this.client != null) {
51: this.client.addTableModelListener(this);
52: }
53: }
54:
55: }
|