0
我們使用的JFace PreferenceDialog
有一個錯誤,其中由IPersistentPreferenceStore#save()
引發的異常未得到處理,並且對話框僅在用戶意識到出現問題時才關閉。如何替換默認處理程序
因此,我創建了我自己的解決此問題的類的實現,並且「僅」需要以某種方式替換由命令org.eclipse.ui.window.preferences
定義的默認處理程序。
一般情況下我做這樣的事情:
<extension point="org.eclipse.ui.activities">
<activity id="org.acme.preference.oldPreferenceDialog" name="Remove Preference Dialog">
<enabledWhen>
<with variable="selection">
<count value="-1" />
</with>
</enabledWhen>
</activity>
<activityPatternBinding
activityId="org.acme.preference.oldPreferenceDialog"
isEqualityPattern="true"
pattern="org.eclipse.ui/org.eclipse.ui.window.preferences" />
</activityPatternBinding>
</extension>
這在某種程度上完全適用於每一個命令,但是上面。但即使它工作了也不會做我想要的 - 我仍然想要命令,我只想禁用處理程序,但處理程序沒有ID(更不用說在「defaultHandler」中定義的那些ID)該命令的屬性。
有什麼我可以做,以取代命令的首選項對話框/默認處理?
您是否嘗試使用自定義[上下文](http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_advext_contexts.htm)激活你的處理程序,如[描述] [這裏](http://stackoverflow.com/questions/28132938/eclipse-plugin-overriding-standard-command-handler)和[這裏](http://www.mindfiresolutions.com/Using -custom-處理換標準的命令功能於Eclipse的RCP-726.php)? –
@RüdigerHerrmann我現在做了,它的工作原理。 :) –