use of org.eclipse.che.ide.api.notification.NotificationListener in project che by eclipse.
the class NotificationManagerImplTest method testOnMessageDoubleClicked.
@Test
public void testOnMessageDoubleClicked() throws Exception {
NotificationListener listener = mock(NotificationListener.class);
StatusNotification notification = new StatusNotification("Title", "Message", SUCCESS, NOT_EMERGE_MODE, null, listener);
manager.onDoubleClick(notification);
verify(listener, never()).onClick(eq(notification));
verify(listener, never()).onClose(eq(notification));
verify(listener).onDoubleClick(eq(notification));
}
use of org.eclipse.che.ide.api.notification.NotificationListener in project che by eclipse.
the class NotificationManagerImpl method onClose.
/** {@inheritDoc} */
@Override
public void onClose(Notification notification) {
removeNotification(notification);
NotificationListener listener = notification.getListener();
if (listener != null) {
listener.onClose(notification);
}
}
use of org.eclipse.che.ide.api.notification.NotificationListener in project che by eclipse.
the class UploadFilePresenter method onSubmitComplete.
/** {@inheritDoc} */
@Override
public void onSubmitComplete(String result) {
if (!isNullOrEmpty(result)) {
view.closeDialog();
notificationManager.notify(locale.failedToUploadFiles(), parseMessage(result), StatusNotification.Status.FAIL, FLOAT_MODE);
return;
}
container.getFile(Path.valueOf(view.getFileName())).then(new Operation<Optional<File>>() {
@Override
public void apply(final Optional<File> file) throws OperationException {
if (file.isPresent()) {
eventBus.fireEvent(new RevealResourceEvent(file.get()));
final NotificationListener notificationListener = new NotificationListener() {
boolean clicked = false;
@Override
public void onClick(Notification notification) {
if (!clicked) {
eventBus.fireEvent(FileEvent.createOpenFileEvent(file.get()));
clicked = true;
notification.setListener(null);
notification.setContent("");
}
}
@Override
public void onDoubleClick(Notification notification) {
//stub
}
@Override
public void onClose(Notification notification) {
//stub
}
};
notificationManager.notify("File '" + view.getFileName() + "' has uploaded successfully", "Click here to open it", StatusNotification.Status.SUCCESS, FLOAT_MODE, notificationListener);
view.closeDialog();
}
}
});
//TODO this should process editor agent
// if (view.isOverwriteFileSelected()) {
// String path = ((HasStorablePath)getResourceBasedNode()).getStorablePath() + "/" + view.getFileName();
// eventBus.fireEvent(new FileContentUpdateEvent(path));
// }
}
use of org.eclipse.che.ide.api.notification.NotificationListener in project che by eclipse.
the class NotificationManagerImplTest method testOnMessageClicked.
@Test
public void testOnMessageClicked() throws Exception {
NotificationListener listener = mock(NotificationListener.class);
StatusNotification notification = new StatusNotification("Title", "Message", SUCCESS, NOT_EMERGE_MODE, null, listener);
manager.onClick(notification);
verify(listener).onClick(eq(notification));
verify(listener, never()).onClose(eq(notification));
verify(listener, never()).onDoubleClick(eq(notification));
}
use of org.eclipse.che.ide.api.notification.NotificationListener in project che by eclipse.
the class NotificationManagerImplTest method testOnCloseMessageClicked.
@Test
public void testOnCloseMessageClicked() throws Exception {
NotificationListener listener = mock(NotificationListener.class);
StatusNotification notification = new StatusNotification("Title", "Message", SUCCESS, NOT_EMERGE_MODE, null, listener);
manager.onClose(notification);
verify(listener, never()).onClick(eq(notification));
verify(listener).onClose(eq(notification));
verify(listener, never()).onDoubleClick(eq(notification));
}
Aggregations