Revision 26053 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableRowsOperations.java
TableRowsOperations.java | ||
---|---|---|
16 | 16 |
* @author Vicente Caballero Navarro |
17 | 17 |
*/ |
18 | 18 |
public class TableRowsOperations extends Extension { |
19 |
/** |
|
19 |
private FeatureTableDocumentPanel table; |
|
20 |
/** |
|
20 | 21 |
* DOCUMENT ME! |
21 | 22 |
*/ |
22 | 23 |
public void initialize() { |
... | ... | |
41 | 42 |
* @param actionCommand DOCUMENT ME! |
42 | 43 |
*/ |
43 | 44 |
public void execute(String actionCommand) { |
44 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
45 |
|
|
46 |
if (v != null) { |
|
47 |
if (v.getClass() == FeatureTableDocumentPanel.class) { |
|
48 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v; |
|
49 |
if (actionCommand.compareTo("SELECTIONUP") == 0) { |
|
50 |
showsSelectedRows(table); |
|
51 |
} |
|
52 |
if (actionCommand.compareTo("INVERTSELECTION") == 0) { |
|
53 |
invertSelection(table); |
|
54 |
} |
|
55 |
table.getModel().setModified(true); |
|
56 |
} |
|
57 |
} |
|
45 |
if (actionCommand.compareTo("SELECTIONUP") == 0) { |
|
46 |
showsSelectedRows(table); |
|
47 |
} |
|
48 |
if (actionCommand.compareTo("INVERTSELECTION") == 0) { |
|
49 |
invertSelection(table); |
|
50 |
} |
|
51 |
table.getModel().setModified(true); |
|
58 | 52 |
} |
59 | 53 |
|
60 | 54 |
/** |
... | ... | |
105 | 99 |
* |
106 | 100 |
* @return DOCUMENT ME! |
107 | 101 |
*/ |
108 |
public boolean isEnabled() { |
|
109 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
102 |
public boolean isEnabled() { |
|
103 |
try { |
|
104 |
return !table.getModel().getStore().getFeatureSelection().isEmpty(); |
|
105 |
} catch (DataException e) { |
|
106 |
NotificationManager.addError(e); |
|
107 |
} |
|
110 | 108 |
|
111 |
if (v == null) { |
|
112 |
return false; |
|
113 |
} |
|
109 |
return false; |
|
110 |
} |
|
114 | 111 |
|
115 |
if (v.getClass() == FeatureTableDocumentPanel.class) { |
|
116 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v; |
|
117 |
|
|
118 |
try { |
|
119 |
return !table.getModel().getStore().getFeatureSelection().isEmpty(); |
|
120 |
} catch (DataException e) { |
|
121 |
NotificationManager.addError(e); |
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
return false; |
|
126 |
} |
|
127 |
|
|
128 | 112 |
// protected boolean doIsEnabled(Table table) { |
129 | 113 |
// try { |
130 | 114 |
// BitSet indices = table.getSelectedFieldIndices(); |
... | ... | |
158 | 142 |
*/ |
159 | 143 |
public boolean isVisible() { |
160 | 144 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
161 |
|
|
162 |
if (v == null) {
|
|
163 |
return false;
|
|
145 |
if (v != null && v instanceof FeatureTableDocumentPanel) { |
|
146 |
table=(FeatureTableDocumentPanel)v;
|
|
147 |
return true;
|
|
164 | 148 |
} |
165 | 149 |
|
166 |
if (v instanceof FeatureTableDocumentPanel) { |
|
167 |
return true; |
|
168 |
} |
|
169 |
|
|
170 | 150 |
return false; |
171 | 151 |
} |
172 | 152 |
} |
Also available in: Unified diff