Browse Source

REPORT-22877 远程环境判断是否集群

feature/big-screen
rinoux 5 years ago
parent
commit
bc56123007
  1. 38
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  3. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 5
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

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

@ -1,7 +1,5 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -47,10 +45,36 @@ import com.fr.workspace.WorkContext;
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 javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.event.*; import javax.swing.BoxLayout;
import java.awt.*; import javax.swing.JDialog;
import java.awt.event.*; import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.KeyStroke;
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.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.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Locale; import java.util.Locale;
@ -663,7 +687,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (FineClusterConfig.getInstance().isCluster()) { if (WorkContext.getCurrent().isCluster()) {
vcsEnableCheckBox.setEnabled(false); vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false); gcEnableCheckBox.setEnabled(false);
} }

6
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,5 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.remote.ClusterOperator;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -67,6 +68,11 @@ public class RemoteWorkspace implements Workspace {
return isRoot; return isRoot;
} }
@Override
public boolean isCluster() {
return WorkContext.getCurrent().get(ClusterOperator.class).isCluster();
}
@Override @Override
public WorkspaceConnection getConnection() { public WorkspaceConnection getConnection() {

4
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -3,8 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -369,7 +367,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void fireVcsActionChange() { private void fireVcsActionChange() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
|| VcsHelper.getInstance().isUnSelectedTemplate() || VcsHelper.getInstance().isUnSelectedTemplate()
|| FineClusterConfig.getInstance().isCluster()) { || WorkContext.getCurrent().isCluster()) {
setEnabled(false); setEnabled(false);
return; return;
} }

5
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.vcs.common; package com.fr.design.mainframe.vcs.common;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
@ -27,7 +25,6 @@ import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.Color; import java.awt.Color;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -174,7 +171,7 @@ public class VcsHelper implements JTemplateActionListener {
public void templateSaved(JTemplate<?, ?> jt) { public void templateSaved(JTemplate<?, ?> jt) {
if (needInit() if (needInit()
&& DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() && DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
&& !FineClusterConfig.getInstance().isCluster()) { && !WorkContext.getCurrent().isCluster()) {
fireVcs(jt); fireVcs(jt);
} }
} }

Loading…
Cancel
Save