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

有帮助吗?

解决方案

我寻找同样的事情,发现在该链路中的溶液:

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.preferencePages看看:id="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;
}//

其他提示

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

  • 定义对应于不同访问级别的单独活动
  • 在常规操作集中定义您的操作,并根据访问级别进行分组
  • 通过将每个活动与适当的操作集关联起来 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, ,这也将处理安全存储首选项页面。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top