Absurd-Mind
Absurd-Mind

Reputation: 7994

Configuring Eclipse RCP Update manager

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?

Upvotes: 2

Views: 340

Answers (1)

Kane
Kane

Reputation: 8172

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);
}

Upvotes: 1

Related Questions