如何处理鼠标在RCP中的工具栏项目事件

时间:2014-07-21 13:21:22

标签: java eclipse-rcp rcp

我在我的应用程序中创建了一个工具栏,其中包含很少的工具栏项。

菜单:

  <extension point="org.eclipse.ui.menus">
       <menuContribution locationURI="toolbar:main">
           <command
              commandId="com.test.myapp.ui.commands.TestCommand"
              style="push"
              tooltip="My Tool Items 1">
           </command>

命令配置:

    <extension point="org.eclipse.ui.commands">
        <command
                    defaultHandler="com.test.myapp.ui.commands.TestCommand"
                    helpContextId="test"
                    id="com.test.myapp.ui.commands.TestCommand"
                    name="Open Test View">
              </command>

以下是我的TestCommand类。

    public class TestCommand extends AbstractHandler{
        //Overridden the execute method here....
    }

现在,如果我点击我的工具栏,这将执行我的Command类。我想知道如何将鼠标监听器添加到此工具栏项目,以便我们可以在鼠标悬停在工具栏项目上时执行一些操作(例如:鼠标移到工具栏项目,它通常显示工具提示,所以现在如果我按下一些键,它应该为此打开一些其他页面。所以要做到这一点,如果我可以控制这个事件,我可以添加一些东西)

0 个答案:

没有答案
相关问题