简体   繁体   English

Java RCP / SWT - Eclipse RCP中的“Android Toast like”对话框

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

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

The notifications are part of Mylyn commons . 通知是Mylyn公共的一部分。

To integrate them, add the Mylyn Commons Notifications feature from http://download.eclipse.org/mylyn/releases/latest to your target platform definition. 要集成它们,请将http://download.eclipse.org/mylyn/releases/latest中Mylyn Commons Notifications功能添加到目标平台定义中。 The relevant bundles are 相关的捆绑包是

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

You can add a category and an event to the notifications extension point like this: 您可以将categoryevent添加到通知扩展点,如下所示:

</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: 要触发通知,请使用NotificationService如下所示:

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. notification必须是AbstractUiNotification的子类,其中传递给构造函数的eventId必须与扩展名中的eventId匹配。

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,它包含有趣的类来显示屏幕右下方的通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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