[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [Subclipse-users] %20 spaces replacement in Label Decoration

From: MATHUS Baptiste <mathus.b_at_mipih.fr>
Date: 2006-10-14 04:29:20 CEST

-----Original Message-----
From: Mark Phippard [mailto:markp@softlanding.com]
Sent: Fri 10/13/2006 2:59 PM
To: users@subclipse.tigris.org
Subject: Re: [Subclipse-users] %20 spaces replacement in Label Decoration
 
"MATHUS Baptiste" <mathus.b@mipih.fr> wrote on 10/13/2006 08:55:33 AM:
 
> > It would be great to be able to see "Project Name [trunk/Project Name]"
> > instead of "Project Name [trunk/Project%20Name]" inside the Package
> > Explorer view...
> >
> > Would not it be possible to add another "Variable" in
> > Window/Preferences, in
> > the "Team/SVN/Label Decorations" pane. The used variable in our case is
> > {url_short} at the moment. Maybe the solution could be adding a new
> > {url_short_with_no_encoded_path} variable or some other name :-), so as
> > not
> > the break the {url_short} actual behaviour... Or simply add a special
> > treatment to deencode spaces, accents and so on ?
>
> I can't see adding another option. The answer would be for someone to
> come up with a routine to unescape the URL, or in this case maybe just the
> text that is going to be used for the decorator.

Would not this patch be acceptable ?
###############################
Index: ui/src/org/tigris/subversion/subclipse/ui/decorator/SVNLightweightDecorator.java
===================================================================
--- ui/src/org/tigris/subversion/subclipse/ui/decorator/SVNLightweightDecorator.java (revision 2793)
+++ ui/src/org/tigris/subversion/subclipse/ui/decorator/SVNLightweightDecorator.java (working copy)
@@ -12,6 +12,8 @@
 package org.tigris.subversion.subclipse.ui.decorator;
 
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -313,6 +315,12 @@
                        shortUrl = status.getUrlString().substring(rootLen);
                     else
                        shortUrl = status.getUrlString();
+ try {
+ shortUrl = URLDecoder.decode(shortUrl, "utf-8");
+ } catch (UnsupportedEncodingException e) {
+ // If an exception occurs, just do not decode and display the stack trace...
+ e.printStackTrace();
+ }
                     bindings.put(
                             SVNDecoratorConfiguration.RESOURCE_URL_SHORT,
                             shortUrl);
#################

I just tried it with the trunk of subclipse-ui, and it works fine (I'm just processing a String with a standard JDK class, so I can't see a lot of possible side effects).

Maybe this decoding could cause some weird problems with kanjis or Cyrillic alphabet, but I would bet on not, 'cause the upper code is using the classical URLDecoder from java.net which has certainly already been tested in these kind of cases...

Moreover, as I commented it in the code. At least, even if the decoding fails, just keep silent and use the non decoded String, that's all.

> > If anything to achieve this other than renaming our projects or wait for
> > the
> > next release is already possible, please let me know :) (even if a bit
> > tweaky (= ).
>
> The current trunk code still works the same way, so there isn't anything
> you can do.

Submitting a patch ? :-).

Let me know what you think about it.

-- 
Baptiste


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subclipse.tigris.org
For additional commands, e-mail: users-help@subclipse.tigris.org

Received on Sat Oct 14 04:29:33 2006

This is an archived mail posted to the Subclipse Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.