Browse Source

REPORT-53651 远程环境检测及同步-插件同步成功后,设计器没自动重启

feature/10.0
pengda 4 years ago
parent
commit
24f4a68eca
  1. 17
      designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java
  2. 5
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  3. 8
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  4. 22
      designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java

17
designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java

@ -5,6 +5,7 @@ import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack; import com.fr.decision.update.info.UpdateProgressCallBack;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.versioncheck.VersionCheckUtils; import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
@ -13,6 +14,7 @@ import javax.swing.SwingWorker;
public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> { public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
private String buildNo; private String buildNo;
private JProgressBar bar; private JProgressBar bar;
private JSONArray syncFailedPlugins;
public SyncFileProcess(JProgressBar bar, String buildNo) { public SyncFileProcess(JProgressBar bar, String buildNo) {
this.bar = bar; this.bar = bar;
@ -22,13 +24,10 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
@Override @Override
protected Boolean doInBackground() throws Exception { protected Boolean doInBackground() throws Exception {
UpdateCallBack callBack = new UpdateProgressCallBack(bar); UpdateCallBack callBack = new UpdateProgressCallBack(bar);
boolean result = SyncExecutor.getInstance().execute(callBack, buildNo); bar.setValue(0);
if (result) { bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
bar.setValue(0); syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); return SyncExecutor.getInstance().execute(callBack, buildNo);
VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
}
return result;
} }
@Override @Override
@ -49,6 +48,10 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
} }
} }
public JSONArray getSyncFailedPlugins(){
return syncFailedPlugins;
}
/** /**
* 下载成功 * 下载成功
*/ */

5
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -243,10 +243,11 @@ public class VersionCheckUtils {
return differentPlugins; return differentPlugins;
} }
public static void syncPlugins(JSONArray differentPlugins) { public static JSONArray syncPlugins(JSONArray differentPlugins) {
Set<String> uninstallFailed = uninstallPlugins(differentPlugins); Set<String> uninstallFailed = uninstallPlugins(differentPlugins);
List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed); List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed);
installPlugins(plugins); installPlugins(plugins);
return getPluginsSyncFailed(differentPlugins);
} }
private static List<PluginMarker> getSyncPlugins(JSONArray differentPlugins, Set<String> uninstallFailed) { private static List<PluginMarker> getSyncPlugins(JSONArray differentPlugins, Set<String> uninstallFailed) {
@ -302,7 +303,7 @@ public class VersionCheckUtils {
return uninstallFailedID; return uninstallFailedID;
} }
public static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){ private static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){
JSONArray pluginsNeedSync = JSONArray.create(); JSONArray pluginsNeedSync = JSONArray.create();
List<PluginContext> localPlugins = PluginManager.getContexts(); List<PluginContext> localPlugins = PluginManager.getContexts();
Map<String, String> localPluginsInfo = new HashMap<>(); Map<String, String> localPluginsInfo = new HashMap<>();

8
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -322,14 +322,15 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
final JFrame frame = DesignerContext.getDesignerFrame(); final JFrame frame = DesignerContext.getDesignerFrame();
final RestartHelper helper = new RestartHelper(); final RestartHelper helper = new RestartHelper();
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(),JSONArray.create());
new SyncFileProcess(progressBar, remoteBuildNo) { new SyncFileProcess(progressBar, remoteBuildNo) {
@Override @Override
public void onDownloadSuccess() { public void onDownloadSuccess() {
deleteForDesignerUpdate(installLib); deleteForDesignerUpdate(installLib);
progressBar.setVisible(false); progressBar.setVisible(false);
JSONArray syncFailedPlugins = VersionCheckUtils.getPluginsSyncFailed(differentPlugins); JSONArray syncFailedPlugins = getSyncFailedPlugins();
if (syncFailedPlugins.size() > 0) { if (syncFailedPlugins.size() > 0) {
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins); syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins);
syncFailedPluginsDialog.setVisible(true); syncFailedPluginsDialog.setVisible(true);
} }
helper.restartForUpdate(frame); helper.restartForUpdate(frame);
@ -352,8 +353,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
protected JSONArray doInBackground() { protected JSONArray doInBackground() {
progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins")); progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
progressBar.setValue(0); progressBar.setValue(0);
VersionCheckUtils.syncPlugins(differentPlugins); return VersionCheckUtils.syncPlugins(differentPlugins);
return VersionCheckUtils.getPluginsSyncFailed(differentPlugins);
} }
@Override @Override

22
designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java vendored

@ -38,6 +38,7 @@ import javax.swing.UIManager;
public class SyncFailedPluginsDialog extends JDialog { public class SyncFailedPluginsDialog extends JDialog {
private UILabel detailsLabel; private UILabel detailsLabel;
private JScrollPane scrollPane; private JScrollPane scrollPane;
private UITextArea detailsTextArea;
public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) { public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) {
super(parent, true); super(parent, true);
JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane();
@ -70,14 +71,9 @@ public class SyncFailedPluginsDialog extends JDialog {
detailsTitlePanel.add(detailsLabel); detailsTitlePanel.add(detailsLabel);
detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
UITextArea detailsTextArea = new UITextArea(); detailsTextArea = new UITextArea();
StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY);
for (int i = 0; i < syncFailedPlugins.size(); i++) {
JSONObject plugin = syncFailedPlugins.getJSONObject(i);
detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n");
}
detailsTextArea.setText(detailsText.toString());
detailsTextArea.setEditable(false); detailsTextArea.setEditable(false);
showSyncFailedPluginsInfo(syncFailedPlugins);
scrollPane = new JScrollPane(detailsTextArea); scrollPane = new JScrollPane(detailsTextArea);
centerPanel.add(detailsTitlePanel,BorderLayout.NORTH); centerPanel.add(detailsTitlePanel,BorderLayout.NORTH);
centerPanel.add(scrollPane,BorderLayout.CENTER); centerPanel.add(scrollPane,BorderLayout.CENTER);
@ -98,6 +94,18 @@ public class SyncFailedPluginsDialog extends JDialog {
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }
public void showSyncFailedPluginsInfo(JSONArray syncFailedPlugins){
if(null == syncFailedPlugins){
return;
}
StringBuilder detailsText = new StringBuilder(StringUtils.EMPTY);
for (int i = 0; i < syncFailedPlugins.size(); i++) {
JSONObject plugin = syncFailedPlugins.getJSONObject(i);
detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n");
}
detailsTextArea.setText(detailsText.toString());
}
private MouseListener detailsLabelClickListener = new MouseAdapter() { private MouseListener detailsLabelClickListener = new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {

Loading…
Cancel
Save