Java RCP / SWT - Android Toast Like Dialog in Eclipse RCP

Does anyone know if there is some kind of implementation of some kind of popup, something like Android: TOAST?

+4
source share
2 answers

Notifications are part of the Mylyn commons .

To integrate them, add the Mylyn Commons Notifications feature from http://download.eclipse.org/mylyn/releases/latest to the target platform definition. Matching packages -

  • org.eclipse.mylyn.commons.notifications.ui
  • org.eclipse.mylyn.commons.notifications.core .

You can add category and event to the notification extension point as follows:

 </extension> <extension point="org.eclipse.mylyn.commons.notifications.ui.notifications"> <category icon="icons/obj16/repository.gif" id="myNotificationCategory" label="My Category"> </category> <event categoryId="myNotificationCategory" icon="icons/obj16/some-image.gif" id="myEvent" label="Hellow World"> <defaultHandler sinkId="org.eclipse.mylyn.commons.notifications.sink.Popup"> </defaultHandler> <description> This is the description of the event. </description> </event> </extension> 

To trigger a notification, use the NotificationService as follows:

 AbstractUiNotification notification = ... NotificationsUi.getService().notify( asList( notification ) ); 

notification must be a subclass of AbstractUiNotification , where eventId passed to the constructor must match the name from the extension.

The notification module also adds a preference page in the General> Notifications section, which allows the user to choose which notifications should be shown.

+2
source

No, but you can use the org.eclipse.mylyn.commons.ui plugin, which contains interesting classes for displaying notifications (s) in the lower right part of the screen.

0
source

Source: https://habr.com/ru/post/1486258/


All Articles