Revision 44437 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/TableRowsOperations.java
TableRowsOperations.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.app.extension; |
25 | 25 |
|
26 |
import javax.swing.JOptionPane; |
|
27 | 26 |
|
28 | 27 |
import org.gvsig.andami.IconThemeHelper; |
29 | 28 |
import org.gvsig.andami.PluginServices; |
30 |
import org.gvsig.andami.messages.NotificationManager; |
|
31 | 29 |
import org.gvsig.andami.plugins.Extension; |
32 | 30 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
33 |
import org.gvsig.app.ApplicationLocator; |
|
34 | 31 |
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel; |
35 | 32 |
import org.gvsig.fmap.dal.exception.DataException; |
36 | 33 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
37 |
import org.gvsig.i18n.Messages;
|
|
34 |
import org.gvsig.fmap.dal.feature.FeatureType;
|
|
38 | 35 |
|
39 | 36 |
public class TableRowsOperations extends Extension { |
40 | 37 |
|
38 |
@Override |
|
41 | 39 |
public void initialize() { |
42 | 40 |
registerIcons(); |
43 | 41 |
} |
... | ... | |
48 | 46 |
IconThemeHelper.registerIcon("action", "selection-reverse", this); |
49 | 47 |
} |
50 | 48 |
|
49 |
@Override |
|
51 | 50 |
public void execute(String actionCommand) { |
52 | 51 |
FeatureTableDocumentPanel tableDocument = getTableDocument(); |
53 | 52 |
if (actionCommand.equalsIgnoreCase("selection-disable-move-up") ) { |
... | ... | |
83 | 82 |
FeatureStore fs = getTableDocument().getModel().getStore(); |
84 | 83 |
fs.getFeatureSelection().reverse(); |
85 | 84 |
} catch (DataException e) { |
86 |
e.printStackTrace(); |
|
87 |
NotificationManager.addError(e); |
|
85 |
logger.warn("Can't invert selecction", e); |
|
88 | 86 |
} |
89 | 87 |
} |
90 | 88 |
|
91 |
// private void showsSelectedRows(FeatureTableDocumentPanel table) { |
|
92 |
// table.setSelectionUp(true); |
|
93 |
// } |
|
94 |
|
|
89 |
@Override |
|
95 | 90 |
public boolean isEnabled() { |
96 |
return getTableDocument() != null; |
|
91 |
FeatureTableDocumentPanel panel = getTableDocument(); |
|
92 |
if( panel == null ) { |
|
93 |
return false; |
|
94 |
} |
|
95 |
FeatureStore store = panel.getFeatureStore(); |
|
96 |
try { |
|
97 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
98 |
return false; |
|
99 |
} |
|
100 |
} catch (Exception ex) { |
|
101 |
} |
|
102 |
|
|
103 |
return true; |
|
97 | 104 |
} |
98 | 105 |
|
106 |
@Override |
|
99 | 107 |
public boolean isVisible() { |
100 | 108 |
return getTableDocument() != null; |
101 | 109 |
} |
... | ... | |
114 | 122 |
try { |
115 | 123 |
return !tabledoc.getModel().getStore() |
116 | 124 |
.getFeatureSelection().isEmpty(); |
117 |
} catch (DataException e) {
|
|
118 |
NotificationManager.addError(e);
|
|
125 |
} catch (Exception e) { |
|
126 |
logger.warn("Can't check if table has a selecction", e);
|
|
119 | 127 |
} |
120 | 128 |
} |
121 | 129 |
return false; |
Also available in: Unified diff