*/
private void syncOutOnExit()
{
if (!getConnectionState().isServiceAccessible()) return;
SyncOut syncOut = new SyncOut(model);
if (syncOut.isSyncTime())
{
GuidesSet set = model.getGuidesSet();
ServicePreferences servicePreferences = model.getServicePreferences();
int feedsCount = set.countFeeds();
int lastSyncOutFeedsCount = servicePreferences.getLastSyncOutFeedsCount();
boolean synchronizedBefore = servicePreferences.getLastSyncOutDate() != null;
boolean doSync = feedsCount > 0 || synchronizedBefore;
if (doSync && isSuspiciousDifference(feedsCount, lastSyncOutFeedsCount))
{
String message;
if (feedsCount == 0)
{
message = Strings.message("synconexit.clear.the.list.of.your.saved.subscriptions");
} else
{
message = MessageFormat.format(Strings.message("synconexit.make.a.large.change.0.1"),
lastSyncOutFeedsCount, feedsCount);
}
int result = JOptionPane.showConfirmDialog(getMainFrame(),
MessageFormat.format(Strings.message("synconexit.suspicious.sync.text.0"), message),
Strings.message("synconexit.suspicious.sync.title"), JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE);
doSync = result == JOptionPane.YES_OPTION;
}
if (doSync && canSynchronize()) syncOut.doSynchronization(null, false);
}
}