2009-09-22 67 views
12

我有一個Eclipse RCP和要隱藏的安全和幫助prerence頁面隱藏首選項頁面。我怎樣才能做到這一點?HOWTO在Eclipse RCP

+0

屬於SU。 – 2009-09-22 15:29:22

+0

你的意思是你是RCP軟件的開發者? – 2009-09-22 15:33:00

+0

我是devleoper,但首選項頁面來自其他插件,例如幫助插件。 – 2009-09-23 07:07:09

回答

17

我一直在尋找同樣的東西,發現這個鏈接的解決方案:

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。
添加透視偏好¶

備註:要查找插件標識首選項,請選擇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 

In 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; 
}// 
+0

這實際上是我所尋找的,謝謝 – 2009-11-25 11:17:12

+0

良好的捕獲+1。我在這裏導入了wiki頁面。這樣,如果sourceforge項目出現故障,信息仍然可以在這裏找到。 – VonC 2009-11-25 11:36:53

+1

查找偏好ID的另一個好方法是打開插件註冊表...然後去下插件org.eclipse.ui ...展開它...然後展開擴展點,然後展開org.eclipse.ui.preferencePages,這將包含添加到您用於開發的Eclipse的所有首選項的列表。 – nbz 2013-02-04 11:18:25

6

this entry,您可以使用"workbench activities"機制和:

  • 定義對應不同的訪問級別
  • 在常規動作集定義自己的行爲單獨活動,根據分組訪問級別
  • 準經由 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,那麼這也將處理安全存儲首選項頁面。

+0

我設法隱藏自己的視圖和優先頁面,但存儲和幫助的首選頁面仍然存在:( – 2009-09-23 08:26:19