【问题标题】:Configuring Eclipse RCP Update manager配置 Eclipse RCP 更新管理器
【发布时间】:2011-10-29 19:27:02
【问题描述】:

我完成了我的 Eclipse RCP 应用程序并想要配置更新管理器。我的产品是基于功能的,更新工作正常,但我想限制用户。即强制一个特殊的更新站点或仅显示分组等。

我尝试使用 Policy 但它不起作用:

public class EPolicy extends Policy {
    public EPolicy() {
        setRepositoriesVisible(false);
        setGroupByCategory(false);
        setShowLatestVersionsOnly(false);
        setRestartPolicy(RESTART_POLICY_FORCE);
    }
}

在激活器中注册:

public void start(BundleContext context) throws Exception {
    super.start(context);
    Policy policy = new EPolicy();
    context.registerService(Policy.class.getName(), policy, null);
}

我错过了什么吗?

【问题讨论】:

    标签: eclipse-rcp p2


    【解决方案1】:

    尝试将您的策略​​设置为更高的排名,

    public void start(BundleContext context) throws Exception {
        super.start(context);
        Policy policy = new EPolicy();
        Dictionary props = new Hashtable();
        props.put(org.osgi.framework.Constants.SERVICE_RANKING, new Integer(99));
        context.registerService(Policy.class.getName(), policy, props);
    }
    

    【讨论】:

    • 成功了!谢谢。 2个小东西:是Dictionary,不是Directory,Constants的包名是org.osgi.framework.Constants
    猜你喜欢
    • 2011-09-27
    • 2011-07-09
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-08
    • 2010-09-15
    相关资源
    最近更新 更多