eclipseeclipse-plugineclipse-rcpmylyn

How to use mylyn notifications extensions in Eclipse RCP Application?


I am new to Eclipse development and I need to use mylyn notifications. I have referred [1], [2], [3], but I still couldn't get it to work.

This is my code now.

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)) ; 

This is the 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>

What am I missing?

[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/


Solution

  • Finally managed to get this done by using AbstractNotificationPopUp in Mylyn commons.ui. Hope this helps.