|
|
@ -496,10 +496,7 @@ public class PreferencePane extends BasicPane { |
|
|
|
saveCommitCheckBox.setVisible(!useV2); |
|
|
|
saveCommitCheckBox.setVisible(!useV2); |
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(useV2); |
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(useV2); |
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(useV2); |
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(useV2); |
|
|
|
boolean useAutoClean =useV2 && FineScheduler.getInstance().isStarted(); |
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
autoCleanIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2); |
|
|
|
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(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Content"))); |
|
|
|
autoCleanPane.add(autoCleanRetainIntervalComboBox); |
|
|
|
autoCleanPane.add(autoCleanRetainIntervalComboBox); |
|
|
|
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Last"))); |
|
|
|
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Last"))); |
|
|
|
boolean useAutoClean = !VcsHelper.getInstance().isLegacyMode() && FineScheduler.getInstance().isStarted(); |
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
autoCleanIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(useAutoClean); |
|
|
|
|
|
|
|
autoCleanPane.setVisible(false); |
|
|
|
autoCleanPane.setVisible(false); |
|
|
|
return autoCleanPane; |
|
|
|
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() { |
|
|
|
private JPanel createSaveIntervalPane() { |
|
|
|
JPanel saveIntervalPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
JPanel saveIntervalPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
useVcsAutoSaveScheduleCheckBox = new UICheckBox(); |
|
|
|
useVcsAutoSaveScheduleCheckBox = new UICheckBox(); |
|
|
@ -1192,14 +1214,16 @@ public class PreferencePane extends BasicPane { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
VcsHelper.getInstance().stopAutoSave(); |
|
|
|
VcsHelper.getInstance().stopAutoSave(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { |
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { |
|
|
|
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); |
|
|
|
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { |
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( |
|
|
|
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); |
|
|
|
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, |
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( |
|
|
|
getDay(autoCleanIntervalComboBox.getSelectedIndex()), |
|
|
|
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, |
|
|
|
VcsAutoCleanSchedule.class); |
|
|
|
getDay(autoCleanIntervalComboBox.getSelectedIndex()), |
|
|
|
} else { |
|
|
|
VcsAutoCleanSchedule.class); |
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); |
|
|
|
} else { |
|
|
|
|
|
|
|
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|