From ca7106d08c81776514acaafa59502b249b14c357 Mon Sep 17 00:00:00 2001 From: irengrig Date: Fri, 29 Jan 2010 13:30:03 +0300 Subject: [PATCH] IDEA-51354 (Not logged to SVN notification: allow to copy message to clipboard) --- .../openapi/vcs/impl/GenericNotifierImpl.java | 21 ++++++++++++++------- .../idea/svn/SvnAuthenticationNotifier.java | 6 ++++++ .../idea/svn/SvnProxyAuthenticationNotifier.java | 6 ++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/GenericNotifierImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/GenericNotifierImpl.java index a66fa99b63..b359ca0232 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/GenericNotifierImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/GenericNotifierImpl.java @@ -59,6 +59,9 @@ public abstract class GenericNotifierImpl { @NotNull protected abstract String getNotificationContent(final T obj); + @NotNull + protected abstract String getToString(final T obj); + protected Collection getAllCurrentKeys() { synchronized (myLock) { return new ArrayList(myState.keySet()); @@ -89,7 +92,7 @@ public abstract class GenericNotifierImpl { if (myState.containsKey(key)) { return; } - notification = new MyNotification(myGroupId, myTitle, getNotificationContent(obj), myType, myListener, obj); + notification = new MyNotification(myGroupId, myTitle, getNotificationContent(obj), myType, myListener, obj, getToString(obj)); myState.put(key, notification); } final Application application = ApplicationManager.getApplication(); @@ -158,20 +161,24 @@ public abstract class GenericNotifierImpl { protected static class MyNotification extends Notification { private T myObj; + private final String myStringPresentation; - protected MyNotification(@NotNull String groupId, - @NotNull String title, - @NotNull String content, - @NotNull NotificationType type, - @Nullable NotificationListener listener, - @NotNull final T obj) { + protected MyNotification(@NotNull String groupId, @NotNull String title, @NotNull String content, @NotNull NotificationType type, @Nullable NotificationListener listener, + @NotNull final T obj, + final String stringPresentation) { super(groupId, title, content, type, listener); myObj = obj; + myStringPresentation = stringPresentation; } public T getObj() { return myObj; } + + @Override + public String toString() { + return myStringPresentation; + } } private static void log(final String s) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java index e28d5dc510..8002b0b2ce 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java @@ -139,6 +139,12 @@ public class SvnAuthenticationNotifier extends GenericNotifierImplClick to fix. Not logged to Subversion '" + obj.getRealm() + "' (" + obj.getUrl().toDecodedString() + ")"; } + @NotNull + @Override + protected String getToString(AuthenticationRequest obj) { + return "Click to fix. Not logged to Subversion '" + obj.getRealm() + "' (" + obj.getUrl().toDecodedString() + ")"; + } + public static class AuthenticationRequest { private final Project myProject; private final String myKind; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProxyAuthenticationNotifier.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProxyAuthenticationNotifier.java index bff519fad3..0a0d8f2bba 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProxyAuthenticationNotifier.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnProxyAuthenticationNotifier.java @@ -43,4 +43,10 @@ public class SvnProxyAuthenticationNotifier extends GenericNotifierImpl