键入org.eclipse.equinox.p2.query.IQuery无法访问

时间:2013-03-12 17:24:41

标签: eclipse eclipse-rcp p2

我正在使用Eclipse RCP应用程序,我正在为它配置p2更新。

我遇到了this示例。

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为p2 UI定义RCP云示例​​策略。政策  *示例包启动时,*被注册为OSGi服务。  *  * @since 3.5  * / 公共类CloudPolicy扩展了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());

    }
}

此处类型IQuery和QueryUtil无法访问,因为我无法访问包org.eclipse.equinox.p2.query

我正在使用eclipse Indigo(3.7),我在插件中添加的依赖项是:

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

请指导我。

1 个答案:

答案 0 :(得分:1)

您需要导入org.eclipse.equinox.p2.metadata作为依赖