| | |
| | | package com.gitblit.client;
|
| | |
|
| | | import java.awt.Component;
|
| | | import java.awt.Cursor;
|
| | | import java.io.IOException;
|
| | | import java.text.MessageFormat;
|
| | |
|
| | |
| | |
|
| | | import com.gitblit.Constants.RpcRequest;
|
| | | import com.gitblit.GitBlitException.ForbiddenException;
|
| | | import com.gitblit.GitBlitException.NotAllowedException;
|
| | | import com.gitblit.GitBlitException.UnauthorizedException;
|
| | | import com.gitblit.GitBlitException.UnknownRequestException;
|
| | |
|
| | | public abstract class GitblitWorker extends SwingWorker<Boolean, Void> {
|
| | |
|
| | |
| | | public GitblitWorker(Component parent, RpcRequest request) {
|
| | | this.parent = parent;
|
| | | this.request = request;
|
| | | parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
| | | }
|
| | |
|
| | | protected RpcRequest getRequestType() {
|
| | |
| | | }
|
| | |
|
| | | protected void done() {
|
| | | parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
| | | try {
|
| | | Boolean success = get();
|
| | | if (success) {
|
| | |
| | | Utils.explainForbidden(parent, request);
|
| | | } else if (t instanceof UnauthorizedException) {
|
| | | Utils.explainUnauthorized(parent, request);
|
| | | } else if (t instanceof NotAllowedException) {
|
| | | Utils.explainNotAllowed(parent, request);
|
| | | } else if (t instanceof UnknownRequestException) {
|
| | | Utils.explainNotAllowed(parent, request);
|
| | | } else {
|
| | | Utils.showException(parent, t);
|
| | | }
|