Browse Source

REPORT-135233 调整VcsAutoCleanOperator

fbp/merge
Destiny.Lin 3 months ago
parent
commit
be719446bf
  1. 44
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java

44
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -35,7 +35,6 @@ import com.fr.design.gui.iprogressbar.UIProgressBarUI;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.jdk.JdkVersion;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
@ -55,7 +54,6 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.ReportConfigManager; import com.fr.report.ReportConfigManager;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.logging.log4j.Level; import com.fr.third.apache.logging.log4j.Level;
import com.fr.third.guava.collect.BiMap; import com.fr.third.guava.collect.BiMap;
import com.fr.third.guava.collect.HashBiMap; import com.fr.third.guava.collect.HashBiMap;
@ -63,38 +61,19 @@ import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.transaction.WorkerAdaptor; import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.entity.vcs.VcsTaskBean;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsConfig;
import com.fr.workspace.server.vcs.VcsOperator; import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig; import com.fr.workspace.server.vcs.git.config.GcConfig;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import javax.swing.BoxLayout; import javax.swing.*;
import javax.swing.ButtonGroup;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.KeyStroke;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -110,12 +89,9 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fine.swing.ui.layout.Layouts.cell; import static com.fine.swing.ui.layout.Layouts.*;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12; import static com.fine.theme.utils.FineUIConstants.SCALE_FONT_SIZE_12;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -541,7 +517,7 @@ public class PreferencePane extends BasicPane {
new SwingWorker<Boolean, Void>() { new SwingWorker<Boolean, Void>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); return VcsRepository.getInstance().isSupport();
} }
@Override @Override
protected void done() { protected void done() {
@ -1175,12 +1151,12 @@ public class PreferencePane extends BasicPane {
if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { if (useVcsAutoCleanScheduleCheckBox.isEnabled()) {
if (useVcsAutoCleanScheduleCheckBox.isSelected()) { if (useVcsAutoCleanScheduleCheckBox.isSelected()) {
FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!");
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean(
VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME,
getDay(autoCleanIntervalComboBox.getSelectedIndex()), getDay(autoCleanIntervalComboBox.getSelectedIndex()),
VcsAutoCleanSchedule.class); VcsAutoCleanSchedule.class));
} else { } else {
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); VcsRepository.getInstance().stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME);
} }
} }
} }

8
designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java

@ -3,9 +3,9 @@ package com.fr.design.mainframe.vcs;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerAdaptor; import com.fr.transaction.WorkerAdaptor;
import com.fr.workspace.WorkContext; import com.fr.workspace.server.entity.vcs.VcsTaskBean;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import com.fr.workspace.server.vcs.VcsConfig; import com.fr.workspace.server.vcs.VcsConfig;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanOperator;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService;
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule;
@ -39,10 +39,10 @@ public class VcsRecycleSettingHelper {
VcsConfig.getInstance().setV2CleanRecycleInterval(day); VcsConfig.getInstance().setV2CleanRecycleInterval(day);
} }
}); });
WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean(
VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME, VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME,
1, 1,
VcsAutoRecycleSchedule.class); VcsAutoRecycleSchedule.class));
} }
}); });
} }

Loading…
Cancel
Save