Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-12-19 15:41:32 +04:00
15 changed files with 30 additions and 65 deletions
@@ -25,11 +25,6 @@ public interface XmlRpcServer {
boolean hasHandler(String name);
void removeHandler(String name);
/**
* @deprecated use {@link org.jetbrains.ide.WebServerManager#getInstance().getPort()} (to remove in IDEA 13)
*/
int getPortNumber();
final class SERVICE {
private SERVICE() {
}
@@ -97,6 +97,12 @@ public class JBLabel extends JLabel implements AnchorableComponent {
return super.getForeground();
}
@Override
public void setForeground(Color fg) {
myFontColor = null;
super.setForeground(fg);
}
@Override
public void setAnchor(@Nullable JComponent anchor) {
myAnchor = anchor;
@@ -29,7 +29,6 @@ import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.ide.WebServerManager;
import org.jetbrains.io.Responses;
import java.util.Arrays;
@@ -80,10 +79,6 @@ public class XmlRpcServerImpl extends SimpleChannelUpstreamHandler implements Xm
pipeline.addLast("pluggable_xmlRpc", this);
}
public int getPortNumber() {
return WebServerManager.getInstance().getPort();
}
@Override
public boolean hasHandler(String name) {
return handlerMapping.handlers.containsKey(name);
@@ -168,13 +168,17 @@ public class FileWatcher {
return null;
}
private void notifyOnFailure(String cause, @Nullable NotificationListener listener) {
private void notifyOnFailure(final String cause, @Nullable final NotificationListener listener) {
LOG.warn(cause);
if (!myFailureShownToTheUser) {
myFailureShownToTheUser = true;
String title = ApplicationBundle.message("watcher.slow.sync");
Notifications.Bus.notify(NOTIFICATION_GROUP.getValue().createNotification(title, cause, NotificationType.WARNING, listener));
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
String title = ApplicationBundle.message("watcher.slow.sync");
Notifications.Bus.notify(NOTIFICATION_GROUP.getValue().createNotification(title, cause, NotificationType.WARNING, listener));
}
});
}
}
@@ -535,6 +535,9 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
setBackground(new Color(255, 186, 192));
JBLabel label = new JBLabel(title);
if( UIUtil.isUnderDarcula()) {
label.setForeground(UIUtil.getPanelBackground());
}
myAddLabel = new LinkLabel("Add root", null);
@@ -63,9 +63,6 @@ public class HgSwitchWorkingDirectoryAction extends HgAbstractGlobalAction {
@Override
public void run() {
HgCommandResult result = command.execute();
if (HgErrorUtil.isAuthorizationError(result)) {
result = command.execute(true);
}
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
new HgCommandResultNotifier(project).notifyError(result, "", "Update failed");
}
@@ -28,16 +28,11 @@ public class HgCloneCommand {
@Nullable
public HgCommandResult execute() {
return execute(false);
}
@Nullable
public HgCommandResult execute(boolean forceAuthorization) {
final List<String> arguments = new ArrayList<String>(2);
arguments.add(repositoryURL);
arguments.add(directory);
final HgCommandExecutor executor = new HgCommandExecutor(project);
executor.setShowOutput(true);
return executor.executeInCurrentThread(null, "clone", arguments, forceAuthorization);
return executor.executeInCurrentThread(null, "clone", arguments);
}
}
@@ -32,7 +32,7 @@ public class HgInitCommand {
public void process(@Nullable HgCommandResult result) {
resultHandler.process(result);
}
}, true);
});
}
}
@@ -57,7 +57,7 @@ public class HgMergeCommand {
arguments.add(branch);
}
final HgCommandResult result =
commandExecutor.executeInCurrentThread(repo, "merge", arguments, new HgDeleteModifyPromptHandler(), false);
commandExecutor.executeInCurrentThread(repo, "merge", arguments, new HgDeleteModifyPromptHandler());
project.getMessageBus().syncPublisher(HgVcs.BRANCH_TOPIC).update(project, null);
return result;
}
@@ -76,9 +76,6 @@ public class HgPullCommand {
final HgCommandExecutor executor = new HgCommandExecutor(project);
executor.setShowOutput(true);
HgCommandResult result = executor.executeInCurrentThread(repo, "pull", arguments);
if (HgErrorUtil.isAuthorizationError(result)) {
result = executor.executeInCurrentThread(repo, "pull", arguments, true);
}
if (HgErrorUtil.isAuthorizationError(result)) {
new HgCommandResultNotifier(project)
.notifyError(result, "Authorization required", "http authorization required for <code>" + source + "</code>");
@@ -78,7 +78,7 @@ public class HgPushCommand {
}
resultHandler.process(result);
}
}, true);
});
}
public VirtualFile getRepo() {
@@ -67,9 +67,6 @@ public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand {
}
HgCommandExecutor executor = new HgCommandExecutor(project);
HgCommandResult result = executor.executeInCurrentThread(repo, command, args);
if (HgErrorUtil.isAuthorizationError(result)) {
result = executor.executeInCurrentThread(repo, command, args, true);
}
if (result == HgCommandResult.CANCELLED || HgErrorUtil.isAuthorizationError(result)) {
final HgVcs vcs = HgVcs.getInstance(project);
if (vcs == null) {
@@ -52,13 +52,9 @@ public class HgUpdateCommand {
this.clean = clean;
}
@Nullable
public HgCommandResult execute() {
return execute(false);
}
@Nullable
public HgCommandResult execute(boolean forceAuthorization) {
public HgCommandResult execute() {
List<String> arguments = new LinkedList<String>();
if (clean) {
arguments.add("--clean");
@@ -74,7 +70,7 @@ public class HgUpdateCommand {
final HgCommandExecutor executor = new HgCommandExecutor(project);
executor.setShowOutput(true);
final HgCommandResult result =
executor.executeInCurrentThread(repo, "update", arguments, new HgDeleteModifyPromptHandler(), forceAuthorization);
executor.executeInCurrentThread(repo, "update", arguments, new HgDeleteModifyPromptHandler());
project.getMessageBus().syncPublisher(HgVcs.BRANCH_TOPIC).update(project, null);
VfsUtil.markDirtyAndRefresh(true, true, false, repo);
return result;
@@ -88,31 +88,10 @@ public final class HgCommandExecutor {
final String operation,
final List<String> arguments,
@Nullable final HgCommandResultHandler handler) {
execute(repo, operation, arguments, handler, false);
}
/**
* Method is called with forceAutorization = true, if authorization may be failed and update login_password dialog required
* f.e. if repository password was changed, but idea was not restarted.
*
* @param repo
* @param operation
* @param arguments
* @param handler
* @param forceAuthorization
*/
public void execute(@Nullable final VirtualFile repo,
final String operation,
final List<String> arguments,
@Nullable final HgCommandResultHandler handler,
final boolean forceAuthorization) {
HgUtil.executeOnPooledThreadIfNeeded(new Runnable() {
@Override
public void run() {
HgCommandResult result = executeInCurrentThread(repo, operation, arguments);
if (forceAuthorization && HgErrorUtil.isAuthorizationError(result)) {
result = executeInCurrentThread(repo, operation, arguments, true);
}
if (handler != null) {
handler.process(result);
}
@@ -122,14 +101,18 @@ public final class HgCommandExecutor {
@Nullable
public HgCommandResult executeInCurrentThread(@Nullable final VirtualFile repo, @NotNull final String operation,
@Nullable final List<String> arguments, boolean forceAuthorization) {
return executeInCurrentThread(repo, operation, arguments, null, forceAuthorization);
@Nullable final List<String> arguments) {
return executeInCurrentThread(repo, operation, arguments, null);
}
@Nullable
public HgCommandResult executeInCurrentThread(@Nullable final VirtualFile repo, @NotNull final String operation,
@Nullable final List<String> arguments) {
return executeInCurrentThread(repo, operation, arguments, false);
@Nullable final List<String> arguments, @Nullable HgPromptHandler handler) {
HgCommandResult result = executeInCurrentThread(repo, operation, arguments, handler, false);
if (HgErrorUtil.isAuthorizationError(result)) {
result = executeInCurrentThread(repo, operation, arguments, handler, true);
}
return result;
}
@Nullable
@@ -68,9 +68,6 @@ public class HgCheckoutProvider implements CheckoutProvider {
// handle result
HgCommandResult myCloneResult = clone.execute();
if (HgErrorUtil.isAuthorizationError(myCloneResult)) {
myCloneResult = clone.execute(true);
}
if (myCloneResult == null) {
new HgCommandResultNotifier(project).notifyError(myCloneResult, "Clone failed", "Clone failed due to unknown error");
} else if (HgErrorUtil.hasErrorsInCommandExecution(myCloneResult)) {