Revision 38415 branches/v2_0_0_prep/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/project/documents/table/gui/FeatureTableDocumentPanel.java

View differences:

FeatureTableDocumentPanel.java
26 26
 */
27 27
package org.gvsig.app.project.documents.table.gui;
28 28

  
29
import java.lang.reflect.InvocationTargetException;
30

  
31
import javax.swing.SwingUtilities;
32

  
29 33
import org.slf4j.Logger;
30 34
import org.slf4j.LoggerFactory;
31 35

  
......
131 135
            try {
132 136
                if (selectionIsEmpty != getFeatureSelection().isEmpty()) {
133 137
                    selectionIsEmpty = !selectionIsEmpty;
134
                    PluginServices.getMainFrame().enableControls();
138
        			enableControls(notification);
135 139
                }
136 140
            } catch (DataException e) {
137 141
                LOG.error("Error getting the current selection", e);
138 142
            }
139
        } else
140
            if (notification instanceof ColumnHeaderSelectionChangeNotification) {
141
                PluginServices.getMainFrame().enableControls();
142
            }
143
		} else if (notification instanceof ColumnHeaderSelectionChangeNotification) {
144
			enableControls(notification);
145
		}
143 146
    }
144 147

  
148
	private void enableControls(Object notification) {
149
		try {
150
			SwingUtilities.invokeLater(new Runnable() {
151
				public void run() {
152
					PluginServices.getMainFrame().enableControls();
153
				}
154
			});
155
		} catch (Exception e) {
156
			LOG.warn("Error calling enableControls() after notification: "
157
					+ notification, e);
158
		}
159
	}
160

  
145 161
    private void initialize() throws DataException {
146 162
        getTablePanel().getTable().addObserver(this);
147 163
        getFeatureSelection().addObserver(this);

Also available in: Unified diff