|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
package com.fr.design.upm; |
|
|
|
|
|
|
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader; |
|
|
|
|
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; |
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
|
@ -12,8 +12,11 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog;
|
|
|
|
|
import com.fr.event.Event; |
|
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
|
import com.fr.event.Listener; |
|
|
|
|
import com.fr.general.CommonIOUtils; |
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.plugin.PluginStoreConstants; |
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
|
import com.fr.workspace.WorkspaceEvent; |
|
|
|
@ -33,7 +36,7 @@ public class UpmFinder {
|
|
|
|
|
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; |
|
|
|
|
private static final String JXBROWSER = "com.teamdev.jxbrowser.browser.Browser"; |
|
|
|
|
|
|
|
|
|
public static String installHome = FRContext.getCommonOperator().getWebRootPath(); |
|
|
|
|
public static String installHome = PluginStoreConstants.getLocalInstallHome(); |
|
|
|
|
|
|
|
|
|
private static UIDialog dialog = null; |
|
|
|
|
|
|
|
|
@ -41,7 +44,8 @@ public class UpmFinder {
|
|
|
|
|
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() { |
|
|
|
|
@Override |
|
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
|
installHome = FRContext.getCommonOperator().getWebRootPath(); |
|
|
|
|
installHome = PluginStoreConstants.getLocalInstallHome(); |
|
|
|
|
UpmResourceLoader.INSTANCE.checkOldShopFile(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -75,24 +79,24 @@ public class UpmFinder {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void showUpmPane() { |
|
|
|
|
if (!checkUPMResourcesExist()){ |
|
|
|
|
if (!checkUPMResourcesExist()) { |
|
|
|
|
// upm下载
|
|
|
|
|
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
if (val == JOptionPane.OK_OPTION){ |
|
|
|
|
if (val == JOptionPane.OK_OPTION) { |
|
|
|
|
try { |
|
|
|
|
UpmResourceLoader.INSTANCE.download(); |
|
|
|
|
UpmResourceLoader.INSTANCE.install(); |
|
|
|
|
installUpmResource(); |
|
|
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
} catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
UpmShowPane upmPane = new UpmShowPane(); |
|
|
|
|
if (dialog == null) { |
|
|
|
|
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); |
|
|
|
@ -102,6 +106,15 @@ public class UpmFinder {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void installUpmResource() { |
|
|
|
|
String installHome = PluginStoreConstants.getLocalInstallHome(); |
|
|
|
|
File scriptZip = new File(BaseResourceLoader.SCRIPT_DOWNLOAD_PATH); |
|
|
|
|
if (scriptZip.exists()) { |
|
|
|
|
IOUtils.unzip(scriptZip, installHome); |
|
|
|
|
CommonIOUtils.deleteFile(scriptZip); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void showUpdatePane() { |
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); |
|
|
|
|
if (!GeneralContext.getLocale().equals(Locale.JAPANESE) && !GeneralContext.getLocale().equals(Locale.JAPAN) |
|
|
|
|