Revision 43462 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/TableEditStopExtension.java
TableEditStopExtension.java | ||
---|---|---|
47 | 47 |
import org.gvsig.andami.plugins.status.UnsavedData; |
48 | 48 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
49 | 49 |
import org.gvsig.app.ApplicationLocator; |
50 |
import org.gvsig.app.ApplicationManager; |
|
50 | 51 |
import org.gvsig.app.project.Project; |
51 | 52 |
import org.gvsig.app.project.ProjectManager; |
52 | 53 |
import org.gvsig.app.project.documents.Document; |
... | ... | |
61 | 62 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
62 | 63 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
63 | 64 |
import org.gvsig.gui.beans.Messages; |
65 |
import org.gvsig.tools.ToolsLocator; |
|
66 |
import org.gvsig.tools.i18n.I18nManager; |
|
64 | 67 |
import org.gvsig.tools.util.ArrayUtils; |
65 | 68 |
import org.gvsig.utils.swing.threads.IMonitorableTask; |
66 | 69 |
|
... | ... | |
107 | 110 |
|
108 | 111 |
private void stopEditing(FeatureTableDocumentPanel table) { |
109 | 112 |
|
113 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
114 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
115 |
|
|
110 | 116 |
Object[] options = { |
111 |
PluginServices.getText(this, "_Guardar"), |
|
112 |
" " + PluginServices.getText(this, "_Descartar") + " ", |
|
113 |
PluginServices.getText(this, "_Continuar")}; |
|
117 |
i18n.getTranslation("_Guardar"), |
|
118 |
" " + i18n.getTranslation("_Descartar") + " ", |
|
119 |
i18n.getTranslation("_Continuar") |
|
120 |
}; |
|
114 | 121 |
|
115 | 122 |
JPanel explanation_panel = getExplanationPanel(table.getModel().getName()); |
116 | 123 |
|
... | ... | |
123 | 130 |
JOptionPane.QUESTION_MESSAGE, null, options, |
124 | 131 |
options[2]); |
125 | 132 |
|
126 |
try { |
|
127 |
if (resp == JOptionPane.NO_OPTION) { |
|
133 |
switch( resp ) { |
|
134 |
case JOptionPane.NO_OPTION: |
|
135 |
try { |
|
128 | 136 |
// CANCEL EDITING |
129 | 137 |
table.getModel().getStore().cancelEditing(); |
130 |
} else { |
|
131 |
|
|
132 |
if (resp == JOptionPane.YES_OPTION) { |
|
133 |
// Save table |
|
134 |
table.getModel().getStore().finishEditing(); |
|
135 |
} else { |
|
136 |
// This happens when user clicks on [x] |
|
137 |
// to abruptly close previous JOptionPane dialog |
|
138 |
// We do nothing (equivalent to 'Continue editing') |
|
139 |
} |
|
138 |
} catch (DataException e) { |
|
139 |
logger.warn("Problems canceling table editing: " |
|
140 |
+ e.getMessage(), e); |
|
141 |
application.messageDialog( |
|
142 |
i18n.getTranslation("_Problems_cancel_table_editing")+"\n\n"+ |
|
143 |
i18n.getTranslation("_See_error_log_for_more_information"), |
|
144 |
null, |
|
145 |
i18n.getTranslation("_Warning"), |
|
146 |
JOptionPane.WARNING_MESSAGE, |
|
147 |
"Table_cant_cancelEditing" |
|
148 |
); |
|
140 | 149 |
} |
141 |
} catch (DataException e) { |
|
142 |
logger.error("While finishing or canceling table editing: " |
|
150 |
break; |
|
151 |
case JOptionPane.YES_OPTION: |
|
152 |
try { |
|
153 |
// Save table |
|
154 |
table.getModel().getStore().finishEditing(); |
|
155 |
} catch (DataException e) { |
|
156 |
logger.warn("Problems finish table editing: " |
|
143 | 157 |
+ e.getMessage(), e); |
158 |
application.messageDialog( |
|
159 |
i18n.getTranslation("_Problems_finish_table_editing")+"\n\n"+ |
|
160 |
i18n.getTranslation("_See_error_log_for_more_information"), |
|
161 |
null, |
|
162 |
i18n.getTranslation("_Warning"), |
|
163 |
JOptionPane.WARNING_MESSAGE, |
|
164 |
"Table_cant_finishEditing" |
|
165 |
); |
|
166 |
} |
|
167 |
break; |
|
168 |
default: |
|
169 |
// This happens when user clicks on [x] |
|
170 |
// to abruptly close previous JOptionPane dialog |
|
171 |
// We do nothing (equivalent to 'Continue editing') |
|
172 |
break; |
|
144 | 173 |
} |
145 | 174 |
} |
146 | 175 |
|
Also available in: Unified diff