|
|
|
@ -10,6 +10,7 @@ import com.fr.design.extra.Process;
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
|
import com.fr.plugin.Plugin; |
|
|
|
|
import com.fr.plugin.PluginLoader; |
|
|
|
|
import com.fr.plugin.PluginVerifyException; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
@ -47,7 +48,9 @@ public class UpdateOnlineExecutor implements Executor {
|
|
|
|
|
LoginCheckContext.fireLoginCheckListener(); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(DesignerEnvManager.getEnvManager().getBBSName())) { |
|
|
|
|
try { |
|
|
|
|
for (int i = 0; i < pluginIDs.length; i++) { |
|
|
|
|
try { |
|
|
|
|
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]); |
|
|
|
|
String id = null; |
|
|
|
|
if (plugin != null) { |
|
|
|
@ -55,7 +58,6 @@ public class UpdateOnlineExecutor implements Executor {
|
|
|
|
|
} |
|
|
|
|
String username = DesignerEnvManager.getEnvManager().getBBSName(); |
|
|
|
|
String password = DesignerEnvManager.getEnvManager().getBBSPassword(); |
|
|
|
|
try { |
|
|
|
|
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() { |
|
|
|
|
@Override |
|
|
|
|
public void process(Double integer) { |
|
|
|
@ -64,7 +66,10 @@ public class UpdateOnlineExecutor implements Executor {
|
|
|
|
|
updateFileFromDisk(PluginHelper.getDownloadTempFile()); |
|
|
|
|
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%"); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
|
if (e instanceof PluginVerifyException) { |
|
|
|
|
throw (PluginVerifyException) e; |
|
|
|
|
} |
|
|
|
|
FRContext.getLogger().error(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
int rv = JOptionPane.showOptionDialog( |
|
|
|
@ -82,14 +87,16 @@ public class UpdateOnlineExecutor implements Executor {
|
|
|
|
|
if (rv == JOptionPane.OK_OPTION) { |
|
|
|
|
RestartHelper.restart(); |
|
|
|
|
} |
|
|
|
|
} catch (PluginVerifyException e) { |
|
|
|
|
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateFileFromDisk(File fileOnDisk) { |
|
|
|
|
try { |
|
|
|
|
private void updateFileFromDisk(File fileOnDisk) throws Exception { |
|
|
|
|
Plugin plugin = PluginHelper.readPlugin(fileOnDisk); |
|
|
|
|
if (plugin == null) { |
|
|
|
|
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
|
|
@ -106,8 +113,5 @@ public class UpdateOnlineExecutor implements Executor {
|
|
|
|
|
} else { |
|
|
|
|
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e1) { |
|
|
|
|
JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|