Question

I was working Eclipse RCP application and I was configuring p2 updates for it.

I came across this example.

package org.eclipse.equinox.p2.examples.rcp.cloud.p2;

import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery; import org.eclipse.equinox.p2.examples.rcp.cloud.Activator; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.ui.Policy; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.graphics.Point;

/** * CloudPolicy defines the RCP Cloud Example policies for the p2 UI. The policy * is registered as an OSGi service when the example bundle starts. * * @since 3.5 */ public class CloudPolicy extends Policy {

public void updateForPreferences() {
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    setRepositoriesVisible(prefs
            .getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
    setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
    setShowLatestVersionsOnly(prefs
            .getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
    setGroupByCategory(prefs
            .getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
    setShowDrilldownRequirements(prefs
            .getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
    setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV));
    setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE));
    int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH);
    int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT);
    setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight));      

    if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
        setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
    else
        setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
    if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
        setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
    else
        setVisibleAvailableIUQuery(new UserVisibleRootQuery());

    }
}

Here the type IQuery and QueryUtil are not accessible as I am not able to access the package org.eclipse.equinox.p2.query

I am using eclipse Indigo (3.7) and the dependencies I have added in my plug-in are:

org.eclipse.equinox.p2.ui.sdk
org.eclipse.equinox.p2.ui
org.eclipse.equinox.p2.engine

Kindly guide me.

Was it helpful?

Solution

You need to import org.eclipse.equinox.p2.metadata as dependency

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top