Revision 44616 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/TableEditChangeColumnsExtension.java
TableEditChangeColumnsExtension.java | ||
---|---|---|
31 | 31 |
import org.gvsig.app.project.documents.table.TableDocument; |
32 | 32 |
import org.gvsig.app.project.documents.table.TableManager; |
33 | 33 |
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel; |
34 |
import org.gvsig.fmap.dal.DataStoreProviderFactory; |
|
34 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
|
35 | 38 |
|
36 | 39 |
/** |
37 | 40 |
* DOCUMENT ME! |
38 |
*
|
|
41 |
* |
|
39 | 42 |
* @author Vicente Caballero Navarro |
40 | 43 |
*/ |
41 | 44 |
public class TableEditChangeColumnsExtension extends AbstractTableEditExtension { |
42 | 45 |
|
43 |
public void initialize() { |
|
44 |
super.initialize(); |
|
45 |
IconThemeHelper.registerIcon("action", "table-rename-column", this); |
|
46 |
IconThemeHelper.registerIcon("action", "table-remove-column", this); |
|
47 |
} |
|
46 |
public void initialize() { |
|
47 |
super.initialize(); |
|
48 |
IconThemeHelper.registerIcon("action", "table-rename-column", this); |
|
49 |
IconThemeHelper.registerIcon("action", "table-remove-column", this); |
|
50 |
} |
|
51 |
|
|
48 | 52 |
/** |
49 | 53 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String) |
50 | 54 |
*/ |
... | ... | |
53 | 57 |
featureTableOperations.setTablePanel(table); |
54 | 58 |
if ("table-remove-column".equals(actionCommand)) { |
55 | 59 |
featureTableOperations.deleteAttributes(table.getTablePanel() |
56 |
.getTable()); |
|
57 |
} else |
|
58 |
if ("table-rename-column".equals(actionCommand)) { |
|
59 |
featureTableOperations.renameAttributes(table |
|
60 |
.getTablePanel().getTable()); |
|
61 |
} |
|
60 |
.getTable()); |
|
61 |
} else if ("table-rename-column".equals(actionCommand)) { |
|
62 |
featureTableOperations.renameAttributes(table |
|
63 |
.getTablePanel().getTable()); |
|
64 |
} |
|
62 | 65 |
} catch (DataException e) { |
63 | 66 |
NotificationManager.showMessageError( |
64 |
PluginServices.getText(this, "update_featuretype_error"), null); |
|
67 |
PluginServices.getText(this, "update_featuretype_error"), null);
|
|
65 | 68 |
} |
66 | 69 |
|
67 | 70 |
} |
68 | 71 |
|
69 |
@Override
|
|
72 |
@Override |
|
70 | 73 |
public boolean isEnabled() { |
71 | 74 |
try { |
75 |
FeatureStore store = table.getFeatureStore(); |
|
76 |
|
|
77 |
DataStoreProviderFactory factory = store.getProviderFactory(); |
|
78 |
if (factory instanceof FeatureStoreProviderFactory) { |
|
79 |
FeatureStoreProviderFactory ffactory = (FeatureStoreProviderFactory) factory; |
|
80 |
if (ffactory.allowEditableFeatureType() == FeatureStoreProviderFactory.NO) { |
|
81 |
return false; |
|
82 |
} |
|
83 |
} |
|
72 | 84 |
if (table.getTablePanel().getTable().getSelectedColumnCount() > 0) { |
73 | 85 |
return true; |
74 | 86 |
} |
... | ... | |
82 | 94 |
public boolean isVisible() { |
83 | 95 |
ApplicationManager application = ApplicationLocator.getManager(); |
84 | 96 |
TableDocument tableDoc = (TableDocument) application.getActiveDocument(TableManager.TYPENAME); |
85 |
if( tableDoc == null ) {
|
|
97 |
if (tableDoc == null) {
|
|
86 | 98 |
return false; |
87 | 99 |
} |
88 | 100 |
this.table = (FeatureTableDocumentPanel) tableDoc.getMainComponent(); |
89 | 101 |
return true; |
90 | 102 |
} |
91 |
|
|
92 |
|
|
103 |
|
|
93 | 104 |
} |
Also available in: Unified diff