Browse Source

PFC-607 插件安装删除更新不重启支持

fix
master
juhaoyu 8 years ago
parent
commit
8a10b3f7ce
  1. 6
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  2. 10
      designer_base/src/com/fr/design/extra/PluginUtils.java

6
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -63,8 +63,10 @@ public class PluginOperateUtils {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String latestPluginVersion = (String) latestPluginInfo.get("version"); String latestPluginVersion = (String) latestPluginInfo.get("version");
PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion); PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion);
PluginTask pluginTask = PluginTask.updateTask(pluginMarker, toPluginMarker); //当前已经安装的相同ID插件marker
PluginControllerHelper.updateOnline(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); PluginMarker currentMarker = PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID());
PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker);
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }

10
designer_base/src/com/fr/design/extra/PluginUtils.java

@ -11,6 +11,7 @@ import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -173,4 +174,13 @@ public class PluginUtils {
return ERROR_CODE_I18N_PREFIX + errorCode.getDescription(); return ERROR_CODE_I18N_PREFIX + errorCode.getDescription();
} }
public static PluginMarker getInstalledPluginMarkerByID(String pluginID) {
PluginContext context = PluginManager.getContext(pluginID);
if (context != null) {
return context.getMarker();
}
return null;
}
} }

Loading…
Cancel
Save