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

To *_*Kra 4 java rcp toast

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

Rüd*_*ann 5

通知是Mylyn公共的一部分.

要集成它们,请将http://download.eclipse.org/mylyn/releases/latest中Mylyn Commons Notifications功能添加到目标平台定义中.相关的捆绑包是

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

您可以像这样添加一个category和一个event到通知扩展点:

</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>
Run Code Online (Sandbox Code Playgroud)

要触发通知,请使用NotificationService以下命令:

AbstractUiNotification notification = ...
NotificationsUi.getService().notify( asList( notification ) );
Run Code Online (Sandbox Code Playgroud)

notification必须的一个子类AbstractUiNotification,其中eventId传递给构造函数必须从扩展的一个相匹配.

通知插件还在" 常规">"通知"下添加了一个首选项页面,该页面允许用户选择应显示哪些通知.