|
|
|
@ -496,10 +496,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
saveCommitCheckBox.setVisible(!useV2); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(useV2); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(useV2); |
|
|
|
|
boolean useAutoClean =useV2 && FineScheduler.getInstance().isStarted(); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean); |
|
|
|
|
autoCleanIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -518,14 +515,39 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Content"))); |
|
|
|
|
autoCleanPane.add(autoCleanRetainIntervalComboBox); |
|
|
|
|
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Last"))); |
|
|
|
|
boolean useAutoClean = !VcsHelper.getInstance().isLegacyMode() && FineScheduler.getInstance().isStarted(); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean); |
|
|
|
|
autoCleanIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
|
autoCleanPane.setVisible(false); |
|
|
|
|
return autoCleanPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkAutoScheduleStartAndUpdateStatus() { |
|
|
|
|
if (!VcsHelper.getInstance().isLegacyMode()) { |
|
|
|
|
new SwingWorker<Boolean, Void>() { |
|
|
|
|
@Override |
|
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
|
return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
protected void done() { |
|
|
|
|
try { |
|
|
|
|
boolean useAutoClean = get(); |
|
|
|
|
updateAutoCleanEnabled(useAutoClean); |
|
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}.execute(); |
|
|
|
|
} else { |
|
|
|
|
updateAutoCleanEnabled(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateAutoCleanEnabled(boolean b) { |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(b); |
|
|
|
|
autoCleanIntervalComboBox.setEnabled(b); |
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createSaveIntervalPane() { |
|
|
|
|
JPanel saveIntervalPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox = new UICheckBox(); |
|
|
|
@ -1192,14 +1214,16 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
} else { |
|
|
|
|
VcsHelper.getInstance().stopAutoSave(); |
|
|
|
|
} |
|
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { |
|
|
|
|
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); |
|
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( |
|
|
|
|
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, |
|
|
|
|
getDay(autoCleanIntervalComboBox.getSelectedIndex()), |
|
|
|
|
VcsAutoCleanSchedule.class); |
|
|
|
|
} else { |
|
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); |
|
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { |
|
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { |
|
|
|
|
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); |
|
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( |
|
|
|
|
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, |
|
|
|
|
getDay(autoCleanIntervalComboBox.getSelectedIndex()), |
|
|
|
|
VcsAutoCleanSchedule.class); |
|
|
|
|
} else { |
|
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|