Revision 41013

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text.properties
45 45
_No_repetitions_found=No se han encontrado repeticiones
46 46
_Found_N_diff_repeated_vals_in_total_N_cases=Se han encontrado {0} valores diferentes repetidos en un total de {1} casos.
47 47
_Invalid_expression=Expresi?n no v?lida
48
_There_are_no_selected_rows=No hay filas seleccionadas
48 49

  
49 50

  
50 51

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
45 45
_No_repetitions_found=No repetitions found
46 46
_Found_N_diff_repeated_vals_in_total_N_cases=Found {0} different repeated values in {1} cases in total.
47 47
_Invalid_expression=Invalid expression
48
_There_are_no_selected_rows=There are no selected rows
48 49

  
49 50

  
50 51

  
51 52

  
52 53

  
53 54

  
54

  
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
23 23
 */
24 24
package org.gvsig.app.extension;
25 25

  
26
import javax.swing.JOptionPane;
27

  
26 28
import org.gvsig.andami.IconThemeHelper;
27 29
import org.gvsig.andami.PluginServices;
28 30
import org.gvsig.andami.messages.NotificationManager;
29 31
import org.gvsig.andami.plugins.Extension;
30 32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.app.ApplicationLocator;
31 34
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel;
32 35
import org.gvsig.fmap.dal.exception.DataException;
33 36
import org.gvsig.fmap.dal.feature.FeatureStore;
37
import org.gvsig.i18n.Messages;
34 38

  
35 39
public class TableRowsOperations extends Extension {
36 40

  
......
46 50
    public void execute(String actionCommand) {
47 51
        FeatureTableDocumentPanel tableDocument = getTableDocument();
48 52
        if (actionCommand.equalsIgnoreCase("selection-move-up") ) {
49
            showsSelectedRows(tableDocument);
53
            if (thereIsSelection(tableDocument)) {
54
                showsSelectedRows(tableDocument);
55
                tableDocument.getModel().setModified(true);
56
            } else {
57
                JOptionPane.showMessageDialog(
58
                    ApplicationLocator.getManager().getRootComponent(),
59
                    Messages.getText("_There_are_no_selected_rows"),
60
                    Messages.getText("_Move_up_selection"),
61
                    JOptionPane.INFORMATION_MESSAGE);
62
            }
63
            
50 64
        }
51 65
        if (actionCommand.equalsIgnoreCase("selection-reverse") ) {
52 66
            invertSelection(tableDocument);
67
            tableDocument.getModel().setModified(true);
53 68
        }
54
        tableDocument.getModel().setModified(true);
69
        
55 70
    }
56 71

  
57 72
    /**
......
74 89
    }
75 90

  
76 91
    public boolean isEnabled() {
77
        FeatureTableDocumentPanel tableDocument = getTableDocument();
78

  
79
        if (tableDocument != null) {
80
            try {
81
                return !tableDocument.getModel().getStore()
82
                    .getFeatureSelection().isEmpty();
83
            } catch (DataException e) {
84
                NotificationManager.addError(e);
85
            }
86
        }
87

  
88
        return false;
92
        return getTableDocument() != null;
89 93
    }
90 94

  
91 95
    public boolean isVisible() {
......
99 103
        }
100 104
        return null;
101 105
    }
106
    
107
    private boolean thereIsSelection(FeatureTableDocumentPanel tabledoc) {
108
        
109
        if (tabledoc != null) {
110
            try {
111
                return !tabledoc.getModel().getStore()
112
                    .getFeatureSelection().isEmpty();
113
            } catch (DataException e) {
114
                NotificationManager.addError(e);
115
            }
116
        }
117
        return false;
118
        
119
    }
102 120
}

Also available in: Unified diff