Browse Source

REPORT-19946 Linux设计器

persist/11.0
pengda 5 years ago
parent
commit
0b2406d64c
  1. 21
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  2. 3
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  3. 12
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  4. 5
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  5. 12
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  6. 3
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  7. 13
      designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java
  8. 11
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  9. 20
      designer-base/src/main/java/com/fr/start/Demo.java
  10. 10
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  11. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

21
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -5,7 +5,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
@ -168,10 +168,13 @@ public class RestartHelper {
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (OperatingSystem.isMacOS()) {
if (OperatingSystem.isMacos()) {
restartInMacOS(installHome, filesToBeDelete);
} else {
} else if(OperatingSystem.isWindows()){
restartInWindows(installHome, filesToBeDelete);
}else{
//增加一个Linux系统
restartInLinux(installHome,filesToBeDelete);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -210,4 +213,16 @@ public class RestartHelper {
builder.command(commands);
builder.start();
}
private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
//现在先写的是restart.sh
commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
}

3
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -16,6 +16,7 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
@ -60,7 +61,7 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();

12
designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java

@ -5,7 +5,10 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.general.IOUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -16,18 +19,21 @@ import java.awt.event.ActionEvent;
* @since 8.0
*/
public class PluginManagerAction extends UpdateAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
public PluginManagerAction() {
this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
// 可以启用新版本的插件商店(使用JxBrowser作为容器)
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
if(Arch.getArch() == Arch.ARM){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();

5
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.stable.os.OperatingSystem;
import javax.swing.JDialog;
import javax.swing.JLabel;
@ -28,7 +29,9 @@ public class ProgressDialog extends UIDialog {
setUndecorated(true);
setSize(parent.getSize());
setLocationRelativeTo(null);
setOpacity(0.5f);
if(!OperatingSystem.isLinux()) {
setOpacity(0.5f);
}
initComponent();
}

12
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -58,6 +58,7 @@ import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.os.Arch;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
@ -456,13 +457,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
northEastPane.add(LogMessageBar.getInstance());
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor != null) {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
if(Arch.getArch() != Arch.ARM) {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}else{
//暂时不知道具体插件,先传null
processor.hold(northEastPane, LogMessageBar.getInstance(), null);
}
}
northEastPane.add(ad.createAlphaFinePane());
if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
ad.createAlphaFinePane().setVisible(false);
}
northEastPane.add(ad.createBBSLoginPane());
if(Arch.getArch() != Arch.ARM) {
northEastPane.add(ad.createBBSLoginPane());
}
}
public void initTitleIcon() {

3
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -70,6 +70,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable;
@ -540,7 +541,7 @@ public abstract class ToolBarMenuDock {
}
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
if (DesignerEnvManager.getEnvManager().isOpenDebug() && !OperatingSystem.isLinux()) {
shortCuts.add(new FineUIAction());
}
shortCuts.add(new AboutAction());

13
designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java

@ -4,6 +4,8 @@ import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import java.awt.event.ActionEvent;
@ -12,7 +14,7 @@ import java.awt.event.ActionEvent;
*/
public class SoftwareUpdateAction extends UpdateAction {
private static String UPDATE_ROUTE = "#management/backup";
public SoftwareUpdateAction() {
setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade"));
setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png"));
@ -26,8 +28,13 @@ public class SoftwareUpdateAction extends UpdateAction {
*/
@Override
public void actionPerformed(ActionEvent e) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
//说之后更新升级要用jxbrowser,Linux下进平台
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
}
}

11
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -12,6 +12,7 @@ import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.workspace.WorkContext;
import java.util.concurrent.ExecutorService;
@ -87,13 +88,13 @@ public class DesignerPushUpdateManager {
public boolean isAutoPushUpdateSupported() {
boolean isLocalEnv = WorkContext.getCurrent().isLocal();
boolean isChineseEnv = GeneralContext.isChineseEnv();
return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv);
boolean isLinux = OperatingSystem.isLinux();
return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv,isLinux);
}
private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv) {
// 远程设计和非中文环境,都不生效
return isLocalEnv && isChineseEnv;
private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv,boolean isLinux) {
// 远程设计和非中文环境以及Linux环境,都不生效
return isLocalEnv && isChineseEnv && !isLinux;
}
/**

20
designer-base/src/main/java/com/fr/start/Demo.java

@ -2,7 +2,7 @@ package com.fr.start;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.OperatingSystem;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.StableUtils;
import java.io.IOException;
@ -17,13 +17,15 @@ public class Demo {
String executorPath;
if (OperatingSystem.isMacOS()) {
if (OperatingSystem.isMacos()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else {
} else if(OperatingSystem.isWindows()){
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}else{
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo");
}
if (OperatingSystem.isMacOS()) {
if (OperatingSystem.isMacos()) {
ProcessBuilder builder = new ProcessBuilder();
builder.command("open", "-a", executorPath, "--args", "demo");
try {
@ -31,7 +33,7 @@ public class Demo {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else {
} else if(OperatingSystem.isWindows()){
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
@ -39,6 +41,14 @@ public class Demo {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}else{
//先用和win一样的方式
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
System.exit(0);

10
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -28,7 +28,8 @@ import com.fr.general.DateUtils;
import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
@ -142,7 +143,8 @@ public class UserInfoLabel extends UILabel {
@Override
public void run() {
// vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。
if (!FRContext.isChineseEnv() || OperatingSystem.isMacOS()) {
//ARM下暂时也不能用javafx
if (!shouldShowBBSDialog()) {
return;
}
String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime();
@ -242,6 +244,10 @@ public class UserInfoLabel extends UILabel {
}
}
private static boolean shouldShowBBSDialog(){
return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM;
}
public String getUserName() {
return userName;
}

5
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -91,6 +91,7 @@ import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.os.Arch;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter;
@ -125,7 +126,9 @@ public class DesignerActivator extends Activator {
designerModuleStart();
loadLogAppender();
DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo();
if(Arch.getArch() != Arch.ARM) {
UserInfoPane.getInstance().updateBBSUserInfo();
}
storePassport();
AlphaFineHelper.switchConfig4Locale();
}

Loading…
Cancel
Save