Menu

#4 Hide parts of labels by specifying a regexp

open
None
5
2007-05-12
2004-06-25
Anonymous
No

It would be nice not only to prepend and append
decoration text label, but to select parts of the regexp
to display.

eg : I would like to remove the .java extension from
Java files (in order to save space into package explorer).
I know they are java files from the icon : file extension
is not necessary to display.

Therefore if I could define a regexp like *.java and only
select the first part {1}. It would only display Java file
name and not their extension.

Keep the good job.

Mat

Discussion

  • Markus Gebhard

    Markus Gebhard - 2004-09-05
    • labels: 490643 -->
    • milestone: 267562 -->
     
  • Markus Gebhard

    Markus Gebhard - 2004-09-05

    Logged In: YES
    user_id=680457

    I like this idea. This feature could be added to the "Text
    decoration" tab: A checkbox and a textfield for entering the
    regexp.

    What would be a good title for the checkbox? "Regexp filter"?

    Also how should one specify which of the groups in the regexp
    shall be kept and which ones shall be discarded?

     
  • Markus Gebhard

    Markus Gebhard - 2004-09-05
    • summary: Hide parts of regexp --> Hide parts of labels by specifying a regexp
     
  • Bertrand Martel

    Bertrand Martel - 2005-11-15

    Logged In: YES
    user_id=1120735

    Hello,

    I just woke up from hibernation.

    > What would be a good title for the checkbox? "Regexp
    filter"?

    Sounds good to me

    > Also how should one specify which of the groups in the regexp
    shall be kept and which ones shall be discarded?

    Why not leverage regexp substitute method (apache's ORO
    library provide such mechanism)? Let me explain.

    On can set up incoming regexp:

    (.*).java

    and the substitute regexp :

    {1}

    Using substitute method with input string :

    Toto.java

    we would get :

    Toto

    Other example :

    regexp : (.*)-build(.*).xml
    substitute : {1}-ant{2}.vxml
    string : test-buildTOTO.xml
    output : test-antTOTO.vxml

    This mechanism is used with Struts url wildcard pattern.

    I admit, one must learn, work from some examples, to use
    this feature.

    Cheers.

    Mat

     
  • Markus Gebhard

    Markus Gebhard - 2007-05-12

    Logged In: YES
    user_id=680457
    Originator: NO

    I finally found myself some time and tried to implement a prototype for the label modification.

    Using regular expression groups and message format patterns for modifying the label works quite well, but there is one problem:
    I would expect to configure the regular expression to "(.*)(\.java)" and the message format to "{1}" in order to change "Foo.java" to "Foo".
    Unfortunately it might happen that the universal label decorator is not the first Eclipse label decorator to modify the text. So e.g. the CVS decoration might already have added CVS revision information to the original label. Instead of "Foo.java" the label is something like "Foo.java 1.1 (ASCII -kk)". One will either loose this CVS information or one will have to be more careful when specifying the regular expression pattern: Pattern "(.*)(\.java)(.*)" and message format "{1}{3}" works (althought I do not yet know how Eclipse 3.3M7 manages to apply the new color formatting w/o knowing about this my plugins modification...).

    I consider this quite complicated... I would not like to finish and publish this feature before Eclipse enhancement request 28938 is implemented into the eclipse platform: https://bugs.eclipse.org/bugs/show_bug.cgi?id=28938

     
  • Markus Gebhard

    Markus Gebhard - 2007-05-12
    • assigned_to: nobody --> mgebha
     

Log in to post a comment.