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.design.i18n.Toolkit;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory;
import java.util.concurrent.ExecutionException;
import javax.swing.JProgressBar;
@ -13,6 +14,7 @@ import javax.swing.SwingWorker;
public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
private String buildNo;
private JProgressBar bar;
private JSONArray syncFailedPlugins;
public SyncFileProcess(JProgressBar bar, String buildNo) {
this.bar = bar;
@ -22,13 +24,10 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
@Override
protected Boolean doInBackground() throws Exception {
UpdateCallBack callBack = new UpdateProgressCallBack(bar);
boolean result = SyncExecutor.getInstance().execute(callBack, buildNo);
if (result) {
bar.setValue(0);
bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
}
return result;
bar.setValue(0);
bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
return SyncExecutor.getInstance().execute(callBack, buildNo);
}
@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;
}
public static void syncPlugins(JSONArray differentPlugins) {
public static JSONArray syncPlugins(JSONArray differentPlugins) {
Set<String> uninstallFailed = uninstallPlugins(differentPlugins);
List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed);
installPlugins(plugins);
return getPluginsSyncFailed(differentPlugins);
}
private static List<PluginMarker> getSyncPlugins(JSONArray differentPlugins, Set<String> uninstallFailed) {
@ -302,7 +303,7 @@ public class VersionCheckUtils {
return uninstallFailedID;
}
public static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){
private static JSONArray getPluginsSyncFailed(JSONArray differentPlugins){
JSONArray pluginsNeedSync = JSONArray.create();
List<PluginContext> localPlugins = PluginManager.getContexts();
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 RestartHelper helper = new RestartHelper();
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(),JSONArray.create());
new SyncFileProcess(progressBar, remoteBuildNo) {
@Override
public void onDownloadSuccess() {
deleteForDesignerUpdate(installLib);
progressBar.setVisible(false);
JSONArray syncFailedPlugins = VersionCheckUtils.getPluginsSyncFailed(differentPlugins);
JSONArray syncFailedPlugins = getSyncFailedPlugins();
if (syncFailedPlugins.size() > 0) {
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(), syncFailedPlugins);
syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins);
syncFailedPluginsDialog.setVisible(true);
}
helper.restartForUpdate(frame);
@ -352,8 +353,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
protected JSONArray doInBackground() {
progressBar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
progressBar.setValue(0);
VersionCheckUtils.syncPlugins(differentPlugins);
return VersionCheckUtils.getPluginsSyncFailed(differentPlugins);
return VersionCheckUtils.syncPlugins(differentPlugins);
}
@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 {
private UILabel detailsLabel;
private JScrollPane scrollPane;
private UITextArea detailsTextArea;
public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) {
super(parent, true);
JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane();
@ -70,14 +71,9 @@ public class SyncFailedPluginsDialog extends JDialog {
detailsTitlePanel.add(detailsLabel);
detailsTitlePanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
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 = new UITextArea();
detailsTextArea.setEditable(false);
showSyncFailedPluginsInfo(syncFailedPlugins);
scrollPane = new JScrollPane(detailsTextArea);
centerPanel.add(detailsTitlePanel,BorderLayout.NORTH);
centerPanel.add(scrollPane,BorderLayout.CENTER);
@ -98,6 +94,18 @@ public class SyncFailedPluginsDialog extends JDialog {
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() {
@Override
public void mouseClicked(MouseEvent e) {

Loading…
Cancel
Save