From be719446bfdad7affae5baacb44b902d53a8b7d5 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 7 Oct 2024 17:37:31 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-135233=20=E8=B0=83=E6=95=B4VcsAutoCleanO?= =?UTF-8?q?perator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/file/PreferencePane.java | 44 +++++-------------- .../vcs/VcsRecycleSettingHelper.java | 8 ++-- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 1779ef20c1..1babe368ec 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/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.itextfield.UITextField; import com.fr.design.i18n.Toolkit; -import com.fr.design.jdk.JdkVersion; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.vcs.VcsConfigManager; @@ -55,7 +54,6 @@ import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; import com.fr.stable.Constants; -import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.logging.log4j.Level; import com.fr.third.guava.collect.BiMap; 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.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.VcsOperator; 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.VcsAutoCleanService; import org.jetbrains.annotations.NotNull; -import javax.swing.BoxLayout; -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.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -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.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -110,12 +89,9 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.ExecutionException; -import static com.fine.swing.ui.layout.Layouts.cell; -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.swing.ui.layout.Layouts.*; 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.fr.design.i18n.Toolkit.i18nText; @@ -541,7 +517,7 @@ public class PreferencePane extends BasicPane { new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - return WorkContext.getCurrent().get(VcsAutoCleanOperator.class).isSupport(); + return VcsRepository.getInstance().isSupport(); } @Override protected void done() { @@ -1175,12 +1151,12 @@ public class PreferencePane extends BasicPane { if (useVcsAutoCleanScheduleCheckBox.isEnabled()) { if (useVcsAutoCleanScheduleCheckBox.isSelected()) { FineLoggerFactory.getLogger().info("[VcsV2] start auto clean!"); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME, getDay(autoCleanIntervalComboBox.getSelectedIndex()), - VcsAutoCleanSchedule.class); + VcsAutoCleanSchedule.class)); } else { - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); + VcsRepository.getInstance().stopVcsAutoCleanJob(VcsAutoCleanService.VCS_AUTO_CLEAN_JOB_NAME); } } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java index 3e6a5bab96..db93616342 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/VcsRecycleSettingHelper.java +++ b/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.transaction.Configurations; 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.v2.scheduler.VcsAutoCleanOperator; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoRecycleSchedule; @@ -39,10 +39,10 @@ public class VcsRecycleSettingHelper { VcsConfig.getInstance().setV2CleanRecycleInterval(day); } }); - WorkContext.getCurrent().get(VcsAutoCleanOperator.class).addOrUpdateVcsAutoCleanJob( + VcsRepository.getInstance().addOrUpdateVcsAutoCleanJob(new VcsTaskBean( VcsAutoCleanService.VCS_AUTO_CLEAN_RECYCLE_JOB_NAME, 1, - VcsAutoRecycleSchedule.class); + VcsAutoRecycleSchedule.class)); } }); }