如何在Eclipse RCP应用程序中使用mylyn通知扩展?

问题描述 投票:0回答:1

我是Eclipse开发的新手,我需要使用mylyn通知。我已经提到了[1],[2],[3],但我仍然无法让它发挥作用。

这是我的代码。

AbstractNotification  notification = new  AbstractNotification ("my.event" ) {
            public  String getLabel() { 
                return   "My Label";  
            } 
            public  String getDescription(){
                return "My Description";  
            }
            @Override
            public <T> T getAdapter(Class<T> adapter) {
                // TODO Auto-generated method stub
                return null;
            }
            @Override
            public Date getDate() {
                // TODO Auto-generated method stub
                return new Date();
            } 
        }; 
NotificationsUi.getService().notify(Collections.singletonList(notification)) ; 

这是plugin.xml

<extension point="org.eclipse.mylyn.commons.notifications.ui.notifications">
    <event
        categoryId="org.eclipse.mylyn.builds.ui.category.Builds"
        id="my.event"
        label="My Event"
        selected="true">
        <defaultHandler
          sinkId="org.eclipse.mylyn.commons.notifications.sink.Popup">
        </defaultHandler>
      </event>
</extension>

我错过了什么?

[1] Mylyn notification example for RCP Application

[2] https://resheim.net/2011/04/using-mylyn-notifications.html

[3] https://krishnanmohan.wordpress.com/2012/10/06/scheduled-notifications-in-eclipse-rcp-applications/

eclipse eclipse-plugin eclipse-rcp mylyn
1个回答
1
投票

最后设法通过在Mylyn commons.ui中使用AbstractNotificationPopUp来完成这项工作。希望这可以帮助。

© www.soinside.com 2019 - 2024. All rights reserved.