Search in sources :

Example 26 with StatusNotification

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();
}
Also used : PromiseError(org.eclipse.che.api.promises.client.PromiseError) GitOutputConsole(org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 27 with StatusNotification

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));
}
Also used : StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) NotificationListener(org.eclipse.che.ide.api.notification.NotificationListener) Test(org.junit.Test)

Example 28 with StatusNotification

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));
}
Also used : StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) NotificationListener(org.eclipse.che.ide.api.notification.NotificationListener) Test(org.junit.Test)

Aggregations

StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)28 Operation (org.eclipse.che.api.promises.client.Operation)20 OperationException (org.eclipse.che.api.promises.client.OperationException)20 PromiseError (org.eclipse.che.api.promises.client.PromiseError)20 Project (org.eclipse.che.ide.api.resources.Project)12 Resource (org.eclipse.che.ide.api.resources.Resource)7 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)7 TestResult (org.eclipse.che.api.testing.shared.TestResult)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 Promise (org.eclipse.che.api.promises.client.Promise)4 GitOutputConsole (org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole)3 NotificationListener (org.eclipse.che.ide.api.notification.NotificationListener)2 Credentials (org.eclipse.che.ide.api.subversion.Credentials)2 Path (org.eclipse.che.ide.resource.Path)2 Depth (org.eclipse.che.plugin.svn.shared.Depth)2 URL (com.google.gwt.http.client.URL)1 MatchResult (com.google.gwt.regexp.shared.MatchResult)1 RegExp (com.google.gwt.regexp.shared.RegExp)1 Label (com.google.gwt.user.client.ui.Label)1