2013-03-12 16 views
0

我正在使用Eclipse RCP应用程序,并且正在为其配置p2更新。类型org.eclipse.equinox.p2.query.IQuery不可访问

我遇到了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扩展策略{

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访问。查询

我使用的Eclipse靛蓝(3.7)和我在插件中添加的依赖关系是:

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

请指引我。

回答

1

您需要输入org.eclipse.equinox.p2.metadata作为依赖关系