14

我有一个 Eclipse rcp 并想隐藏安全和帮助页面。我怎样才能做到这一点?

4

2 回答 2

18

我一直在寻找同样的东西,并在此链接中找到了解决方案:

http://sourceforge.net/apps/trac/fable/wiki/Preferences

干杯。斯特凡


禁用帮助首选项

将以下代码放入您的子类中org.eclipse.ui.application.WorkbenchAdvisor,它会从 RCP 首选项对话框中删除“帮助”组:

public void postStartup() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );
    pm.remove( "org.eclipse.help.ui.browsersPreferencePage" );
}

org.eclipse.help.ui.browsersPreferencePage”是首选项扩展点的 ID。
添加透视偏好¶

备注:要查找插件 id 首选项,请选择Window-->show view--> PDE Runtime--> Plugin Registry.....并尝试查找您要查找的内容.....
例如,对于“ Workbench preferences”,请查看fable.eclipse.ui.ide和扩展org.eclipse.ui.preferencePagesid="org.eclipse.ui.preferencePages.Workbench"

如果您只想添加透视(例如)首选项,请在以下位置添加首选项扩展MANIFEST.XML

id : org.eclipse.ui.preferencePages.Perspectives
name:perspective(fable)
class:org.eclipse.ui.internal.ide.dialogs.IDEPerspectivesPreferencePage

//Add : org.eclipse.ui.ide in your Dependencies

在 ApplicationWorkBenchAdvisor 中:

public void postStartup() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );

    pm.remove( ""org.eclipse.ui.preferencePages.Workbench"browsersPreferencePage" );
}

public String getInitialWindowPerspectiveId() {
    IPreferenceStore pref = Activator.getDefault().getPreferenceStore();
    String ret = pref.getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
    ret=(ret==null || ret.equals(""))?"yourDefaultPerspectiveID":ret;
    return ret;
}//
于 2009-11-23T22:47:12.737 回答
7

根据此条目,您可以使用“工作台活动”机制,并且:

  • 定义对应于不同访问级别的单独活动
  • 在常规操作集中定义您的操作,根据访问级别分组
  • activityPatternBinding通过元素将每个活动与适当的动作集相关联
  • 在身份验证后设置启用的活动 ID,在工作台生命周期的早期,例如从您WorkbenchAdvisorpreStartup()方法。

(注意,以上是基于用户权限的过滤,但它可以推广到其他标准。)


关于存储和帮助的首选项页面,您应该将这些页面的 id 与您知道可以禁用的活动绑定:

<activityPatternBinding
  activityId="org.eclipse.javaDevelopment"
  pattern="org\.eclipse\.help\..*/.*">
</activityPatternBinding>

将禁用与帮助相关的所有菜单/首选项/视图。

如果你使用org.eclipse.help.ui.PrefPageHelp\..*,它只会绑定prefPageHelpprefPageHelpContent

如果您使用 添加另一个活动绑定扩展 org.eclipse.equinox.security.ui.sec_storage_preferences_context,这也将负责安全存储首选项页面。

于 2009-09-22T16:00:45.840 回答