2016-08-09 14 views
1

Eclipse 4を使用するためにEclipseプラグインを移行したいと思っています。これは基本的に互換レイヤーへの依存を取り除くことを意味しますか? My Pluginには、Activatorクラス、ハンドラが添付されたコマンド、およびこのコマンドをトリガするキーバインディングがあります。私がこれまで行ってきたことは、e4ツールをインストールし、プラグインプロジェクトにfragment.e4xmiを追加し、プラグイン.xmlの拡張にorg.eclipse.e4.workbench.modelを追加することです。これらの指示http://www.vogella.com/tutorials/EclipsePlugin/article.htmlに続いて、私はeclipseのメインメニューにメニューの投稿を追加し、e4ハンドラをこのメニューに添付することができました(それはクールな依存性注入物を使用します)。Eclipse 4プラグイン - キーバインド

私の問題はキーバインディングです。 org.eclipse.e4.legacy.ide.applicationと機能名のキーバインドを持つ:私のplugin.xmlで、それはこのようにfragment.e4xmiに

<extension 
     point="org.eclipse.ui.bindings"> 
     <key 
      commandId="com.florian.regexfindandreplace.commands.FindAndReplaceCommand" 
      contextId="org.eclipse.ui.textEditorScope" 
      schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" 
      sequence="M1+F5"> 
     </key> 

     <scheme 
    name="Default" 
    description="Default shortcuts for Eclipse" 
    id="default.id" /> 
</extension> 

を見て、私は拡張要素IDとモデルフラグメントを追加しました。

このノードの下で、Idとorg.eclipse.ui.contexts.window(私はそのバインディングコンテキストをインポートしました)とBindingTableを作成し、このコンテキストとM1 + F5のキーバインディングを使用してBindingTableを作成しました。

しかし、プラグインの実行中にCtrl + F5を押すと(メニューが表示され、そこからコマンドをトリガーできます)、コマンドはトリガーされません。ここで

は私が間違って何をしました私のframent.e4xmiファイル

<?xml version="1.0" encoding="ASCII"?> 
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_GxS4UF4xEea8x7AIe1PlrQ"> 
    <imports xsi:type="commands:BindingContext" xmi:id="_vgCiAF8lEea2fbkyfFHzhA" elementId="org.eclipse.ui.contexts.dialogAndWindow"/> 
    <fragments xsi:type="fragment:StringModelFragment" xmi:id="_OX6rcF4xEea8x7AIe1PlrQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application"> 
    <elements xsi:type="commands:Command" xmi:id="_XcrQgF4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.command.openfindreplacedialog" commandName="Open find/replace dialog" description="Opens the find/replace dialog"/> 
    </fragments> 
    <fragments xsi:type="fragment:StringModelFragment" xmi:id="_dc1cIF4xEea8x7AIe1PlrQ" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application"> 
    <elements xsi:type="commands:Handler" xmi:id="_ioC8wF4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.handler.openfindreplacedialog" contributionURI="bundleclass://com.florian.regexfindandreplace/com.florian.regexfindandreplace.handlers.OpenFindReplaceDialogE4Handler" command="_XcrQgF4xEea8x7AIe1PlrQ"/> 
    </fragments> 
    <fragments xsi:type="fragment:StringModelFragment" xmi:id="_ok-OMF4xEea8x7AIe1PlrQ" featurename="menuContributions" parentElementId="org.eclipse.e4.legacy.ide.application"> 
    <elements xsi:type="menu:MenuContribution" xmi:id="_1fot0F4xEea8x7AIe1PlrQ" elementId="com.florian.regexfindandreplace.menucontribution.firstmenu" positionInParent="after=additions" parentId="org.eclipse.ui.main.menu"> 
     <children xsi:type="menu:HandledMenuItem" xmi:id="_FTLfEF4yEea8x7AIe1PlrQ" elementId="id.openfindreplacedialog" label="Open find/replace dialog" command="_XcrQgF4xEea8x7AIe1PlrQ"/> 
    </elements> 
    </fragments> 
    <fragments xsi:type="fragment:StringModelFragment" xmi:id="__aNm8F45Eea8x7AIe1PlrQ" featurename="keyBindings" parentElementId="org.eclipse.e4.legacy.ide.application"> 
    <elements xsi:type="commands:BindingTable" xmi:id="_2seTgF8lEea2fbkyfFHzhA" elementId="com.florian.regexfindandreplace.bindingtable.0" bindingContext="_vgCiAF8lEea2fbkyfFHzhA"> 
     <bindings xmi:id="_3ySFAF8lEea2fbkyfFHzhA" elementId="com.florian.regexfindandreplace.keybinding.0" keySequence="CTRL+F5" command="_XcrQgF4xEea8x7AIe1PlrQ"/> 
    </elements> 
    </fragments> 
</fragment:ModelFragments> 

のですか?どんな助けもありがとう!

答えて

0

私は私の問題を解決しました。私のキーバインディングのモデルフラグメントはfeaturename = "bindingTables"でなければなりません。だから私は "keyBindings"という名前をつけたと思ったので、ここに任意の名前をつけることはできません。

関連する問題