Browse Source
调整一下环境检测相关的内容 1-国际化效果\通过 html 封装 text 实现替换逻辑 2-补充注释 3-添加 EnvPrepare 注入到环境中,用来帮助环境启动时的一些相关钩子的启动feature/x
Harrison
3 years ago
21 changed files with 314 additions and 164 deletions
@ -0,0 +1,21 @@
|
||||
package com.fr.env.detect; |
||||
|
||||
import com.fr.module.Activator; |
||||
|
||||
/** |
||||
* 设计器环境准备 |
||||
* |
||||
* created by Harrison on 2022/05/29 |
||||
**/ |
||||
public class EnvPrepare extends Activator { |
||||
|
||||
@Override |
||||
public void start() { |
||||
EnvDetectorCenter.getInstance().init(); |
||||
} |
||||
|
||||
@Override |
||||
public void stop() { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,59 @@
|
||||
package com.fr.env.detect.base; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLable; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* created by Harrison on 2022/05/13 |
||||
**/ |
||||
public class EnvDetectorConfig implements XMLable { |
||||
|
||||
public static final String XML_TAG = "EnvDetectorConfig"; |
||||
|
||||
private static final long serialVersionUID = -8170289826729582122L; |
||||
|
||||
private static final EnvDetectorConfig INSTANCE = new EnvDetectorConfig(); |
||||
|
||||
public static EnvDetectorConfig getInstance() { |
||||
|
||||
return INSTANCE; |
||||
} |
||||
|
||||
private boolean enabled = true; |
||||
|
||||
public boolean isEnabled() { |
||||
return enabled; |
||||
} |
||||
|
||||
public void setEnabled(boolean enabled) { |
||||
this.enabled = enabled; |
||||
save(); |
||||
} |
||||
|
||||
private void save() { |
||||
|
||||
DesignerEnvManager.getEnvManager(false).saveXMLFile(); |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
return super.clone(); |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
if (reader.isAttr()) { |
||||
this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
writer.startTAG(XML_TAG); |
||||
writer.attr("isEnabled", this.isEnabled()); |
||||
writer.end(); |
||||
} |
||||
|
||||
} |
@ -1,34 +0,0 @@
|
||||
package com.fr.env.detect.base; |
||||
|
||||
import com.fr.config.ConfigContext; |
||||
import com.fr.config.DefaultConfiguration; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.factory.Holders; |
||||
|
||||
/** |
||||
* created by Harrison on 2022/05/13 |
||||
**/ |
||||
public class ExceptionDetectorConfig extends DefaultConfiguration { |
||||
|
||||
private static volatile ExceptionDetectorConfig instance = null; |
||||
|
||||
public static ExceptionDetectorConfig getInstance() { |
||||
|
||||
if (instance == null) { |
||||
instance = ConfigContext.getConfigInstance(ExceptionDetectorConfig.class); |
||||
} |
||||
return instance; |
||||
} |
||||
|
||||
private final Conf<Boolean> open = Holders.simple(true); |
||||
|
||||
public void setOpen(boolean open) { |
||||
|
||||
this.open.set(open); |
||||
} |
||||
|
||||
public boolean isOpen() { |
||||
|
||||
return open.get(); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.env.detect.ui; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* 工具栏里面的行为 |
||||
* |
||||
* created by Harrison on 2022/05/29 |
||||
**/ |
||||
public class EnvDetectorAction extends UpdateAction { |
||||
|
||||
public EnvDetectorAction() { |
||||
|
||||
this.setName(Toolkit.i18nText("Fine-Design_Basic_Detect_Toolbar_Title")); |
||||
this.setSmallIcon("com/fr/env/detect/detect_normal.svg"); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
|
||||
EnvDetectorDialog dialog = new EnvDetectorDialog(DesignerContext.getDesignerFrame()); |
||||
dialog.setVisible(true); |
||||
} |
||||
} |
After Width: | Height: | Size: 685 B |
Loading…
Reference in new issue