Revision 3458 org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/checkout/VCSGisJCheckoutImpl.java
VCSGisJCheckoutImpl.java | ||
---|---|---|
45 | 45 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_CANT_CHECKOUT; |
46 | 46 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK; |
47 | 47 |
import org.gvsig.vcsgis.lib.VCSGisRevision; |
48 |
import org.gvsig.vcsgis.lib.VCSGisRuntimeException; |
|
48 | 49 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
49 | 50 |
import org.gvsig.vcsgis.swing.VCSGisJCheckout; |
50 | 51 |
import org.gvsig.vcsgis.swing.VCSGisSwingLocator; |
... | ... | |
54 | 55 |
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.REMOTE_ENTITIES; |
55 | 56 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.notInSwingThreadInvokeLater; |
56 | 57 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.refreshDocument; |
58 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationsErrors; |
|
57 | 59 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_GROUP_NAME; |
58 | 60 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.ICON_PROVIDER_NAME; |
59 | 61 |
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingManagerImpl.registerIcons; |
... | ... | |
189 | 191 |
if( notInSwingThreadInvokeLater(this::doUpdateComponents) ) { |
190 | 192 |
return; |
191 | 193 |
} |
192 |
boolean isProcessing = this.processing || this.entitySelector.isProcessing(); |
|
194 |
try { |
|
195 |
boolean isProcessing = this.processing || this.entitySelector.isProcessing(); |
|
193 | 196 |
|
194 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
195 |
VCSGisWorkspace workspace = getWorkspace(); |
|
196 |
VCSGisEntity selectedTable = this.entitySelector.getSelectedEntity(); |
|
197 |
|
|
198 |
boolean exists = workspace!=null && |
|
199 |
workspace.existsInWorkspace(selectedTable); |
|
200 |
|
|
201 |
this.chkOverwriteTable.setEnabled(!isProcessing && exists); |
|
197 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
198 |
VCSGisWorkspace workspace = getWorkspace(); |
|
199 |
VCSGisEntity selectedTable = this.entitySelector.getSelectedEntity(); |
|
202 | 200 |
|
203 |
boolean canCheckout = !isProcessing && |
|
204 |
workspace!=null && |
|
205 |
selectedTable != null && |
|
206 |
(!exists || this.chkOverwriteTable.isSelected()); |
|
201 |
boolean exists = workspace!=null && |
|
202 |
workspace.existsInWorkspace(selectedTable); |
|
207 | 203 |
|
208 |
if (selectedTable == null || canCheckout) { |
|
209 |
showMessage("", null); |
|
210 |
} else { |
|
211 |
showMessage( |
|
212 |
i18n.getTranslation("_The_selected_table_is_already_in_the_working_copy"), |
|
213 |
i18n.getTranslation("_To_download_updated_data_use_show_changes_tool") |
|
214 |
); |
|
215 |
} |
|
216 |
this.revisionPicker.setEnabled(canCheckout); |
|
217 |
this.lblRevisions.setEnabled(canCheckout); |
|
218 |
|
|
219 |
this.rdbDontAddToProject.setEnabled(canCheckout); |
|
220 |
this.rdbAddTableToProject.setEnabled(canCheckout); |
|
221 |
if (canCheckout) { |
|
222 |
if (isLayer(selectedTable)) { |
|
223 |
this.rdbAddLayerToView.setEnabled(canCheckout); |
|
224 |
this.cboView.setEnabled(canCheckout); |
|
204 |
this.chkOverwriteTable.setEnabled(!isProcessing && exists); |
|
205 |
|
|
206 |
boolean canCheckout = !isProcessing && |
|
207 |
workspace!=null && |
|
208 |
selectedTable != null && |
|
209 |
(!exists || this.chkOverwriteTable.isSelected()); |
|
210 |
|
|
211 |
if (selectedTable == null || canCheckout) { |
|
212 |
showMessage("", null); |
|
225 | 213 |
} else { |
214 |
showMessage( |
|
215 |
i18n.getTranslation("_The_selected_table_is_already_in_the_working_copy"), |
|
216 |
i18n.getTranslation("_To_download_updated_data_use_show_changes_tool") |
|
217 |
); |
|
218 |
} |
|
219 |
this.revisionPicker.setEnabled(canCheckout); |
|
220 |
this.lblRevisions.setEnabled(canCheckout); |
|
221 |
|
|
222 |
this.rdbDontAddToProject.setEnabled(canCheckout); |
|
223 |
this.rdbAddTableToProject.setEnabled(canCheckout); |
|
224 |
if (canCheckout) { |
|
225 |
if (isLayer(selectedTable)) { |
|
226 |
this.rdbAddLayerToView.setEnabled(canCheckout); |
|
227 |
this.cboView.setEnabled(canCheckout); |
|
228 |
} else { |
|
229 |
this.rdbAddLayerToView.setEnabled(false); |
|
230 |
this.cboView.setEnabled(false); |
|
231 |
} |
|
232 |
} else { |
|
226 | 233 |
this.rdbAddLayerToView.setEnabled(false); |
227 | 234 |
this.cboView.setEnabled(false); |
228 | 235 |
} |
229 |
} else { |
|
230 |
this.rdbAddLayerToView.setEnabled(false); |
|
231 |
this.cboView.setEnabled(false); |
|
232 |
} |
|
233 |
|
|
234 |
this.workspacePicker.setEnabled(!isProcessing); |
|
235 |
this.entitySelector.setEnabled(!isProcessing && workspace!=null ); |
|
236 | 236 |
|
237 |
this.pbStatus.setVisible(isProcessing); |
|
238 |
this.lblStatusTitle.setVisible(isProcessing); |
|
239 |
|
|
240 |
if (dialog != null) { |
|
241 |
LabeledValue selectedView = (LabeledValue) cboView.getSelectedItem(); |
|
242 |
boolean dontAddNothing = rdbDontAddToProject.isSelected(); |
|
243 |
boolean addLayerToView = rdbAddLayerToView.isSelected() && selectedView != null && selectedView.getValue() != null; |
|
244 |
boolean addTableToProject = rdbAddTableToProject.isSelected(); |
|
245 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, |
|
246 |
canCheckout && (dontAddNothing || (addLayerToView || addTableToProject)) |
|
247 |
); |
|
237 |
this.workspacePicker.setEnabled(!isProcessing); |
|
238 |
this.entitySelector.setEnabled(!isProcessing && workspace!=null ); |
|
239 |
|
|
240 |
this.pbStatus.setVisible(isProcessing); |
|
241 |
this.lblStatusTitle.setVisible(isProcessing); |
|
242 |
|
|
243 |
if (dialog != null) { |
|
244 |
LabeledValue selectedView = (LabeledValue) cboView.getSelectedItem(); |
|
245 |
boolean dontAddNothing = rdbDontAddToProject.isSelected(); |
|
246 |
boolean addLayerToView = rdbAddLayerToView.isSelected() && selectedView != null && selectedView.getValue() != null; |
|
247 |
boolean addTableToProject = rdbAddTableToProject.isSelected(); |
|
248 |
this.dialog.setButtonEnabled(WindowManager_v2.BUTTON_OK, |
|
249 |
canCheckout && (dontAddNothing || (addLayerToView || addTableToProject)) |
|
250 |
); |
|
251 |
} |
|
252 |
} catch (VCSGisRuntimeException e1) { |
|
253 |
LOGGER.warn("Can't updating components.", e1); |
|
254 |
if (showAuthenticationsErrors("_VCS_Checkout", e1)) { |
|
255 |
this.workspacePicker.set(null); |
|
256 |
doChangeWorkspace(); |
|
257 |
doUpdateComponents(); |
|
258 |
} |
|
259 |
} catch (Exception e2) { |
|
260 |
LOGGER.warn("Can't updating components.", e2); |
|
248 | 261 |
} |
249 | 262 |
} |
250 | 263 |
|
Also available in: Unified diff