Question

i finished my Eclipse RCP Application and wanted to configure the update manager. My Product is feature based and updates are working like they should, but i want to limit the user. i.e. force a special update site or display only grouped etc.

I tried using Policy but it does not work:

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

registering in the Activator:

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

am i missing something?

Was it helpful?

Solution

Try to set your policy with higher ranking,

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);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top