directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r488355 [1/10] - in /directory/sandbox/pamarcelot/ldapstudio: ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/ ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/ ldapstudio-browse...
Date Mon, 18 Dec 2006 17:32:09 GMT
Author: pamarcelot
Date: Mon Dec 18 09:32:03 2006
New Revision: 488355

URL: http://svn.apache.org/viewvc?view=rev&rev=488355
Log:
Updating LDAP Browser Plugin. Updating model classes (Subclipse missed some files in action).

Added:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/SearchManager.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapAndFilterComponent.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilter.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterComponent.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterItemComponent.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapNotFilterComponent.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapOrFilterComponent.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterParser.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterScanner.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterToken.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEOFPart.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEnumeration.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifFile.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifInvalidPart.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifPart.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifChangeAddRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifChangeDeleteRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifChangeModDnRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifChangeModifyRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifChangeRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifCommentContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifContentRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifEOFContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifInvalidContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifModSpec.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifRecord.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifSepContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/container/LdifVersionContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifAttrValLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifChangeTypeLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifCommentLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifControlLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifDeloldrdnLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifDnLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifLineBase.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifModSpecSepLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifModSpecTypeLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifNewrdnLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifNewsuperiorLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifNonEmptyLineBase.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifSepLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifVersionLine.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/parser/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/parser/DummyLdifContainer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/parser/LdifParser.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/parser/LdifScanner.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/parser/LdifToken.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/AttributeTypeDescription.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/AttributeValueProviderRelation.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/BinaryAttribute.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/BinarySyntax.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/LdapSyntaxDescription.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/MatchingRuleDescription.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/MatchingRuleUseDescription.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/ObjectClassDescription.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/Schema.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaPart2.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/SchemaUtils.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/Subschema.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/SyntaxValueProviderRelation.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/default_schema.ldif
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaLexer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaParser.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaTokenTypes.txt
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueLexer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueParser.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/SchemaValueTokenTypes.txt
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schema.g
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/schema/parser/schemavalue.g
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/AttributePropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/BookmarkPropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ConnectionPropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/EntryPropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/SearchPropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/propertypageproviders/ValuePropertyPageProvider.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdapFilterUtils.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/LdifUtils.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/ModelConverter.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/UnixCrypt.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/utils/Utils.java
Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/Activator.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/PreferenceInitializer.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeEditAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeNewAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionDeleteAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionNewAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/EntryDeleteAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RenameAttributeAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeValueWrapper.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/AttributeWrapper.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/DisplayableTreeViewerElement.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-ldapbrowser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/TreeViewerRootNode.java

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/SearchManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/SearchManager.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/SearchManager.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/SearchManager.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+
+
+public class SearchManager implements Serializable
+{
+
+    private static final long serialVersionUID = 8665227628274097691L;
+
+    private List searchList;
+
+    private IConnection connection;
+
+
+    protected SearchManager()
+    {
+    }
+
+
+    public SearchManager( IConnection connection )
+    {
+        this.connection = connection;
+        this.searchList = new ArrayList();
+    }
+
+
+    public IConnection getConnection()
+    {
+        return this.connection;
+    }
+
+
+    public void addSearch( ISearch search )
+    {
+        this.addSearch( this.searchList.size(), search );
+    }
+
+
+    public void addSearch( int index, ISearch search )
+    {
+        if ( this.getSearch( search.getName() ) != null )
+        {
+            String newSearchName = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, "", search.getName() ); //$NON-NLS-1$
+            for ( int i = 2; this.getSearch( newSearchName ) != null; i++ )
+            {
+                newSearchName = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, i + " ", search.getName() ); //$NON-NLS-1$
+            }
+            search.setName( newSearchName );
+        }
+
+        this.searchList.add( index, search );
+        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.SEARCH_ADDED ), this );
+    }
+
+
+    public ISearch getSearch( String name )
+    {
+        for ( Iterator it = this.searchList.iterator(); it.hasNext(); )
+        {
+            ISearch search = ( ISearch ) it.next();
+            if ( search.getName().equals( name ) )
+            {
+                return search;
+            }
+        }
+        return null;
+    }
+
+
+    public int indexOf( ISearch search )
+    {
+        return this.searchList.indexOf( search );
+    }
+
+
+    public void removeSearch( ISearch search )
+    {
+        this.searchList.remove( search );
+        EventRegistry.fireSearchUpdated( new SearchUpdateEvent( search, SearchUpdateEvent.SEARCH_REMOVED ), this );
+    }
+
+
+    public void removeSearch( String name )
+    {
+        this.removeSearch( this.getSearch( name ) );
+    }
+
+
+    public ISearch[] getSearches()
+    {
+        return ( ISearch[] ) this.searchList.toArray( new ISearch[0] );
+    }
+
+
+    public int getSearchCount()
+    {
+        return this.searchList.size();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapAndFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapAndFilterComponent.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapAndFilterComponent.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapAndFilterComponent.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public class LdapAndFilterComponent extends LdapFilterComponent
+{
+
+    public LdapAndFilterComponent( LdapFilter parent )
+    {
+        super( parent );
+    }
+
+
+    public boolean setStartToken( LdapFilterToken andToken )
+    {
+        if ( andToken != null && andToken.getType() == LdapFilterToken.AND )
+        {
+            return super.setStartToken( andToken );
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public String getInvalidCause()
+    {
+        if ( this.startToken == null )
+        {
+            return "Missing AND character '&'";
+        }
+        else if ( this.filterList == null || this.filterList.isEmpty() )
+        {
+            return "Missing filters";
+        }
+        else
+        {
+            return "Invalid AND filter";
+        }
+    }
+
+
+    public String toString()
+    {
+        String s = this.startToken != null ? "&" : "";
+        for ( Iterator it = filterList.iterator(); it.hasNext(); )
+        {
+            LdapFilter filter = ( LdapFilter ) it.next();
+            if ( filter != null )
+            {
+                s += filter.toString();
+            }
+        }
+        return s;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilter.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilter.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilter.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,224 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public class LdapFilter
+{
+
+    private LdapFilterToken startToken;
+
+    private LdapFilterComponent filterComponent;
+
+    private LdapFilterToken stopToken;
+
+    private List otherTokens;
+
+
+    public LdapFilter()
+    {
+        this.startToken = null;
+        this.filterComponent = null;
+        this.stopToken = null;
+        this.otherTokens = new ArrayList( 2 );
+    }
+
+
+    public boolean setStartToken( LdapFilterToken startToken )
+    {
+        if ( this.startToken == null && startToken != null && startToken.getType() == LdapFilterToken.LPAR )
+        {
+            this.startToken = startToken;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public boolean setFilterComponent( LdapFilterComponent filterComponent )
+    {
+        if ( this.startToken != null && this.filterComponent == null && filterComponent != null )
+        {
+            this.filterComponent = filterComponent;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public boolean setStopToken( LdapFilterToken stopToken )
+    {
+        if ( this.startToken != null && this.stopToken == null && stopToken != null
+            && stopToken.getType() == LdapFilterToken.RPAR )
+        {
+            this.stopToken = stopToken;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public void addOtherToken( LdapFilterToken otherToken )
+    {
+        this.otherTokens.add( otherToken );
+    }
+
+
+    public LdapFilterToken getStartToken()
+    {
+        return this.startToken;
+    }
+
+
+    public LdapFilterComponent getFilterComponent()
+    {
+        return this.filterComponent;
+    }
+
+
+    public LdapFilterToken getStopToken()
+    {
+        return this.stopToken;
+    }
+
+
+    public LdapFilterToken[] getTokens()
+    {
+
+        // collect tokens
+        List tokenList = new ArrayList();
+        if ( this.startToken != null )
+        {
+            tokenList.add( this.startToken );
+        }
+        if ( this.stopToken != null )
+        {
+            tokenList.add( this.stopToken );
+        }
+        if ( this.filterComponent != null )
+        {
+            tokenList.addAll( Arrays.asList( this.filterComponent.getTokens() ) );
+        }
+        tokenList.addAll( this.otherTokens );
+
+        // sort tokens
+        LdapFilterToken[] tokens = ( LdapFilterToken[] ) tokenList.toArray( new LdapFilterToken[tokenList.size()] );
+        Arrays.sort( tokens );
+
+        // return
+        return tokens;
+    }
+
+
+    public boolean isValid()
+    {
+        return this.startToken != null && this.filterComponent != null && this.filterComponent.isValid()
+            && this.stopToken != null;
+    }
+
+
+    public LdapFilter[] getInvalidFilters()
+    {
+        if ( this.startToken == null || this.filterComponent == null || this.stopToken == null )
+        {
+            return new LdapFilter[]
+                { this };
+        }
+        else
+        {
+            return this.filterComponent.getInvalidFilters();
+        }
+    }
+
+
+    public LdapFilter getFilter( int offset )
+    {
+        if ( this.startToken != null && this.startToken.getOffset() == offset )
+        {
+            return this;
+        }
+        else if ( this.stopToken != null && this.stopToken.getOffset() == offset )
+        {
+            return this;
+        }
+
+        if ( this.otherTokens != null && this.otherTokens.size() > 0 )
+        {
+            for ( int i = 0; i < this.otherTokens.size(); i++ )
+            {
+                LdapFilterToken otherToken = ( LdapFilterToken ) this.otherTokens.get( i );
+                if ( otherToken != null && otherToken.getOffset() <= offset
+                    && offset < otherToken.getOffset() + otherToken.getLength() )
+                {
+                    return this;
+                }
+            }
+        }
+
+        if ( this.filterComponent != null )
+        {
+            return this.filterComponent.getFilter( offset );
+        }
+
+        return this;
+    }
+
+
+    public String getInvalidCause()
+    {
+        if ( this.stopToken == null )
+        {
+            return BrowserCoreMessages.model_filter_missing_closing_parenthesis;
+        }
+        else if ( this.filterComponent == null )
+        {
+            return BrowserCoreMessages.model_filter_missing_filter_expression;
+        }
+        else
+        {
+            return this.filterComponent.getInvalidCause();
+        }
+    }
+
+
+    public String toString()
+    {
+        return ( this.startToken != null ? "(" : "" ) + ( filterComponent != null ? filterComponent.toString() : "" ) + ( this.stopToken != null ? ")" : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterComponent.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterComponent.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterComponent.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,268 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public abstract class LdapFilterComponent
+{
+
+    protected final LdapFilter parent;
+
+    protected LdapFilterToken startToken;
+
+    protected List filterList;
+
+
+    /**
+     * 
+     * 
+     * @param parent
+     *                the parent filter of this filter component, not null.
+     */
+    public LdapFilterComponent( LdapFilter parent )
+    {
+        if ( parent == null )
+            throw new IllegalArgumentException( "parent is null" );
+
+        this.parent = parent;
+        this.startToken = null;
+        this.filterList = new ArrayList( 2 );
+    }
+
+
+    /**
+     * Returns the parent filter of this filter component.
+     * 
+     * @return the parent filter, never null.
+     */
+    public final LdapFilter getParent()
+    {
+        return this.parent;
+    }
+
+
+    /**
+     * Sets the start token of the filter component. Checks if start token
+     * isn't set yet and if the given start token isn't null.
+     * 
+     * @param startToken
+     * @return true if setting the start token was successful, false
+     *         otherwise.
+     */
+    public boolean setStartToken( LdapFilterToken startToken )
+    {
+        if ( this.startToken == null && startToken != null )
+        {
+            this.startToken = startToken;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Returns the start token of this filter component.
+     * 
+     * @return the start token or null if not set.
+     */
+    public final LdapFilterToken getStartToken()
+    {
+        return this.startToken;
+    }
+
+
+    /**
+     * Adds a filter to the list of subfilters. Checks if the start token
+     * was set before and if the filter isn't null.
+     * 
+     * @param filter
+     * @return true if adding the filter was successful, false otherwise.
+     */
+    public boolean addFilter( LdapFilter filter )
+    {
+        if ( this.startToken != null && filter != null )
+        {
+            this.filterList.add( filter );
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Returns the subfilters of this filter component.
+     * 
+     * @return an array of subfilters or an empty array.
+     */
+    public LdapFilter[] getFilters()
+    {
+        LdapFilter[] filters = new LdapFilter[this.filterList.size()];
+        this.filterList.toArray( filters );
+        return filters;
+    }
+
+
+    /**
+     * Checks if this filter component including all subfilters is valid.
+     * 
+     * @return true if this filter component is valid.
+     */
+    public boolean isValid()
+    {
+        if ( this.startToken == null )
+        {
+            return false;
+        }
+
+        if ( this.filterList.isEmpty() )
+        {
+            return false;
+        }
+
+        for ( Iterator it = filterList.iterator(); it.hasNext(); )
+        {
+            LdapFilter filter = ( LdapFilter ) it.next();
+            if ( filter == null || !filter.isValid() )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * Returns the invalid cause.
+     * 
+     * @return the invalid cause.
+     */
+    public abstract String getInvalidCause();
+
+
+    /**
+     * Returns the invalid filters. This may be the whole parent filter or
+     * any of the subfilters.
+     * 
+     * @return an array of invalid filters or an empty array if all filters
+     *         are valid.
+     */
+    public LdapFilter[] getInvalidFilters()
+    {
+        if ( this.startToken == null || this.filterList.isEmpty() )
+        {
+            return new LdapFilter[]
+                { this.parent };
+        }
+        else
+        {
+            List invalidFilterList = new ArrayList();
+            for ( Iterator it = this.filterList.iterator(); it.hasNext(); )
+            {
+                LdapFilter filter = ( LdapFilter ) it.next();
+                if ( filter != null )
+                {
+                    invalidFilterList.addAll( Arrays.asList( filter.getInvalidFilters() ) );
+                }
+            }
+            return ( LdapFilter[] ) invalidFilterList.toArray( new LdapFilter[invalidFilterList.size()] );
+        }
+    }
+
+
+    /**
+     * Returns all tokens of the filter component including all subfilters.
+     * 
+     * @return an array of tokens of an empty array.
+     */
+    public LdapFilterToken[] getTokens()
+    {
+        // collect tokens
+        List tokenList = new ArrayList();
+        if ( this.startToken != null )
+        {
+            tokenList.add( this.startToken );
+        }
+        for ( Iterator it = this.filterList.iterator(); it.hasNext(); )
+        {
+            LdapFilter filter = ( LdapFilter ) it.next();
+            if ( filter != null )
+            {
+                tokenList.addAll( Arrays.asList( filter.getTokens() ) );
+            }
+        }
+
+        // sort tokens
+        LdapFilterToken[] tokens = ( LdapFilterToken[] ) tokenList.toArray( new LdapFilterToken[tokenList.size()] );
+        Arrays.sort( tokens );
+
+        // return
+        return tokens;
+    }
+
+
+    /**
+     * Returns the filter at the given offset. This may be the whole parent
+     * filter or one of the subfilters.
+     * 
+     * @param offset
+     * @return the filter at the given offset or null is offset is out of
+     *         range.
+     */
+    public LdapFilter getFilter( int offset )
+    {
+        if ( this.startToken != null && this.startToken.getOffset() == offset )
+        {
+            return this.parent;
+        }
+        else if ( this.filterList != null || !this.filterList.isEmpty() )
+        {
+            for ( Iterator it = this.filterList.iterator(); it.hasNext(); )
+            {
+                LdapFilter filter = ( LdapFilter ) it.next();
+                if ( filter != null && filter.getFilter( offset ) != null )
+                {
+                    return filter.getFilter( offset );
+                }
+            }
+            return null;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterItemComponent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterItemComponent.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterItemComponent.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapFilterItemComponent.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public class LdapFilterItemComponent extends LdapFilterComponent
+{
+
+    private LdapFilterToken filtertypeToken;
+
+    private LdapFilterToken valueToken;
+
+
+    public LdapFilterItemComponent( LdapFilter parent )
+    {
+        super( parent );
+        this.filtertypeToken = null;
+        this.valueToken = null;
+    }
+
+
+    public boolean setStartToken( LdapFilterToken attributeToken )
+    {
+        if ( attributeToken != null && attributeToken.getType() == LdapFilterToken.ATTRIBUTE )
+        {
+            super.setStartToken( attributeToken );
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public boolean setAttributeToken( LdapFilterToken attributeToken )
+    {
+        return this.setStartToken( attributeToken );
+    }
+
+
+    public LdapFilterToken getAttributeToken()
+    {
+        return this.getStartToken();
+    }
+
+
+    public boolean setFiltertypeToken( LdapFilterToken filtertypeToken )
+    {
+        if ( this.filtertypeToken == null
+            && filtertypeToken != null
+            && ( filtertypeToken.getType() == LdapFilterToken.EQUAL
+                || filtertypeToken.getType() == LdapFilterToken.GREATER
+                || filtertypeToken.getType() == LdapFilterToken.LESS
+                || filtertypeToken.getType() == LdapFilterToken.APROX || filtertypeToken.getType() == LdapFilterToken.PRESENT ) )
+        {
+            this.filtertypeToken = filtertypeToken;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public LdapFilterToken getFilterToken()
+    {
+        return this.filtertypeToken;
+    }
+
+
+    public boolean setValueToken( LdapFilterToken valueToken )
+    {
+        if ( this.valueToken == null && valueToken != null && valueToken.getType() == LdapFilterToken.VALUE )
+        {
+            this.valueToken = valueToken;
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public LdapFilterToken getValueToken()
+    {
+        return this.valueToken;
+    }
+
+
+    public boolean isValid()
+    {
+        return startToken != null && filtertypeToken != null
+            && ( valueToken != null || filtertypeToken.getType() == LdapFilterToken.PRESENT );
+    }
+
+
+    public LdapFilterToken[] getTokens()
+    {
+        // collect tokens
+        List tokenList = new ArrayList();
+        if ( this.startToken != null )
+        {
+            tokenList.add( this.startToken );
+        }
+        if ( this.filtertypeToken != null )
+        {
+            tokenList.add( this.filtertypeToken );
+        }
+        if ( this.valueToken != null )
+        {
+            tokenList.add( this.valueToken );
+        }
+
+        // sort tokens
+        LdapFilterToken[] tokens = ( LdapFilterToken[] ) tokenList.toArray( new LdapFilterToken[tokenList.size()] );
+        Arrays.sort( tokens );
+
+        // return
+        return tokens;
+    }
+
+
+    public String toString()
+    {
+        return ( startToken != null ? startToken.getValue() : "" )
+            + ( filtertypeToken != null ? filtertypeToken.getValue() : "" )
+            + ( valueToken != null ? valueToken.getValue() : "" );
+    }
+
+
+    public boolean addFilter( LdapFilter filter )
+    {
+        return false;
+    }
+
+
+    public LdapFilter[] getInvalidFilters()
+    {
+        if ( this.isValid() )
+        {
+            return new LdapFilter[0];
+        }
+        else
+        {
+            return new LdapFilter[]
+                { parent };
+        }
+    }
+
+
+    public LdapFilter getFilter( int offset )
+    {
+        if ( this.startToken != null && this.startToken.getOffset() <= offset
+            && offset < this.startToken.getOffset() + this.startToken.getLength() )
+        {
+            return this.parent;
+        }
+        else if ( this.filtertypeToken != null && this.filtertypeToken.getOffset() <= offset
+            && offset < this.filtertypeToken.getOffset() + this.filtertypeToken.getLength() )
+        {
+            return this.parent;
+        }
+        else if ( this.valueToken != null && this.valueToken.getOffset() <= offset
+            && offset < this.valueToken.getOffset() + this.valueToken.getLength() )
+        {
+            return this.parent;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public String getInvalidCause()
+    {
+        if ( this.startToken == null )
+        {
+            return "Missing attribute name";
+        }
+        else if ( this.filtertypeToken == null )
+        {
+            return "Missing filter type, select one of '=', '>=', '<=','~='";
+        }
+        else if ( this.valueToken == null )
+        {
+            return "Missing value";
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapNotFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapNotFilterComponent.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapNotFilterComponent.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapNotFilterComponent.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public class LdapNotFilterComponent extends LdapFilterComponent
+{
+
+    public LdapNotFilterComponent( LdapFilter parent )
+    {
+        super( parent );
+    }
+
+
+    public boolean setStartToken( LdapFilterToken notToken )
+    {
+        if ( notToken != null && notToken.getType() == LdapFilterToken.NOT )
+        {
+            return super.setStartToken( notToken );
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Checks additionally if the the filter wasn't set before.
+     * 
+     * @see LdapFilterComponent#addFilter(LdapFilter)
+     */
+    public boolean addFilter( LdapFilter filter )
+    {
+        if ( this.filterList.isEmpty() )
+        {
+            return super.addFilter( filter );
+        }
+        else
+        {
+            // There is already a filter in the list. A NOT filter
+            // can only contain one filter.
+            return false;
+        }
+    }
+
+
+    public String getInvalidCause()
+    {
+        if ( this.startToken == null )
+        {
+            return "Missing NOT character '!'";
+        }
+        else if ( this.filterList == null || this.filterList.isEmpty() )
+        {
+            return "Missing filter expression";
+        }
+        else
+        {
+            return "Invalid NOT filter";
+        }
+    }
+
+
+    public String toString()
+    {
+        return ( this.startToken != null ? "!" : "" )
+            + ( !this.filterList.isEmpty() ? this.filterList.get( 0 ).toString() : "" );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapOrFilterComponent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapOrFilterComponent.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapOrFilterComponent.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/LdapOrFilterComponent.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.parser.LdapFilterToken;
+
+
+public class LdapOrFilterComponent extends LdapFilterComponent
+{
+
+    public LdapOrFilterComponent( LdapFilter parent )
+    {
+        super( parent );
+    }
+
+
+    public boolean setStartToken( LdapFilterToken orToken )
+    {
+        if ( orToken != null && orToken.getType() == LdapFilterToken.OR )
+        {
+            return super.setStartToken( orToken );
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public String getInvalidCause()
+    {
+        if ( this.startToken == null )
+        {
+            return "Missing OR character '|'";
+        }
+        else if ( this.filterList == null || this.filterList.isEmpty() )
+        {
+            return "Missing filters";
+        }
+        else
+        {
+            return "Invalid OR filter";
+        }
+    }
+
+
+    public String toString()
+    {
+        String s = this.startToken != null ? "|" : "";
+        for ( Iterator it = filterList.iterator(); it.hasNext(); )
+        {
+            LdapFilter filter = ( LdapFilter ) it.next();
+            if ( filter != null )
+            {
+                s += filter.toString();
+            }
+        }
+        return s;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterParser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterParser.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterParser.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterParser.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,223 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter.parser;
+
+
+import java.util.Stack;
+
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapAndFilterComponent;
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapFilter;
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapFilterComponent;
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapFilterItemComponent;
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapNotFilterComponent;
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapOrFilterComponent;
+
+
+public class LdapFilterParser
+{
+
+    private LdapFilterScanner scanner;
+
+    private Stack filterStack;
+
+    private LdapFilter model;
+
+
+    public LdapFilterParser()
+    {
+        this.scanner = new LdapFilterScanner();
+        this.model = new LdapFilter();
+    }
+
+
+    public LdapFilter getModel()
+    {
+        return this.model;
+    }
+
+
+    public void parse( String ldapFilter )
+    {
+
+        // reset state
+        this.filterStack = new Stack();
+        this.scanner.setFilter( ldapFilter );
+        this.model = new LdapFilter();
+
+        // handle error tokens before filter
+        LdapFilterToken token = this.scanner.nextToken();
+        while ( token.getType() != LdapFilterToken.LPAR && token.getType() != LdapFilterToken.EOF )
+        {
+            this.handleError( false, token, this.model );
+            token = scanner.nextToken();
+        }
+
+        // check filter start
+        if ( token.getType() == LdapFilterToken.LPAR )
+        {
+
+            // start top level filter
+            this.model.setStartToken( token );
+            filterStack.push( this.model );
+
+            // loop till filter end or EOF
+            do
+            {
+
+                // next token
+                token = this.scanner.nextToken();
+
+                switch ( token.getType() )
+                {
+                    case LdapFilterToken.LPAR:
+                    {
+                        LdapFilter newFilter = new LdapFilter();
+                        newFilter.setStartToken( token );
+
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapFilterComponent filterComponent = currentFilter.getFilterComponent();
+                        if ( filterComponent != null && filterComponent.addFilter( newFilter ) )
+                        {
+                            filterStack.push( newFilter );
+                        }
+                        else
+                        {
+                            currentFilter.addOtherToken( token );
+                        }
+
+                        break;
+                    }
+                    case LdapFilterToken.RPAR:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.pop();
+                        this.handleError( currentFilter.setStopToken( token ), token, currentFilter );
+                        /*
+                         * if(!filterStack.isEmpty()) { LdapFilter parentFilter =
+                         * (LdapFilter) filterStack.peek(); LdapFilterComponent
+                         * filterComponent = parentFilter.getFilterComponent();
+                         * filterComponent.addFilter(currentFilter); }
+                         */
+                        break;
+                    }
+                    case LdapFilterToken.AND:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapAndFilterComponent filterComponent = new LdapAndFilterComponent( currentFilter );
+                        filterComponent.setStartToken( token );
+                        this.handleError( currentFilter.setFilterComponent( filterComponent ), token, currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.OR:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapOrFilterComponent filterComponent = new LdapOrFilterComponent( currentFilter );
+                        filterComponent.setStartToken( token );
+                        this.handleError( currentFilter.setFilterComponent( filterComponent ), token, currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.NOT:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapNotFilterComponent filterComponent = new LdapNotFilterComponent( currentFilter );
+                        filterComponent.setStartToken( token );
+                        this.handleError( currentFilter.setFilterComponent( filterComponent ), token, currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.ATTRIBUTE:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapFilterItemComponent filterComponent = new LdapFilterItemComponent( currentFilter );
+                        filterComponent.setAttributeToken( token );
+                        this.handleError( currentFilter.setFilterComponent( filterComponent ), token, currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.VALUE:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapFilterComponent filterComponent = currentFilter.getFilterComponent();
+                        this.handleError( ( filterComponent instanceof LdapFilterItemComponent )
+                            && ( ( LdapFilterItemComponent ) filterComponent ).setValueToken( token ), token,
+                            currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.EQUAL:
+                    case LdapFilterToken.GREATER:
+                    case LdapFilterToken.LESS:
+                    case LdapFilterToken.APROX:
+                    case LdapFilterToken.PRESENT:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        LdapFilterComponent filterComponent = currentFilter.getFilterComponent();
+                        this.handleError( ( filterComponent instanceof LdapFilterItemComponent )
+                            && ( ( LdapFilterItemComponent ) filterComponent ).setFiltertypeToken( token ), token,
+                            currentFilter );
+                        break;
+                    }
+                    case LdapFilterToken.WHITESPACE:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        currentFilter.addOtherToken( token );
+                        break;
+                    }
+                    case LdapFilterToken.EOF:
+                    {
+                        this.model.addOtherToken( token );
+                        break;
+                    }
+                    default:
+                    {
+                        LdapFilter currentFilter = ( LdapFilter ) filterStack.peek();
+                        this.handleError( false, token, currentFilter );
+                    }
+                }
+            }
+            while ( !filterStack.isEmpty() && token.getType() != LdapFilterToken.EOF );
+
+        }
+
+        // handle error token after filter
+        token = scanner.nextToken();
+        while ( token.getType() != LdapFilterToken.EOF )
+        {
+            this.handleError( false, token, this.model );
+            token = scanner.nextToken();
+        }
+
+    }
+
+
+    private void handleError( boolean success, LdapFilterToken token, LdapFilter filter )
+    {
+        if ( !success )
+        {
+            filter.addOtherToken( new LdapFilterToken( LdapFilterToken.ERROR, token.getValue(), token.getOffset() ) );
+        }
+    }
+
+
+    public static void main( String[] args )
+    {
+        LdapFilterParser parser = new LdapFilterParser();
+        parser.parse( "(sn" );
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterScanner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterScanner.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterScanner.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterScanner.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,355 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter.parser;
+
+
+public class LdapFilterScanner
+{
+
+    // From RFC 2254:
+    // -------------
+    // The string representation of an LDAP search filter is defined by the
+    // following grammar, following the ABNF notation defined in [5]. The
+    // filter format uses a prefix notation.
+    //	
+    // filter = "(" filtercomp ")"
+    // filtercomp = and / or / not / item
+    // and = "&" filterlist
+    // or = "|" filterlist
+    // not = "!" filter
+    // filterlist = 1*filter
+    // item = simple / present / substring / extensible
+    // simple = attr filtertype value
+    // filtertype = equal / approx / greater / less
+    // equal = "="
+    // approx = "~="
+    // greater = ">="
+    // less = "<="
+    // extensible = attr [":dn"] [":" matchingrule] ":=" value
+    // / [":dn"] ":" matchingrule ":=" value
+    // present = attr "=*"
+    // substring = attr "=" [initial] any [final]
+    // initial = value
+    // any = "*" *(value "*")
+    // final = value
+    // attr = AttributeDescription from Section 4.1.5 of [1]
+    // matchingrule = MatchingRuleId from Section 4.1.9 of [1]
+    // value = AttributeValue from Section 4.1.6 of [1]
+    //	
+    // The attr, matchingrule, and value constructs are as described in the
+    // corresponding section of [1] given above.
+    //	
+    // If a value should contain any of the following characters
+    //	
+    // Character ASCII value
+    // ---------------------------
+    // * 0x2a
+    // ( 0x28
+    // ) 0x29
+    // \ 0x5c
+    // NUL 0x00
+    //	
+    // the character must be encoded as the backslash '\' character (ASCII
+    // 0x5c) followed by the two hexadecimal digits representing the ASCII
+    // value of the encoded character. The case of the two hexadecimal
+    // digits is not significant.
+
+    private String filter;
+
+    private int pos;
+
+    private int lastTokenType;
+
+
+    public LdapFilterScanner()
+    {
+        super();
+        this.filter = "";
+    }
+
+
+    public void setFilter( String filter )
+    {
+        this.filter = filter;
+        this.pos = -1;
+        this.lastTokenType = LdapFilterToken.NEW;
+    }
+
+
+    private char currentChar()
+    {
+        return 0 <= pos && pos < filter.length() ? filter.charAt( pos ) : '\u0000';
+    }
+
+
+    private char nextChar()
+    {
+        pos++;
+        return currentChar();
+    }
+
+
+    private char prevChar()
+    {
+        pos--;
+        return currentChar();
+    }
+
+
+    private char nextNonLinebreakChar()
+    {
+        while ( nextChar() == '\n' );
+        return currentChar();
+    }
+
+
+    private char prevNonLinebreakChar()
+    {
+        while ( prevChar() == '\n' );
+        return currentChar();
+    }
+
+
+    // private char nextNonWhitespaceChar() {
+    // while(Character.isWhitespace(nextChar()));
+    // return currentChar();
+    // }
+    // private char prevNonWhitespaceChar() {
+    // while(Character.isWhitespace(prevChar()));
+    // return currentChar();
+    // }
+
+    public LdapFilterToken nextToken()
+    {
+        char c;
+
+        // check for EOF
+        c = nextChar();
+        if ( c == '\u0000' )
+        {
+            return new LdapFilterToken( LdapFilterToken.EOF, "", pos );
+        }
+        else
+        {
+            prevChar();
+        }
+
+        // check for ignorable whitespaces
+        c = nextChar();
+        if ( Character.isWhitespace( c )
+            && ( lastTokenType == LdapFilterToken.RPAR || lastTokenType == LdapFilterToken.AND
+                || lastTokenType == LdapFilterToken.OR || lastTokenType == LdapFilterToken.NOT ) )
+        {
+            StringBuffer sb = new StringBuffer();
+            while ( Character.isWhitespace( c ) )
+            {
+                sb.append( c );
+                c = nextChar();
+            }
+            prevChar();
+            return new LdapFilterToken( LdapFilterToken.WHITESPACE, sb.toString(), pos - sb.length() + 1 );
+        }
+        else
+        {
+            prevChar();
+        }
+
+        // check special characters
+        c = nextChar();
+        switch ( c )
+        {
+            case '(':
+                this.lastTokenType = LdapFilterToken.LPAR;
+                return new LdapFilterToken( this.lastTokenType, "(", pos );
+            case ')':
+                this.lastTokenType = LdapFilterToken.RPAR;
+                return new LdapFilterToken( this.lastTokenType, ")", pos );
+            case '&':
+                if ( lastTokenType == LdapFilterToken.LPAR )
+                {
+                    // if(nextNonWhitespaceChar()=='(') {
+                    // prevNonWhitespaceChar();
+                    this.lastTokenType = LdapFilterToken.AND;
+                    return new LdapFilterToken( this.lastTokenType, "&", pos );
+                    // }
+                    // else {
+                    // prevNonWhitespaceChar();
+                    // }
+                }
+                break;
+            case '|':
+                if ( lastTokenType == LdapFilterToken.LPAR )
+                {
+                    // if(nextNonWhitespaceChar()=='(') {
+                    // prevNonWhitespaceChar();
+                    this.lastTokenType = LdapFilterToken.OR;
+                    return new LdapFilterToken( this.lastTokenType, "|", pos );
+                    // }
+                    // else {
+                    // prevNonWhitespaceChar();
+                    // }
+                }
+                break;
+            case '!':
+                if ( lastTokenType == LdapFilterToken.LPAR )
+                {
+                    // if(nextNonWhitespaceChar()=='(') {
+                    // prevNonWhitespaceChar();
+                    this.lastTokenType = LdapFilterToken.NOT;
+                    return new LdapFilterToken( this.lastTokenType, "!", pos );
+                    // }
+                    // else {
+                    // prevNonWhitespaceChar();
+                    // }
+                }
+                break;
+            case '=':
+                if ( lastTokenType == LdapFilterToken.ATTRIBUTE )
+                {
+                    if ( nextChar() == '*' )
+                    {
+                        char t = nextChar();
+                        if ( t == ')' || t == '\u0000' )
+                        {
+                            prevChar();
+                            this.lastTokenType = LdapFilterToken.PRESENT;
+                            return new LdapFilterToken( this.lastTokenType, "=*", pos - 1 );
+                        }
+                        else
+                        {
+                            prevChar();
+                            prevChar();
+                            this.lastTokenType = LdapFilterToken.EQUAL;
+                            return new LdapFilterToken( this.lastTokenType, "=", pos );
+                        }
+                    }
+                    else
+                    {
+                        prevChar();
+                        this.lastTokenType = LdapFilterToken.EQUAL;
+                        return new LdapFilterToken( this.lastTokenType, "=", pos );
+                    }
+                }
+                break;
+            case '>':
+                if ( lastTokenType == LdapFilterToken.ATTRIBUTE )
+                {
+                    if ( nextChar() == '=' )
+                    {
+                        this.lastTokenType = LdapFilterToken.GREATER;
+                        return new LdapFilterToken( this.lastTokenType, ">=", pos - 1 );
+                    }
+                    else
+                    {
+                        prevChar();
+                    }
+                }
+                break;
+            case '<':
+                if ( lastTokenType == LdapFilterToken.ATTRIBUTE )
+                {
+                    if ( nextChar() == '=' )
+                    {
+                        this.lastTokenType = LdapFilterToken.LESS;
+                        return new LdapFilterToken( this.lastTokenType, "<=", pos - 1 );
+                    }
+                    else
+                    {
+                        prevChar();
+                    }
+                }
+                break;
+            case '~':
+                if ( lastTokenType == LdapFilterToken.ATTRIBUTE )
+                {
+                    if ( nextChar() == '=' )
+                    {
+                        this.lastTokenType = LdapFilterToken.APROX;
+                        return new LdapFilterToken( this.lastTokenType, "~=", pos - 1 );
+                    }
+                    else
+                    {
+                        prevChar();
+                    }
+                }
+                break;
+        } // switch
+        prevChar();
+
+        // check attribute
+        if ( this.lastTokenType == LdapFilterToken.LPAR )
+        {
+            StringBuffer sb = new StringBuffer();
+
+            // first char must be non-whitespace
+            c = nextChar();
+            while ( c != '=' && c != '<' && c != '>' && c != '~' && c != '(' && c != ')' && c != '\u0000'
+                && !Character.isWhitespace( c ) )
+            {
+                sb.append( c );
+                c = nextChar();
+            }
+            prevChar();
+
+            if ( sb.length() > 0 )
+            {
+                this.lastTokenType = LdapFilterToken.ATTRIBUTE;
+                return new LdapFilterToken( this.lastTokenType, sb.toString(), pos - sb.length() + 1 );
+            }
+        }
+
+        // check value
+        if ( lastTokenType == LdapFilterToken.EQUAL || lastTokenType == LdapFilterToken.GREATER
+            || lastTokenType == LdapFilterToken.LESS || lastTokenType == LdapFilterToken.APROX )
+        {
+
+            StringBuffer sb = new StringBuffer();
+            c = nextNonLinebreakChar();
+            while ( c != '(' && c != ')' && c != '\u0000' )
+            {
+                sb.append( c );
+                c = nextNonLinebreakChar();
+            }
+            prevNonLinebreakChar();
+
+            if ( sb.length() > 0 )
+            {
+                this.lastTokenType = LdapFilterToken.VALUE;
+                return new LdapFilterToken( this.lastTokenType, sb.toString(), pos - sb.length() + 1 );
+            }
+        }
+
+        // no match
+        StringBuffer sb = new StringBuffer();
+        c = nextChar();
+        while ( c != '(' && c != ')' && c != '\u0000' )
+        {
+            sb.append( c );
+            c = nextChar();
+        }
+        prevChar();
+        // this.lastTokenType = LdapFilterToken.UNKNOWN;
+        // return new LdapFilterToken(this.lastTokenType, sb.toString(),
+        // pos-sb.length());
+        return new LdapFilterToken( LdapFilterToken.UNKNOWN, sb.toString(), pos - sb.length() + 1 );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterToken.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterToken.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterToken.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/filter/parser/LdapFilterToken.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,131 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.filter.parser;
+
+
+public class LdapFilterToken implements Comparable
+{
+
+    public static final int NEW = Integer.MIN_VALUE;
+
+    public static final int ERROR = -2;
+
+    public static final int EOF = -1;
+
+    public static final int UNKNOWN = 0;
+
+    public static final int WHITESPACE = 1;
+
+    public static final int LPAR = 11;
+
+    public static final int RPAR = 12;
+
+    public static final int AND = 21;
+
+    public static final int OR = 22;
+
+    public static final int NOT = 23;
+
+    public static final int ATTRIBUTE = 31;
+
+    public static final int EQUAL = 41;
+
+    public static final int APROX = 42;
+
+    public static final int GREATER = 43;
+
+    public static final int LESS = 44;
+
+    public static final int PRESENT = 45;
+
+    public static final int VALUE = 51;
+
+    public static final int ASTERISK = 52;
+
+    private int offset;
+
+    private int type;
+
+    private String value;
+
+
+    public LdapFilterToken( int type, String value, int offset )
+    {
+        this.type = type;
+        this.value = value;
+        this.offset = offset;
+    }
+
+
+    /**
+     * Returns the start position of the token in the original filter
+     * 
+     * @return the start positon of the token
+     */
+    public int getOffset()
+    {
+        return this.offset;
+    }
+
+
+    /**
+     * Returns the length of the token in the original filter
+     * 
+     * @return the length of the token
+     */
+    public int getLength()
+    {
+        return this.value.length();
+    }
+
+
+    public int getType()
+    {
+        return this.type;
+    }
+
+
+    public String getValue()
+    {
+        return this.value;
+    }
+
+
+    public String toString()
+    {
+        return "(" + this.offset + ") " + "(" + this.type + ") " + this.value;
+    }
+
+
+    public int compareTo( Object o )
+    {
+        if ( o instanceof LdapFilterToken )
+        {
+            LdapFilterToken token = ( LdapFilterToken ) o;
+            return this.offset - token.offset;
+        }
+        else
+        {
+            throw new ClassCastException( "Not instanceof LapFilterToken: " + o.getClass().getName() );
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEOFPart.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEOFPart.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEOFPart.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEOFPart.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.ldif;
+
+
+public final class LdifEOFPart implements LdifPart
+{
+
+    private static final long serialVersionUID = -8527682569842893613L;
+
+    private int offset;
+
+
+    protected LdifEOFPart()
+    {
+    }
+
+
+    public LdifEOFPart( int offset )
+    {
+        this.offset = offset;
+    }
+
+
+    public final int getOffset()
+    {
+        return this.offset;
+    }
+
+
+    public final int getLength()
+    {
+        return 0;
+    }
+
+
+    public final String toRawString()
+    {
+        return "";
+    }
+
+
+    public final String toFormattedString()
+    {
+        return "";
+    }
+
+
+    public final String toString()
+    {
+        String text = toRawString();
+        text = text.replaceAll( "\n", "\\\\n" );
+        text = text.replaceAll( "\r", "\\\\r" );
+        return getClass().getName() + " (" + getOffset() + "," + getLength() + "): '" + text + "'";
+    }
+
+
+    public final boolean isValid()
+    {
+        return true;
+    }
+
+
+    public final String getInvalidString()
+    {
+        return "";
+    }
+
+
+    public final void adjustOffset( int adjust )
+    {
+        this.offset += adjust;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEnumeration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEnumeration.java?view=auto&rev=488355
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEnumeration.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-core/src/org/apache/directory/ldapstudio/browser/core/model/ldif/LdifEnumeration.java Mon Dec 18 09:32:03 2006
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.core.model.ldif;
+
+
+import org.apache.directory.ldapstudio.browser.core.internal.model.ConnectionException;
+import org.apache.directory.ldapstudio.browser.core.jobs.ExtendedProgressMonitor;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer;
+
+
+public interface LdifEnumeration
+{
+
+    /**
+     * 
+     * @param monitor
+     *                The monitor to check for cancellation. Don't report
+     *                errors to the monitor, throw an ConnectionException
+     *                instead.
+     * @throws ConnectionException
+     */
+    public boolean hasNext( ExtendedProgressMonitor monitor ) throws ConnectionException;
+
+
+    /**
+     * 
+     * @param monitor
+     *                The monitor to check for cancellation. Don't report
+     *                errors to the monitor, throw an ConnectionException
+     *                instead.
+     * @return the next LDIF container or null if hasNext() returns false;
+     * @throws ConnectionException
+     */
+    public LdifContainer next( ExtendedProgressMonitor monitor ) throws ConnectionException;
+
+}



Mime
View raw message