directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r576494 - /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
Date Mon, 17 Sep 2007 15:59:32 GMT
Author: pamarcelot
Date: Mon Sep 17 08:59:31 2007
New Revision: 576494

URL: http://svn.apache.org/viewvc?rev=576494&view=rev
Log:
Fix for DIRSTUDIO-198 (Search string is not working properly with metacharacters (*, +...)).
The Search String is now compliant with the Eclipse Search String option ( ?=any character
& *=any string ).

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java?rev=576494&r1=576493&r2=576494&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SearchView.java
Mon Sep 17 08:59:31 2007
@@ -589,7 +589,10 @@
 
         if ( searchString != null )
         {
-            Pattern pattern = Pattern.compile( ".*" + searchString + ".*", Pattern.CASE_INSENSITIVE
);
+            String computedSearchString = searchString.replaceAll( "\\*", "\\\\w*" );
+            computedSearchString = computedSearchString.replaceAll( "\\?", ".*" );
+
+            Pattern pattern = Pattern.compile( computedSearchString, Pattern.CASE_INSENSITIVE
);
 
             SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
             if ( schemaHandler != null )



Mime
View raw message