|
|
|
@ -36,12 +36,15 @@ import com.fr.design.layout.TableLayoutHelper;
|
|
|
|
|
import com.fr.design.layout.VerticalFlowLayout; |
|
|
|
|
import com.fr.design.mainframe.vcs.VcsConfigManager; |
|
|
|
|
import com.fr.design.mainframe.vcs.common.VcsHelper; |
|
|
|
|
import com.fr.design.mainframe.vcs.ui.UIPositiveIntEditor; |
|
|
|
|
import com.fr.design.mainframe.vcs.ui.VcsMovePanel; |
|
|
|
|
import com.fr.design.os.impl.SupportOSImpl; |
|
|
|
|
import com.fr.design.unit.UnitConvertUtil; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.design.widget.FRWidgetFactory; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.FRFont; |
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.general.Inter; |
|
|
|
|
import com.fr.general.log.Log4jConfig; |
|
|
|
@ -49,14 +52,22 @@ import com.fr.io.attr.ImageExportAttr;
|
|
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.report.ReportConfigManager; |
|
|
|
|
import com.fr.scheduler.tool.FineScheduler; |
|
|
|
|
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; |
|
|
|
|
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.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.BorderFactory; |
|
|
|
@ -65,6 +76,7 @@ import javax.swing.ButtonGroup;
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JDialog; |
|
|
|
|
import javax.swing.JFileChooser; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JProgressBar; |
|
|
|
@ -77,14 +89,7 @@ import javax.swing.UIManager;
|
|
|
|
|
import javax.swing.border.EmptyBorder; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
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; |
|
|
|
@ -95,6 +100,7 @@ import java.awt.event.WindowAdapter;
|
|
|
|
|
import java.awt.event.WindowEvent; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.text.DecimalFormat; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
@ -122,6 +128,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
private static final int PREFERENCE_LABEL_MAX_WIDTH = 460; |
|
|
|
|
private static final int OFFSET_HEIGHT = 60; |
|
|
|
|
|
|
|
|
|
private static final int VCS_FILL_TOTAL = 5; |
|
|
|
|
private static final String TYPE = "pressed"; |
|
|
|
|
private static final String DISPLAY_TYPE = "+"; |
|
|
|
|
private static final String BACK_SLASH = "BACK_SLASH"; |
|
|
|
@ -149,6 +156,34 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; |
|
|
|
|
|
|
|
|
|
private static final int ONE_DAY_INT = 1; |
|
|
|
|
private static final int ONE_WEEK_INT = 7; |
|
|
|
|
private static final int ONE_MONTH_INT = 30; |
|
|
|
|
private static final int THREE_MONTH_INT = 90; |
|
|
|
|
private static final int SIX_MONTH_INT = 180; |
|
|
|
|
|
|
|
|
|
private static final int ONE_DAY_INDEX = 0; |
|
|
|
|
private static final int ONE_WEEK_INDEX = 1; |
|
|
|
|
private static final int ONE_MONTH_INDEX = 2; |
|
|
|
|
private static final int THREE_MONTH_INDEX = 3; |
|
|
|
|
private static final int SIX_MONTH_INDEX = 4; |
|
|
|
|
private static final String ONE_DAY = Toolkit.i18nText("Fine-Design_Vcs_Auto_Clean_ONE_DAY"); |
|
|
|
|
private static final String ONE_WEEK = Toolkit.i18nText("Fine-Design_Vcs_Auto_Clean_ONE_WEEK"); |
|
|
|
|
private static final String ONE_MONTH = Toolkit.i18nText("Fine-Design_Vcs_Auto_Clean_ONE_MONTH"); |
|
|
|
|
private static final String THREE_MONTH = Toolkit.i18nText("Fine-Design_Vcs_Auto_Clean_THREE_MONTH"); |
|
|
|
|
private static final String SIX_MONTH = Toolkit.i18nText("Fine-Design_Vcs_Auto_Clean_SIX_MONTH"); |
|
|
|
|
private static final String[] INTERVAL = { |
|
|
|
|
ONE_DAY, |
|
|
|
|
ONE_WEEK, |
|
|
|
|
ONE_MONTH, |
|
|
|
|
THREE_MONTH, |
|
|
|
|
SIX_MONTH |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private static final int DEFAULT_INDEX = 3; |
|
|
|
|
|
|
|
|
|
private BasicDialog basicDialog; |
|
|
|
|
|
|
|
|
|
private boolean languageChanged; // 是否修改了设计器语言设置
|
|
|
|
|
//设置是否支持undo
|
|
|
|
|
private UICheckBox supportUndoCheckBox; |
|
|
|
@ -186,10 +221,24 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
private UICheckBox cloudAnalyticsDelayCheckBox; |
|
|
|
|
|
|
|
|
|
private UICheckBox vcsEnableCheckBox; |
|
|
|
|
private UICheckBox useVcsAutoSaveScheduleCheckBox; |
|
|
|
|
|
|
|
|
|
private UICheckBox useVcsAutoCleanScheduleCheckBox; |
|
|
|
|
|
|
|
|
|
private UIComboBox autoCleanIntervalComboBox; |
|
|
|
|
private UIComboBox autoCleanRetainIntervalComboBox; |
|
|
|
|
|
|
|
|
|
private UIPositiveIntEditor autoSaveIntervalEditor; |
|
|
|
|
private UICheckBox saveCommitCheckBox; |
|
|
|
|
private UICheckBox useIntervalCheckBox; |
|
|
|
|
private VcsMovePanel movePanel; |
|
|
|
|
|
|
|
|
|
private JPanel saveIntervalPane; |
|
|
|
|
private JPanel autoCleanPane; |
|
|
|
|
|
|
|
|
|
private JPanel gcControlPane; |
|
|
|
|
private UICheckBox startupPageEnabledCheckBox; |
|
|
|
|
private IntegerEditor saveIntervalEditor; |
|
|
|
|
private UIPositiveIntEditor saveIntervalEditor; |
|
|
|
|
private UICheckBox gcEnableCheckBox; |
|
|
|
|
private UIButton gcButton; |
|
|
|
|
private UILabel remindVcsLabel; |
|
|
|
@ -201,7 +250,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
private JProgressBar gcProgressBar; |
|
|
|
|
private Timer gcProgressTimer; |
|
|
|
|
private UIButton gcOkButton = new UIButton(i18nText("Fine-Design_Report_OK")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIRadioButton previewResolutionBtnS; |
|
|
|
|
private UIRadioButton previewResolutionBtnM; |
|
|
|
|
|
|
|
|
@ -209,7 +258,15 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
private UIRadioButton previewRenderQuality; |
|
|
|
|
private static final int DPI_SCALE_S = 1; |
|
|
|
|
private static final int DPI_SCALE_M = 2; |
|
|
|
|
|
|
|
|
|
private static final BiMap<Integer, Integer> INDEX_DAY_MAP = HashBiMap.create(new HashMap<Integer, Integer>() { |
|
|
|
|
{ |
|
|
|
|
put(ONE_DAY_INDEX, ONE_DAY_INT); |
|
|
|
|
put(ONE_WEEK_INDEX, ONE_WEEK_INT); |
|
|
|
|
put(ONE_MONTH_INDEX, ONE_MONTH_INT); |
|
|
|
|
put(SIX_MONTH_INDEX, SIX_MONTH_INT); |
|
|
|
|
put(THREE_MONTH_INDEX, THREE_MONTH_INT); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
public PreferencePane() { |
|
|
|
|
this.initComponents(); |
|
|
|
|
} |
|
|
|
@ -223,17 +280,30 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
JPanel generalPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
UIScrollPane generalScrollPane = patchScroll(generalPane); |
|
|
|
|
jtabPane.addTab(i18nText("Fine-Design_Basic_General"), generalScrollPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel advancePane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
UIScrollPane adviceScrollPane = patchScroll(advancePane); |
|
|
|
|
jtabPane.addTab(i18nText("Fine-Design_Basic_Advanced"), adviceScrollPane); |
|
|
|
|
|
|
|
|
|
//初始化vcs总面板
|
|
|
|
|
JPanel vcsParentPane = new JPanel(); |
|
|
|
|
CardLayout cardLayout = new CardLayout(); |
|
|
|
|
vcsParentPane.setLayout(cardLayout); |
|
|
|
|
//vcs配置面板
|
|
|
|
|
JPanel vcsPane = new JPanel(new BorderLayout()); |
|
|
|
|
//添加滚动条
|
|
|
|
|
UIScrollPane vcsScrollPane = patchScroll(vcsPane); |
|
|
|
|
//配置面板作为vcs总面板的一张卡片
|
|
|
|
|
vcsParentPane.add(vcsScrollPane, VcsMovePanel.SETTING); |
|
|
|
|
jtabPane.addTab(i18nText("Fine-Design_Vcs_Title"), vcsParentPane); |
|
|
|
|
|
|
|
|
|
contentPane.add(jtabPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
createFunctionPane(generalPane); |
|
|
|
|
createEditPane(generalPane); |
|
|
|
|
createColorSettingPane(generalPane); |
|
|
|
|
createVcsSettingPane(generalPane); |
|
|
|
|
|
|
|
|
|
// vcsPane
|
|
|
|
|
createVcsSettingPane(vcsPane, vcsParentPane, cardLayout); |
|
|
|
|
|
|
|
|
|
// ConfPane
|
|
|
|
|
JPanel confLocationPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
|
|
|
@ -242,7 +312,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
createLogPane(advancePane); |
|
|
|
|
|
|
|
|
|
createLanPane(generalPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createStartupPagePane(generalPane); |
|
|
|
|
|
|
|
|
|
createLengthPane(advancePane); |
|
|
|
@ -309,7 +379,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
designerStartupOption.add(cloudAnalyticsDelayCheckBox); |
|
|
|
|
advancePane.add(designerStartupOption); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createImageExportSettingPane() { |
|
|
|
|
previewResolutionBtnS = new UIRadioButton(i18nText("Fine-Design_Image_Export_SD"), true); |
|
|
|
|
previewResolutionBtnM = new UIRadioButton(i18nText("Fine-Design_Image_Export_HD")); |
|
|
|
@ -345,20 +415,34 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
generalPanelWithScroll.setPreferredSize(new Dimension(generalPane.getWidth(), 600)); |
|
|
|
|
return generalPanelWithScroll; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void createVcsSettingPane(JPanel generalPane) { |
|
|
|
|
JPanel vcsPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title")); |
|
|
|
|
generalPane.add(vcsPane); |
|
|
|
|
|
|
|
|
|
private void createVcsSettingPane(JPanel generalPane,JPanel parentPane, CardLayout cardLayout) { |
|
|
|
|
//迁移面板
|
|
|
|
|
movePanel = createMovePane(cardLayout, parentPane); |
|
|
|
|
generalPane.add(movePanel, BorderLayout.NORTH); |
|
|
|
|
JPanel savePane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Save_Setting")); |
|
|
|
|
JPanel vcsPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Clean_Setting")); |
|
|
|
|
JPanel containPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); |
|
|
|
|
containPane.add(savePane); |
|
|
|
|
containPane.add(vcsPane); |
|
|
|
|
//填充一下面板
|
|
|
|
|
fillPane(containPane, VCS_FILL_TOTAL); |
|
|
|
|
generalPane.add(containPane, BorderLayout.CENTER); |
|
|
|
|
remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind")); |
|
|
|
|
remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit()); |
|
|
|
|
vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto")); |
|
|
|
|
|
|
|
|
|
saveIntervalPane = createSaveIntervalPane(); |
|
|
|
|
saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete")); |
|
|
|
|
saveIntervalEditor = new IntegerEditor(60); |
|
|
|
|
saveIntervalEditor = new UIPositiveIntEditor(60); |
|
|
|
|
useIntervalCheckBox = new UICheckBox(); |
|
|
|
|
savePane.add(vcsEnableCheckBox); |
|
|
|
|
savePane.add(saveIntervalPane); |
|
|
|
|
|
|
|
|
|
//gc面板
|
|
|
|
|
gcControlPane = createGcControlPane(); |
|
|
|
|
|
|
|
|
|
JPanel enableVcsPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
|
enableVcsPanel.add(vcsEnableCheckBox); |
|
|
|
|
enableVcsPanel.add(remindVcsLabel); |
|
|
|
|
JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
|
final UILabel everyLabel = new UILabel(i18nText("Fine-Design_Vcs_Every")); |
|
|
|
@ -367,6 +451,8 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
intervalPanel.add(everyLabel); |
|
|
|
|
intervalPanel.add(saveIntervalEditor); |
|
|
|
|
intervalPanel.add(delayLabel); |
|
|
|
|
autoCleanPane = createAutoCleanPane(); |
|
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
|
vcsEnableCheckBox.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
@ -388,34 +474,104 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
}); |
|
|
|
|
vcsPane.add(enableVcsPanel); |
|
|
|
|
vcsPane.add(intervalPanel); |
|
|
|
|
vcsPane.add(saveCommitCheckBox); |
|
|
|
|
if (VcsHelper.getInstance().isLegacyMode()) { |
|
|
|
|
vcsPane.add(saveCommitCheckBox); |
|
|
|
|
} |
|
|
|
|
vcsPane.add(autoCleanPane); |
|
|
|
|
boolean support = VcsHelper.getInstance().checkV2FunctionSupport(); |
|
|
|
|
saveIntervalPane.setVisible(support); |
|
|
|
|
autoCleanPane.setVisible(support); |
|
|
|
|
if (VcsHelper.getInstance().isLegacyMode()) { |
|
|
|
|
// 老版本时才显示gc选项
|
|
|
|
|
vcsPane.add(gcControlPane); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initGcControlPane(vcsPane); |
|
|
|
|
private void fillPane(JPanel containPane, int total) { |
|
|
|
|
for (int i = 0; i < total; i++) { |
|
|
|
|
containPane.add(new JPanel()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initGcControlPane(JPanel vcsPane) { |
|
|
|
|
JPanel gcControlPane = createGcControlPane(); |
|
|
|
|
new SwingWorker<Boolean, Boolean>() { |
|
|
|
|
private VcsMovePanel createMovePane(CardLayout cardLayout, JPanel parentPane) { |
|
|
|
|
return new VcsMovePanel(cardLayout, parentPane, new VcsMovePanel.MoveCallBack(){ |
|
|
|
|
@Override |
|
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
|
return WorkContext.getCurrent().get(VcsOperator.class).isLegacyMode(); |
|
|
|
|
public void doCallBack(boolean useV2) { |
|
|
|
|
saveIntervalPane.setVisible(useV2); |
|
|
|
|
autoCleanPane.setVisible(useV2); |
|
|
|
|
gcControlPane.setVisible(!useV2); |
|
|
|
|
saveCommitCheckBox.setVisible(!useV2); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(useV2); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(useV2); |
|
|
|
|
checkAutoScheduleStartAndUpdateStatus(); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setEnabled(useV2); |
|
|
|
|
} |
|
|
|
|
}, basicDialog); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private JPanel createAutoCleanPane() { |
|
|
|
|
JPanel autoCleanPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox = new UICheckBox(); |
|
|
|
|
autoCleanIntervalComboBox = new UIComboBox(INTERVAL); |
|
|
|
|
autoCleanIntervalComboBox.setSelectedIndex(DEFAULT_INDEX); |
|
|
|
|
autoCleanRetainIntervalComboBox = new UIComboBox(INTERVAL); |
|
|
|
|
autoCleanRetainIntervalComboBox.setSelectedIndex(DEFAULT_INDEX); |
|
|
|
|
autoCleanPane.add(useVcsAutoCleanScheduleCheckBox); |
|
|
|
|
autoCleanPane.add(new UILabel(i18nText("Fine-Design_Vcs_Auto_Clean_Every"))); |
|
|
|
|
autoCleanPane.add(autoCleanIntervalComboBox); |
|
|
|
|
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"))); |
|
|
|
|
autoCleanPane.setVisible(false); |
|
|
|
|
return autoCleanPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void done() { |
|
|
|
|
try { |
|
|
|
|
if (Boolean.TRUE.equals(get())) { |
|
|
|
|
// 老版本时才显示gc选项
|
|
|
|
|
vcsPane.add(gcControlPane); |
|
|
|
|
vcsPane.updateUI(); |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e, "[Vcs] retrieve legacy mode error: {}", e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}.execute(); |
|
|
|
|
}.execute(); |
|
|
|
|
} else { |
|
|
|
|
updateAutoCleanEnabled(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateAutoCleanEnabled(boolean b) { |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setEnabled(b); |
|
|
|
|
autoCleanIntervalComboBox.setEnabled(b); |
|
|
|
|
autoCleanRetainIntervalComboBox.setEnabled(b); |
|
|
|
|
if (autoCleanPane != null) { |
|
|
|
|
autoCleanPane.setToolTipText(b ? null : Toolkit.i18nText("Fine-Design_Vcs_Server_Start_Hover")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createSaveIntervalPane() { |
|
|
|
|
JPanel saveIntervalPane = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox = new UICheckBox(); |
|
|
|
|
autoSaveIntervalEditor = new UIPositiveIntEditor(60); |
|
|
|
|
saveIntervalPane.add(useVcsAutoSaveScheduleCheckBox); |
|
|
|
|
saveIntervalPane.add(new UILabel(i18nText("Fine-Design_Vcs_Every"))); |
|
|
|
|
saveIntervalPane.add(autoSaveIntervalEditor); |
|
|
|
|
saveIntervalPane.add(new UILabel(i18nText("Fine-Design_Vcs_Save_Delay"))); |
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setEnabled(!VcsHelper.getInstance().isLegacyMode()); |
|
|
|
|
saveIntervalPane.setVisible(false); |
|
|
|
|
return saveIntervalPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 模创建板版本gc 配置操作面板 |
|
|
|
|
* |
|
|
|
@ -486,7 +642,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
private void createEditPane(JPanel generalPane) { |
|
|
|
|
//samuel:编辑器设置
|
|
|
|
|
JPanel editPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Editor_Preference")); |
|
|
|
|
JPanel editPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Editor_Preference")); |
|
|
|
|
generalPane.add(editPane); |
|
|
|
|
|
|
|
|
|
//设置是否支持将字符串编辑为公式
|
|
|
|
@ -496,7 +652,6 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
//是否默认转化
|
|
|
|
|
defaultStringToFormulaBox = new UICheckBox(i18nText("Fine-Design_Basic_Always")); |
|
|
|
|
|
|
|
|
|
editPane.add(defaultStringToFormulaBox); |
|
|
|
|
//不支持转化则不能默认执行
|
|
|
|
|
supportStringToFormulaBox.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
@ -508,7 +663,12 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
keyStrokePane.add(new UILabel(i18nText("Fine-Design_Basic_Support_Auto_Complete_Shortcut") + ":"), BorderLayout.WEST); |
|
|
|
|
shortCutLabel = new UILabel(); |
|
|
|
|
keyStrokePane.add(shortCutLabel, BorderLayout.CENTER); |
|
|
|
|
editPane.add(keyStrokePane); |
|
|
|
|
keyStrokePane.setBorder(new EmptyBorder(0, 10,0,0)); |
|
|
|
|
|
|
|
|
|
JPanel defaultExecutePane = new JPanel(FRGUIPaneFactory.createLeftZeroVgapNormalHgapLayout()); |
|
|
|
|
defaultExecutePane.add(defaultStringToFormulaBox); |
|
|
|
|
defaultExecutePane.add(keyStrokePane); |
|
|
|
|
editPane.add(defaultExecutePane); |
|
|
|
|
shortCutLabel.addMouseListener(new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
@ -796,7 +956,8 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
defaultStringToFormulaBox.setSelected(false); |
|
|
|
|
} |
|
|
|
|
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); |
|
|
|
|
if (WorkContext.getCurrent().isCluster()) { |
|
|
|
|
//如果是集群并且是老版本则不可用
|
|
|
|
|
if (VcsHelper.getInstance().isLegacyMode() && WorkContext.getCurrent().isCluster()) { |
|
|
|
|
vcsEnableCheckBox.setEnabled(false); |
|
|
|
|
gcEnableCheckBox.setEnabled(false); |
|
|
|
|
} |
|
|
|
@ -819,6 +980,12 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); |
|
|
|
|
gcButton.setEnabled(gcEnableCheckBox.isSelected()); |
|
|
|
|
|
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(vcsConfigManager.isUseAutoSave()); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(VcsConfig.getInstance().isUseV2AutoClean()); |
|
|
|
|
autoSaveIntervalEditor.setValue(vcsConfigManager.getAutoSaveInterval()); |
|
|
|
|
autoCleanIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2CleanInterval())); |
|
|
|
|
autoCleanRetainIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2RetainInterval())); |
|
|
|
|
|
|
|
|
|
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); |
|
|
|
|
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); |
|
|
|
|
|
|
|
|
@ -834,8 +1001,7 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); |
|
|
|
|
|
|
|
|
|
if (useOptimizedUPMCheckbox != null) { |
|
|
|
|
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM() |
|
|
|
|
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter()); |
|
|
|
|
useOptimizedUPMCheckbox.setSelected(checkOptimizedUPMUse()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (useNewVersionLoginCheckbox != null) { |
|
|
|
@ -879,6 +1045,15 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
this.startupPageEnabledCheckBox.setSelected(designerEnvManager.isStartupPageEnabled()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean checkOptimizedUPMUse() { |
|
|
|
|
//如果是没手动配置过则默认开启
|
|
|
|
|
//isUseNewPluginFirst如果为true说明没手动配置过,直接开启
|
|
|
|
|
//走到这里说明checkBox不为空,机型肯定符合
|
|
|
|
|
return DesignerEnvManager.getEnvManager().isUseNewPluginFirst() |
|
|
|
|
|| ServerPreferenceConfig.getInstance().isUseOptimizedUPM() |
|
|
|
|
|| DesignerEnvManager.getEnvManager().isUseOptimizedUPM4Adapter(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int chooseCase(int sign) { |
|
|
|
|
switch (sign) { |
|
|
|
|
case 0: |
|
|
|
@ -898,6 +1073,14 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getDay(int dateIndex) { |
|
|
|
|
return INDEX_DAY_MAP.getOrDefault(dateIndex, THREE_MONTH_INT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getIndex(int day) { |
|
|
|
|
return INDEX_DAY_MAP.inverse().getOrDefault(day, THREE_MONTH_INDEX); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* The method of update. |
|
|
|
|
*/ |
|
|
|
@ -936,13 +1119,30 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected()); |
|
|
|
|
designerEnvManager.setEmbedServerLazyStartup(this.embedServerLazyStartupCheckBox.isSelected()); |
|
|
|
|
designerEnvManager.setImageCompress(this.imageCompressPanelCheckBox.isSelected()); |
|
|
|
|
designerEnvManager.setUseOptimizedUPM4Adapter(this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected()); |
|
|
|
|
designerEnvManager.setCloudAnalyticsDelay(this.cloudAnalyticsDelayCheckBox.isSelected()); |
|
|
|
|
boolean optimizedUPMFlag = this.useOptimizedUPMCheckbox != null && this.useOptimizedUPMCheckbox.isSelected(); |
|
|
|
|
designerEnvManager.setUseOptimizedUPM4Adapter(optimizedUPMFlag); |
|
|
|
|
//只有取消掉使用新插件管理器这个选项才需要把useNewPluginFirst置false(意味着用户手动配置了,如果勾选着的话,这个useNewPluginFirst为true就行了)
|
|
|
|
|
designerEnvManager.setUseNewPluginFirst(optimizedUPMFlag); |
|
|
|
|
boolean cloudDelayFlag = this.cloudAnalyticsDelayCheckBox.isSelected(); |
|
|
|
|
designerEnvManager.setCloudAnalyticsDelay(cloudDelayFlag); |
|
|
|
|
// cloudDelayFlag默认为true,如果用户手动配置过才会是false,则后续的云端运维配置都按照用户意愿来
|
|
|
|
|
designerEnvManager.setUseCloudAnalyticsDelayFirst(cloudDelayFlag); |
|
|
|
|
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); |
|
|
|
|
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); |
|
|
|
|
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); |
|
|
|
|
vcsConfigManager.setSaveCommit(this.saveCommitCheckBox.isSelected()); |
|
|
|
|
vcsConfigManager.setUseInterval(this.useIntervalCheckBox.isSelected()); |
|
|
|
|
vcsConfigManager.setUseAutoSave(this.useVcsAutoSaveScheduleCheckBox.isSelected()); |
|
|
|
|
vcsConfigManager.setAutoSaveInterval(this.autoSaveIntervalEditor.getValue()); |
|
|
|
|
Configurations.update(new WorkerAdaptor(VcsConfig.class) { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
VcsConfig.getInstance().setUseV2AutoClean(useVcsAutoCleanScheduleCheckBox.isSelected()); |
|
|
|
|
VcsConfig.getInstance().setV2CleanInterval(getDay(autoCleanIntervalComboBox.getSelectedIndex())); |
|
|
|
|
VcsConfig.getInstance().setV2RetainInterval(getDay(autoCleanRetainIntervalComboBox.getSelectedIndex())); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
dealWithSchedule(); |
|
|
|
|
designerEnvManager.setStartupPageEnabled(this.startupPageEnabledCheckBox.isSelected()); |
|
|
|
|
Configurations.update(new Worker() { |
|
|
|
|
@Override |
|
|
|
@ -1017,6 +1217,36 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void dealWithSchedule() { |
|
|
|
|
new SwingWorker<Void, Void>() { |
|
|
|
|
@Override |
|
|
|
|
protected Void doInBackground() throws Exception { |
|
|
|
|
boolean v2FunctionSupport = VcsHelper.getInstance().checkV2FunctionSupport(); |
|
|
|
|
if (v2FunctionSupport) { |
|
|
|
|
//如果支持V2
|
|
|
|
|
if (useVcsAutoSaveScheduleCheckBox.isSelected()) { |
|
|
|
|
FineLoggerFactory.getLogger().info("[VcsV2] start auto save!"); |
|
|
|
|
VcsHelper.getInstance().startAutoSave(autoSaveIntervalEditor.getValue()); |
|
|
|
|
} else { |
|
|
|
|
VcsHelper.getInstance().stopAutoSave(); |
|
|
|
|
} |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
}.execute(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果语言设置改变了,则显示重启对话框
|
|
|
|
|
public void showRestartDialog() { |
|
|
|
|
if (!languageChanged) { |
|
|
|
@ -1045,12 +1275,14 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BasicDialog showWindow(Window window) { |
|
|
|
|
return showWindow(window, new DialogActionAdapter() { |
|
|
|
|
basicDialog = showWindow(window, new DialogActionAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void doOk() { |
|
|
|
|
languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
movePanel.setParentDialog(basicDialog); |
|
|
|
|
return basicDialog; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|