简体   繁体   中英

Java RCP/SWT - “Android Toast like” dialog in Eclipse RCP

有没有人知道是否存在一些弹出窗口的实现,比如Android:TOAST?

The notifications are part of Mylyn commons .

To integrate them, add the Mylyn Commons Notifications feature from http://download.eclipse.org/mylyn/releases/latest to your target platform definition. The relevant bundles are

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

You can add a category and an event to the notifications extension point like this:

</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="Hello 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 like this:

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

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

The notifications plug-in also adds a preference page under General > Notifications that lets the user choose which notifications should be shown.

不,但你可以使用插件org.eclipse.mylyn.commons.ui,它包含有趣的类来显示屏幕右下方的通知。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM