|
|
@ -10,6 +10,7 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.event.Listener; |
|
|
|
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
@ -17,6 +18,7 @@ import com.fr.workspace.WorkspaceEvent; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author richie |
|
|
|
* @author richie |
|
|
@ -27,6 +29,7 @@ public class UpmFinder { |
|
|
|
|
|
|
|
|
|
|
|
private static final String UPM_DIR = "/upm"; |
|
|
|
private static final String UPM_DIR = "/upm"; |
|
|
|
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; |
|
|
|
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; |
|
|
|
|
|
|
|
private static final String JXBROWSER = "com.teamdev.jxbrowser.chromium.Browser"; |
|
|
|
|
|
|
|
|
|
|
|
public static String installHome = FRContext.getCommonOperator().getWebRootPath(); |
|
|
|
public static String installHome = FRContext.getCommonOperator().getWebRootPath(); |
|
|
|
|
|
|
|
|
|
|
@ -56,39 +59,49 @@ public class UpmFinder { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void showUPMDialog() { |
|
|
|
public static void showUPMDialog() { |
|
|
|
boolean flag = true; |
|
|
|
boolean hasJxBrowser = true; |
|
|
|
try { |
|
|
|
try { |
|
|
|
Class.forName("com.teamdev.jxbrowser.chromium.Browser"); |
|
|
|
Class.forName(JXBROWSER); |
|
|
|
} catch (ClassNotFoundException e) { |
|
|
|
} catch (ClassNotFoundException e) { |
|
|
|
flag = false; |
|
|
|
hasJxBrowser = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag) { |
|
|
|
if (hasJxBrowser) { |
|
|
|
if (!checkUPMResourcesExist()){ |
|
|
|
showUpmPane(); |
|
|
|
// upm下载
|
|
|
|
} else { |
|
|
|
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), |
|
|
|
showUpdatePane(); |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); |
|
|
|
} |
|
|
|
if (val == JOptionPane.OK_OPTION){ |
|
|
|
} |
|
|
|
try { |
|
|
|
|
|
|
|
UpmResourceLoader.INSTANCE.download(); |
|
|
|
private static void showUpmPane() { |
|
|
|
UpmResourceLoader.INSTANCE.install(); |
|
|
|
if (!checkUPMResourcesExist()){ |
|
|
|
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), |
|
|
|
// upm下载
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), |
|
|
|
} catch (Exception e){ |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
if (val == JOptionPane.OK_OPTION){ |
|
|
|
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), |
|
|
|
try { |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
UpmResourceLoader.INSTANCE.download(); |
|
|
|
} |
|
|
|
UpmResourceLoader.INSTANCE.install(); |
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
|
|
|
} 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 { |
|
|
|
} |
|
|
|
UpmShowPane upmPane = new UpmShowPane(); |
|
|
|
else { |
|
|
|
if (dialog == null) { |
|
|
|
UpmShowPane upmPane = new UpmShowPane(); |
|
|
|
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); |
|
|
|
if (dialog == null) { |
|
|
|
} |
|
|
|
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); |
|
|
|
dialog.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
dialog.setVisible(true); |
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void showUpdatePane() { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); |
|
|
|
|
|
|
|
if (!GeneralContext.getLocale().equals(Locale.JAPAN)) { |
|
|
|
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); |
|
|
|
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); |
|
|
|
dialog.setAutoUpdateAfterInit(); |
|
|
|
dialog.setAutoUpdateAfterInit(); |
|
|
|
dialog.showDialog(); |
|
|
|
dialog.showDialog(); |
|
|
|