use of org.eclipse.che.ide.api.notification.StatusNotification in project che by eclipse.
the class FetchPresenter method onFetchClicked.
/** {@inheritDoc} */
@Override
public void onFetchClicked() {
final String remoteUrl = view.getRepositoryUrl();
final StatusNotification notification = notificationManager.notify(constant.fetchProcess(), PROGRESS, FLOAT_MODE);
final GitOutputConsole console = gitOutputConsoleFactory.create(FETCH_COMMAND_NAME);
service.fetch(appContext.getDevMachine(), project.getLocation(), view.getRepositoryName(), getRefs(), view.isRemoveDeletedRefs()).then(new Operation<Void>() {
@Override
public void apply(Void ignored) throws OperationException {
console.print(constant.fetchSuccess(remoteUrl));
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notification.setStatus(SUCCESS);
notification.setTitle(constant.fetchSuccess(remoteUrl));
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
handleError(error.getCause(), remoteUrl, notification, console);
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
}
});
view.close();
}
use of org.eclipse.che.ide.api.notification.StatusNotification 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.StatusNotification 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