0

3.x RCP ワークスペースで定義したキー バインディング:

   <extension
   id="vebscheme.scheme"
   name="vebscheme.scheme"
   point="org.eclipse.ui.bindings">

    <key
       commandId="com.ami.veb.ui.menu.file.new.command"
       contextId="com.ami.veb.ui.context"
       schemeId="com.ami.veb.ui.scheme"
       sequence="CTRL+N"/>  
    <key
      commandId="com.ami.veb.ui.menu.file.openexternalfile.command"
      contextId="com.ami.veb.ui.context"
      schemeId="com.ami.veb.ui.scheme"
      sequence="CTRL+O"/>
    <key     
      commandId="com.ami.veb.ui.menu.file.new.components.addcomponentwizard.command"
      contextId="com.ami.veb.ui.context"
      schemeId="com.ami.veb.ui.scheme"
      sequence="CTRL+ALT+A"/>   
    <key
         commandId="com.ami.veb.ui.menu.file.new.components.updatecomponentwizard.command"  
      contextId="com.ami.veb.ui.context"
      schemeId="com.ami.veb.ui.scheme"
      sequence="CTRL+ALT+U"/>

      /** Scheme for the key-bindings **/
       <scheme
      id="com.ami.veb.ui.scheme"
      name="com.ami.veb.ui.scheme">
       </scheme>

      //----------------
       -----------------//
  </extension>

スキームのアクティベーション :

    IBindingService bindingService = (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
    BindingService bindingServiceObj = (BindingService) bindingService;
    //get the binding manager for the binding service
    BindingManager bindingManager = bindingServiceObj.getBindingManager();

    //constructs a scheme instance with the schemeId
    Scheme newScheme = bindingManager.getScheme("com.ami.veb.ui.scheme");
    //check if the newScheme is not null
    //then set the scheme as active scheme
    if(newScheme != null) {
        try {
            bindingManager.setActiveScheme(newScheme);
        } catch (NotDefinedException e) {
            String message = "Problem occurred when updating current active scheme."+
                    " This may result in issues with shortcut key bindings. "+
                    "Exit and re-launch the application to resolve this issue";
            VeBLogger.getInstance().log(message);
            VeBPluginActivator.getDefault().logPluginError(e);
        }
    }

コンテキストのアクティベーション :

     IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(IContextService.class);
    contextService.activateContext("com.ami.veb.ui.context");

製品を生成しました (Luna を使用)。製品を起動するとすぐに (ショートカットを保存するまで)、キーボード ショートカットが機能しないことに気付きました。

BindingTable table = getTable(c.getId());
        if (table != null) {
            currentResult = table.getPerfectMatch(triggerSequence);
        }

デバッグ中に、バインディング コンテキストの が最初は空であることに気付きました。そのBindingTable tableため、コンテキスト用に定義したショートカットではなく、Eclipse で定義されたショートカットを取得しています。

PS 最近、RCP ワークスペースを Eclipse Indigo (3.x RCP) から Luna (e4 シリーズ) に移行しましたが、RCP 製品をエクスポートするとすぐにバインドがクリアされ、任意のショートカット キーを押そうとすると ( Ctrl+N と言います) eclipse のショートカットしか表示されず、plugin.xml で定義したものは表示されません。

また、移行は部分的な移行 (またはソフト移行) であり、完全な移行 (純粋な「e4」) ではなく、アプリケーションは依然として互換性レイヤーに基づいていることに注意してください。

製品の起動時に、my バインディング コンテキストに関連するキー バインディング (plugin.xml で定義) がクリアされます。

移行で何が問題になったのか混乱しています:( :(

提案を歓迎します。

4

0 に答える 0