use of org.eclipse.che.ide.api.notification.Notification in project che by eclipse.
the class NotificationManagerImpl method onValueChanged.
/** {@inheritDoc} */
@Override
public void onValueChanged() {
unread = 0;
for (Notification notification : notifications) {
if (!notification.isRead()) {
unread++;
}
}
firePropertyChange(TITLE_PROPERTY);
}
use of org.eclipse.che.ide.api.notification.Notification 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.Notification in project che by eclipse.
the class NotificationManagerImplTest method testOnValueChanged.
@Test
public void testOnValueChanged() throws Exception {
Notification notification = new Notification("Title");
manager.notify(notification);
reset(view);
manager.onValueChanged();
reset(view);
notification.setState(ReadState.READ);
}
use of org.eclipse.che.ide.api.notification.Notification in project che by eclipse.
the class NotificationManagerImplTest method testShowSimpleNotification.
@Test
public void testShowSimpleNotification() throws Exception {
Notification notification = new Notification("Title");
manager.notify(notification);
verify(notificationContainer).addNotification(eq(notification));
verify(notificationMessageStack, never()).push(any(StatusNotification.class));
}
Aggregations