use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class MovePresenter method show.
/**
* Show Move panel with the special information.
*
* @param refactorInfo
* information about the move operation
*/
public void show(final RefactorInfo refactorInfo) {
this.refactorInfo = refactorInfo;
view.setEnablePreviewButton(false);
view.setEnableAcceptButton(false);
view.clearErrorLabel();
CreateMoveRefactoring moveRefactoring = createMoveDto();
Promise<String> sessionIdPromise = refactorService.createMoveRefactoring(moveRefactoring);
sessionIdPromise.then(new Operation<String>() {
@Override
public void apply(String sessionId) throws OperationException {
MovePresenter.this.refactoringSessionId = sessionId;
showProjectsAndPackages();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(error.getMessage(), Status.FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class MovePresenter method onPreviewButtonClicked.
/** {@inheritDoc} */
@Override
public void onPreviewButtonClicked() {
RefactoringSession session = dtoFactory.createDto(RefactoringSession.class);
session.setSessionId(refactoringSessionId);
prepareMovingChanges(session).then(new Operation<ChangeCreationResult>() {
@Override
public void apply(ChangeCreationResult arg) throws OperationException {
if (arg.isCanShowPreviewPage()) {
previewPresenter.show(refactoringSessionId, refactorInfo);
view.hide();
} else {
view.showStatusMessage(arg.getStatus());
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(locale.showPreviewError(), error.getMessage(), Status.FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class MovePresenter method setMoveDestinationPath.
/** {@inheritDoc} */
@Override
public void setMoveDestinationPath(String path, String projectPath) {
ReorgDestination destination = dtoFactory.createDto(ReorgDestination.class);
destination.setType(ReorgDestination.DestinationType.PACKAGE);
destination.setSessionId(refactoringSessionId);
destination.setProjectPath(projectPath);
destination.setDestination(path);
Promise<RefactoringStatus> promise = refactorService.setDestination(destination);
promise.then(new Operation<RefactoringStatus>() {
@Override
public void apply(RefactoringStatus arg) throws OperationException {
view.setEnableAcceptButton(true);
view.setEnablePreviewButton(true);
switch(arg.getSeverity()) {
case INFO:
view.showStatusMessage(arg);
break;
case WARNING:
view.showStatusMessage(arg);
break;
case ERROR:
showErrorMessage(arg);
break;
case FATAL:
showErrorMessage(arg);
break;
case OK:
default:
view.clearStatusMessage();
break;
}
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class MovePresenter method showProjectsAndPackages.
private void showProjectsAndPackages() {
Promise<List<JavaProject>> projectsPromise = navigationService.getProjectsAndPackages(true);
projectsPromise.then(new Operation<List<JavaProject>>() {
@Override
public void apply(List<JavaProject> projects) throws OperationException {
List<JavaProject> currentProject = new ArrayList<>();
for (JavaProject project : projects) {
currentProject.add(project);
}
view.setTreeOfDestinations(currentProject);
view.show(refactorInfo);
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notificationManager.notify(locale.showPackagesError(), error.getMessage(), Status.FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.api.promises.client.OperationException in project che by eclipse.
the class PreviewPresenter method onEnabledStateChanged.
/** {@inheritDoc} */
@Override
public void onEnabledStateChanged(final RefactoringPreview change) {
ChangeEnabledState changeEnableState = dtoFactory.createDto(ChangeEnabledState.class);
changeEnableState.setChangeId(change.getId());
changeEnableState.setSessionId(session.getSessionId());
changeEnableState.setEnabled(change.isEnabled());
refactoringService.changeChangeEnabledState(changeEnableState).then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
onSelectionChanged(change);
}
});
}
Aggregations