use of org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode.FLOAT_MODE in project che by eclipse.
the class AddToIndexAction method addToIndex.
private void addToIndex(final GitOutputConsole console) {
Resource[] resources = appContext.getResources();
Path[] paths = new Path[resources.length];
for (int i = 0; i < resources.length; i++) {
Path path = resources[i].getLocation().removeFirstSegments(1);
paths[i] = path.segmentCount() == 0 ? Path.EMPTY : path;
}
service.add(appContext.getDevMachine(), appContext.getRootProject().getLocation(), false, paths).then(voidArg -> {
console.print(constant.addSuccess());
notificationManager.notify(constant.addSuccess());
}).catchError(error -> {
console.printError(constant.addFailed());
notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE);
});
}
use of org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode.FLOAT_MODE in project che by eclipse.
the class AddToIndexAction method actionPerformed.
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
final Resource[] resources = appContext.getResources();
checkState(resources != null);
final DevMachine devMachine = appContext.getDevMachine();
final GitOutputConsole console = gitOutputConsoleFactory.create(constant.addToIndexCommandName());
consolesPanelPresenter.addCommandOutput(devMachine.getId(), console);
service.getStatus(devMachine, appContext.getRootProject().getLocation()).then(status -> {
if (containsInSelected(status.getUntracked())) {
presenter.showDialog();
} else if (containsInSelected(status.getModified()) || containsInSelected(status.getMissing())) {
addToIndex(console);
} else {
String message = resources.length > 1 ? constant.nothingAddToIndexMultiSelect() : constant.nothingAddToIndex();
console.print(message);
notificationManager.notify(message);
}
}).catchError(error -> {
console.printError(constant.statusFailed());
notificationManager.notify(constant.statusFailed(), FAIL, FLOAT_MODE);
});
}
Aggregations