问题
Does anybody know if there exist some implementation of some popup window, something like in Android: TOAST ?
回答1:
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.
回答2:
No, but you can use the plugin org.eclipse.mylyn.commons.ui, which contains interesting classes to display notification(s) at the bottom right of the screen.
来源:https://stackoverflow.com/questions/17110234/java-rcp-swt-android-toast-like-dialog-in-eclipse-rcp