You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2006/12/18 18:53:22 UTC

svn commit: r488368 [19/23] - in /directory/sandbox/pamarcelot/ldapstudio: ldapstudio-browser-ui/ ldapstudio-browser-ui/META-INF/ ldapstudio-browser-ui/about_files/ ldapstudio-browser-ui/icons/ ldapstudio-browser-ui/icons/ovr16/ ldapstudio-browser-ui/s...

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,481 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+public class ObjectClassDescriptionDetailsPage extends SchemaDetailsPage
+{
+
+    private Section mainSection;
+
+    private Text numericOidText;
+
+    private Text nameText;
+
+    private Text descText;
+
+    private Text kindText;
+
+    private Section superclassesSection;
+
+    private Hyperlink[] superLinks;
+
+    private Section subclassesSection;
+
+    private Hyperlink[] subLinks;
+
+    private Section mustSection;
+
+    private Hyperlink[] mustLinks;
+
+    private Section maySection;
+
+    private Hyperlink[] mayLinks;
+
+
+    public ObjectClassDescriptionDetailsPage( SchemaBrowser schemaBrowser, FormToolkit toolkit )
+    {
+        super( schemaBrowser, toolkit );
+    }
+
+
+    public void createContents( final ScrolledForm detailForm )
+    {
+
+        this.detailForm = detailForm;
+        detailForm.getBody().setLayout( new GridLayout() );
+
+        mainSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
+        mainSection.setText( "Details" );
+        mainSection.marginWidth = 0;
+        mainSection.marginHeight = 0;
+        mainSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( mainSection );
+
+        mustSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        mustSection.setText( "MUST Attributes" );
+        mustSection.marginWidth = 0;
+        mustSection.marginHeight = 0;
+        mustSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( mustSection );
+        mustSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        maySection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        maySection.setText( "MAY Attributes" );
+        maySection.marginWidth = 0;
+        maySection.marginHeight = 0;
+        maySection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( maySection );
+        maySection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        superclassesSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        superclassesSection.setText( "Superclasses" );
+        superclassesSection.marginWidth = 0;
+        superclassesSection.marginHeight = 0;
+        superclassesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( superclassesSection );
+        superclassesSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        subclassesSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        subclassesSection.setText( "Subclasses" );
+        subclassesSection.marginWidth = 0;
+        subclassesSection.marginHeight = 0;
+        subclassesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( subclassesSection );
+        subclassesSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        super.createRawSection();
+
+    }
+
+
+    public void objectClassDescriptionSelected( ObjectClassDescription ocd )
+    {
+        this.createMainContent( ocd );
+
+        this.createSuperclassContents( ocd );
+        this.createSubclassContents( ocd );
+
+        this.createMustContents( ocd );
+        this.createMayContents( ocd );
+
+        super.createRawContents( ocd );
+
+        this.detailForm.reflow( true );
+        this.detailForm.redraw();
+    }
+
+
+    private void createMainContent( ObjectClassDescription ocd )
+    {
+
+        // int labelWidth = 100;
+
+        if ( mainSection.getClient() != null )
+        {
+            if ( mainSection.getClient() instanceof Composite )
+            {
+                Composite client = ( Composite ) mainSection.getClient();
+                if ( client.getChildren() != null && client.getChildren().length > 0 )
+                {
+                    // labelWidth = client.getChildren()[0].getSize().x;
+                }
+            }
+            mainSection.getClient().dispose();
+        }
+
+        Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
+        GridLayout mainLayout = new GridLayout( 2, false );
+        mainClient.setLayout( mainLayout );
+        mainSection.setClient( mainClient );
+
+        if ( ocd != null )
+        {
+            toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( ocd.getNumericOID() ), SWT.NONE );
+            numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            numericOidText.setEditable( false );
+
+            toolkit.createLabel( mainClient, "Objectclass names:", SWT.NONE );
+            nameText = toolkit.createText( mainClient, getNonNullString( ocd.toString() ), SWT.NONE );
+            nameText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            nameText.setEditable( false );
+
+            toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
+            descText = toolkit.createText( mainClient, getNonNullString( ocd.getDesc() ), SWT.WRAP | SWT.MULTI );
+            GridData gd = new GridData( GridData.FILL_HORIZONTAL );
+            gd.widthHint = detailForm.getForm().getSize().x - 100 - 60;
+            descText.setLayoutData( gd );
+            descText.setEditable( false );
+
+            String kind = "";
+            if ( ocd.isStructural() )
+                kind = "structural";
+            else if ( ocd.isAbstract() )
+                kind = "abstract";
+            else if ( ocd.isAuxiliary() )
+                kind = "auxiliary";
+            if ( ocd.isObsolete() )
+                kind += " (obsolete)";
+            toolkit.createLabel( mainClient, "Objectclass kind:", SWT.NONE );
+            kindText = toolkit.createText( mainClient, getNonNullString( kind ), SWT.NONE );
+            kindText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            kindText.setEditable( false );
+
+        }
+
+        mainSection.layout();
+    }
+
+
+    private void createMustContents( ObjectClassDescription ocd )
+    {
+        if ( mustSection.getClient() != null )
+        {
+            mustSection.getClient().dispose();
+        }
+
+        Composite mustClient = toolkit.createComposite( mustSection, SWT.WRAP );
+        mustClient.setLayout( new GridLayout() );
+        mustSection.setClient( mustClient );
+
+        if ( ocd != null )
+        {
+            String[] names = ocd.getMustAttributeTypeDescriptionNamesTransitive();
+            if ( names != null && names.length > 0 )
+            {
+                mustSection.setText( "MUST Attributes (" + names.length + ")" );
+                mustLinks = new Hyperlink[names.length];
+                for ( int i = 0; i < names.length; i++ )
+                {
+                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    {
+                        AttributeTypeDescription mustAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
+                        mustLinks[i] = toolkit.createHyperlink( mustClient, mustAtd.toString(), SWT.WRAP );
+                        mustLinks[i].setHref( mustAtd );
+                        mustLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        mustLinks[i].setUnderlined( true );
+                        mustLinks[i].setEnabled( true );
+                        mustLinks[i].addHyperlinkListener( new HyperlinkAdapter()
+                        {
+                            public void linkActivated( HyperlinkEvent e )
+                            {
+                                SchemaBrowser.select( e.getHref() );
+                            }
+                        } );
+                    }
+                    else
+                    {
+                        mustLinks[i] = toolkit.createHyperlink( mustClient, names[i], SWT.WRAP );
+                        mustLinks[i].setHref( null );
+                        mustLinks[i].setUnderlined( false );
+                        mustLinks[i].setEnabled( false );
+                    }
+                }
+            }
+            else
+            {
+                mustSection.setText( "MUST Attributes (0)" );
+                mustLinks = new Hyperlink[0];
+                Text mustText = toolkit.createText( mustClient, getNonNullString( null ), SWT.NONE );
+                mustText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                mustText.setEditable( false );
+            }
+        }
+        else
+        {
+            mustSection.setText( "MUST Attributes" );
+        }
+
+        mustSection.layout();
+    }
+
+
+    private void createMayContents( ObjectClassDescription ocd )
+    {
+        if ( maySection.getClient() != null )
+        {
+            maySection.getClient().dispose();
+        }
+
+        Composite mayClient = toolkit.createComposite( maySection, SWT.WRAP );
+        mayClient.setLayout( new GridLayout() );
+        maySection.setClient( mayClient );
+
+        if ( ocd != null )
+        {
+            String[] names = ocd.getMayAttributeTypeDescriptionNamesTransitive();
+            if ( names != null && names.length > 0 )
+            {
+                maySection.setText( "MAY Attributes (" + names.length + ")" );
+                mayLinks = new Hyperlink[names.length];
+                for ( int i = 0; i < names.length; i++ )
+                {
+                    if ( ocd.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    {
+                        AttributeTypeDescription mayAtd = ocd.getSchema().getAttributeTypeDescription( names[i] );
+                        mayLinks[i] = toolkit.createHyperlink( mayClient, mayAtd.toString(), SWT.WRAP );
+                        mayLinks[i].setHref( mayAtd );
+                        mayLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        mayLinks[i].setUnderlined( true );
+                        mayLinks[i].setEnabled( true );
+                        mayLinks[i].addHyperlinkListener( new HyperlinkAdapter()
+                        {
+                            public void linkActivated( HyperlinkEvent e )
+                            {
+                                SchemaBrowser.select( e.getHref() );
+
+                            }
+                        } );
+                    }
+                    else
+                    {
+                        mayLinks[i] = toolkit.createHyperlink( mayClient, names[i], SWT.WRAP );
+                        mayLinks[i].setHref( null );
+                        mayLinks[i].setUnderlined( false );
+                        mayLinks[i].setEnabled( false );
+                    }
+                }
+            }
+            else
+            {
+                maySection.setText( "MAY Attributes (0)" );
+                mayLinks = new Hyperlink[0];
+                Text mayText = toolkit.createText( mayClient, getNonNullString( null ), SWT.NONE );
+                mayText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                mayText.setEditable( false );
+            }
+        }
+        else
+        {
+            maySection.setText( "MAY Attributes" );
+        }
+        maySection.layout();
+    }
+
+
+    private void createSubclassContents( ObjectClassDescription ocd )
+    {
+
+        if ( subclassesSection.getClient() != null )
+        {
+            subclassesSection.getClient().dispose();
+        }
+
+        Composite subClient = toolkit.createComposite( subclassesSection, SWT.WRAP );
+        subClient.setLayout( new GridLayout() );
+        subclassesSection.setClient( subClient );
+
+        if ( ocd != null )
+        {
+            ObjectClassDescription[] subOCDs = ocd.getSubObjectClassDescriptions();
+            if ( subOCDs != null && subOCDs.length > 0 )
+            {
+                subclassesSection.setText( "Subclasses (" + subOCDs.length + ")" );
+                subLinks = new Hyperlink[subOCDs.length];
+                for ( int i = 0; i < subOCDs.length; i++ )
+                {
+                    subLinks[i] = toolkit.createHyperlink( subClient, subOCDs[i].toString(), SWT.WRAP );
+                    subLinks[i].setHref( subOCDs[i] );
+                    subLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    subLinks[i].setUnderlined( true );
+                    subLinks[i].setEnabled( true );
+                    subLinks[i].addHyperlinkListener( new HyperlinkAdapter()
+                    {
+                        public void linkActivated( HyperlinkEvent e )
+                        {
+                            SchemaBrowser.select( e.getHref() );
+                        }
+                    } );
+                }
+            }
+            else
+            {
+                subclassesSection.setText( "Subclasses (0)" );
+                subLinks = new Hyperlink[0];
+                Text derivedText = toolkit.createText( subClient, getNonNullString( null ), SWT.NONE );
+                derivedText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                derivedText.setEditable( false );
+            }
+        }
+        else
+        {
+            subclassesSection.setText( "Subclasses" );
+        }
+
+        subclassesSection.layout();
+
+    }
+
+
+    private void createSuperclassContents( ObjectClassDescription ocd )
+    {
+
+        if ( superclassesSection.getClient() != null )
+        {
+            superclassesSection.getClient().dispose();
+        }
+
+        Composite superClient = toolkit.createComposite( superclassesSection, SWT.WRAP );
+        superClient.setLayout( new GridLayout() );
+        superclassesSection.setClient( superClient );
+
+        if ( ocd != null )
+        {
+
+            String[] names = ocd.getSuperiorObjectClassDescriptionNames();
+            if ( names != null && names.length > 0 )
+            {
+                superclassesSection.setText( "Superclasses (" + names.length + ")" );
+                Composite supClient = toolkit.createComposite( superClient, SWT.WRAP );
+                GridLayout gl = new GridLayout();
+                gl.marginWidth = 0;
+                gl.marginHeight = 0;
+                supClient.setLayout( gl );
+                superLinks = new Hyperlink[names.length];
+                for ( int i = 0; i < names.length; i++ )
+                {
+                    if ( ocd.getSchema().hasObjectClassDescription( names[i] ) )
+                    {
+                        ObjectClassDescription supOcd = ocd.getSchema().getObjectClassDescription( names[i] );
+                        superLinks[i] = toolkit.createHyperlink( supClient, supOcd.toString(), SWT.WRAP );
+                        superLinks[i].setHref( supOcd );
+                        superLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        superLinks[i].setUnderlined( true );
+                        superLinks[i].setEnabled( true );
+                        superLinks[i].addHyperlinkListener( new HyperlinkAdapter()
+                        {
+                            public void linkActivated( HyperlinkEvent e )
+                            {
+                                SchemaBrowser.select( e.getHref() );
+                            }
+                        } );
+                    }
+                    else
+                    {
+                        superLinks[i] = toolkit.createHyperlink( supClient, names[i], SWT.WRAP );
+                        superLinks[i].setHref( null );
+                        superLinks[i].setUnderlined( false );
+                        superLinks[i].setEnabled( false );
+                    }
+                }
+            }
+            else
+            {
+                superclassesSection.setText( "Superlasses (0)" );
+                superLinks = new Hyperlink[0];
+                Text superText = toolkit.createText( superClient, getNonNullString( null ), SWT.NONE );
+                superText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                superText.setEditable( false );
+            }
+        }
+        else
+        {
+            superclassesSection.setText( "Superclasses" );
+        }
+
+        superclassesSection.layout();
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,239 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+public class ObjectClassDescriptionPage extends SchemaPage implements ISelectionChangedListener
+{
+
+    private Section section;
+
+    private Text filterText;
+
+    private TableViewer viewer;
+
+
+    public ObjectClassDescriptionPage( SchemaBrowser schemaBrowser )
+    {
+        super( schemaBrowser );
+    }
+
+
+    protected void refresh()
+    {
+        if ( this.schemaBrowser.isShowDefaultSchema() )
+        {
+            this.form.setText( "Object Classes of default schema" );
+            this.viewer.setInput( Schema.DEFAULT_SCHEMA );
+        }
+        else if ( this.selectedConnection != null )
+        {
+            this.form.setText( "Object Classes of connection '" + this.selectedConnection.getName() + "'" );
+            this.viewer.setInput( this.selectedConnection.getSchema() );
+        }
+        else
+        {
+            this.form.setText( "Object Classes" );
+            this.viewer.setInput( null );
+        }
+        this.viewer.refresh();
+    }
+
+
+    protected void createMaster( Composite parent )
+    {
+
+        section = toolkit.createSection( parent, Section.DESCRIPTION );
+        section.marginWidth = 10;
+        section.marginHeight = 12;
+        section.setText( "Object Classes" );
+        section.setDescription( "Please select an object class. Enter a filter to restrict the list." );
+        toolkit.createCompositeSeparator( section );
+
+        Composite client = toolkit.createComposite( section, SWT.WRAP );
+        GridLayout layout = new GridLayout( 2, false );
+        layout.marginWidth = 5;
+        layout.marginHeight = 5;
+        client.setLayout( layout );
+        section.setClient( client );
+
+        toolkit.createLabel( client, "Filter:" );
+        this.filterText = toolkit.createText( client, "", SWT.NONE );
+        this.filterText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        this.filterText.setData( FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER );
+        this.filterText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                viewer.refresh();
+            }
+        } );
+
+        Table t = toolkit.createTable( client, SWT.NONE );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        gd.horizontalSpan = 2;
+        gd.heightHint = 20;
+        gd.widthHint = 100;
+        t.setLayoutData( gd );
+        toolkit.paintBordersFor( client );
+
+        viewer = new TableViewer( t );
+        viewer.setContentProvider( new OCDContentProvider() );
+        viewer.setLabelProvider( new OCDLabelProvider() );
+        viewer.setSorter( new OCDViewerSorter() );
+        viewer.addFilter( new OCDViewerFilter() );
+    }
+
+
+    protected void createDetail( Composite body )
+    {
+        this.detailsPage = new ObjectClassDescriptionDetailsPage( this.schemaBrowser, this.toolkit );
+        this.detailsPage.createContents( this.detailForm );
+        this.viewer.addSelectionChangedListener( this );
+    }
+
+
+    public void selectionChanged( SelectionChangedEvent event )
+    {
+        ISelection selection = event.getSelection();
+        if ( selection.isEmpty() )
+        {
+            EventRegistry.fireObjectClassDescriptionSelected( null, this );
+        }
+        else
+        {
+            Object obj = ( ( StructuredSelection ) selection ).getFirstElement();
+            if ( obj instanceof ObjectClassDescription )
+            {
+                ObjectClassDescription ocd = ( ObjectClassDescription ) obj;
+                EventRegistry.fireObjectClassDescriptionSelected( ocd, this );
+            }
+        }
+    }
+
+
+    public void select( Object obj )
+    {
+        this.viewer.setSelection( new StructuredSelection( obj ), true );
+        if ( this.viewer.getSelection().isEmpty() )
+        {
+            this.filterText.setText( "" );
+            this.viewer.setSelection( new StructuredSelection( obj ), true );
+        }
+    }
+
+    class OCDContentProvider implements IStructuredContentProvider
+    {
+        public Object[] getElements( Object inputElement )
+        {
+            if ( inputElement instanceof Schema )
+            {
+                Schema schema = ( Schema ) inputElement;
+                if ( schema != null )
+                {
+                    return schema.getObjectClassDescriptions();
+                }
+            }
+            return new Object[0];
+        }
+
+
+        public void dispose()
+        {
+        }
+
+
+        public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+        {
+        }
+    }
+
+    class OCDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        public String getColumnText( Object obj, int index )
+        {
+            return obj.toString();
+        }
+
+
+        public Image getColumnImage( Object obj, int index )
+        {
+            return null;
+        }
+    }
+
+    class OCDViewerSorter extends ViewerSorter
+    {
+        public int compare( Viewer viewer, Object e1, Object e2 )
+        {
+            return e1.toString().compareTo( e2.toString() );
+        }
+    }
+
+    class OCDViewerFilter extends ViewerFilter
+    {
+        public boolean select( Viewer viewer, Object parentElement, Object element )
+        {
+            if ( element instanceof ObjectClassDescription )
+            {
+                ObjectClassDescription ocd = ( ObjectClassDescription ) element;
+                boolean matched = false;
+
+                if ( !matched )
+                    matched = ocd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+                if ( !matched )
+                    matched = ocd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+
+                return matched;
+            }
+            return false;
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ReloadSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ReloadSchemaAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ReloadSchemaAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ReloadSchemaAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,72 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.jobs.ReloadSchemasJob;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.jface.action.Action;
+
+
+public class ReloadSchemaAction extends Action
+{
+
+    private SchemaBrowser schemaBrowser;
+
+
+    public ReloadSchemaAction( SchemaBrowser schemaBrowserView )
+    {
+        super( "Reload Schema" );
+        super.setToolTipText( "Reload Schema" );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_REFRESH ) );
+        super.setEnabled( true );
+
+        this.schemaBrowser = schemaBrowserView;
+    }
+
+
+    public void run()
+    {
+        final IConnection connection = schemaBrowser.getSelectedConnection();
+        if ( connection != null )
+        {
+            new ReloadSchemasJob( new IConnection[]
+                { connection } ).execute();
+            this.schemaBrowser.refresh();
+        }
+    }
+
+
+    public void dispose()
+    {
+        this.schemaBrowser = null;
+    }
+
+
+    public void updateEnabledState()
+    {
+        this.setEnabled( schemaBrowser.getSelectedConnection() != null && !schemaBrowser.isShowDefaultSchema() );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowser.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowser.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowser.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,295 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleUseDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.EditorPart;
+
+
+public class SchemaBrowser extends EditorPart
+{
+
+    private CTabFolder tabFolder;
+
+    private CTabItem ocdTab;
+
+    private ObjectClassDescriptionPage ocdPage;
+
+    private CTabItem atdTab;
+
+    private AttributeTypeDescriptionPage atdPage;
+
+    private CTabItem mrdTab;
+
+    private MatchingRuleDescriptionPage mrdPage;
+
+    private CTabItem mrudTab;
+
+    private MatchingRuleUseDescriptionPage mrudPage;
+
+    private CTabItem lsdTab;
+
+    private LdapSyntaxDescriptionPage lsdPage;
+
+    private HistoryManager historyManager;
+
+    private BackAction backAction;
+
+    private ForwardAction forwardAction;
+
+    private ShowDefaultSchemaAction showDefaultSchemaAction;
+
+    private ReloadSchemaAction reloadSchemaAction;
+
+
+    public static String getId()
+    {
+        return SchemaBrowser.class.getName();
+    }
+
+
+    public void init( IEditorSite site, IEditorInput input ) throws PartInitException
+    {
+        setInput( SchemaBrowserInput.getInstance() );
+        super.setSite( site );
+    }
+
+
+    public void dispose()
+    {
+        this.reloadSchemaAction.dispose();
+        this.showDefaultSchemaAction.dispose();
+        this.ocdPage.dispose();
+        this.atdPage.dispose();
+        this.mrdPage.dispose();
+        this.mrudPage.dispose();
+        this.lsdPage.dispose();
+        this.tabFolder.dispose();
+        super.dispose();
+    }
+
+
+    public void createPartControl( Composite parent )
+    {
+
+        this.historyManager = new HistoryManager( this );
+        this.backAction = new BackAction( this.historyManager );
+        this.forwardAction = new ForwardAction( this.historyManager );
+        this.showDefaultSchemaAction = new ShowDefaultSchemaAction( this );
+        this.reloadSchemaAction = new ReloadSchemaAction( this );
+
+        this.tabFolder = new CTabFolder( parent, SWT.BOTTOM );
+
+        this.ocdTab = new CTabItem( this.tabFolder, SWT.NONE );
+        this.ocdTab.setText( "Object Classes" );
+        this.ocdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD ) );
+        this.ocdPage = new ObjectClassDescriptionPage( this );
+        Control ocdPageControl = this.ocdPage.createControl( this.tabFolder );
+        this.ocdTab.setControl( ocdPageControl );
+
+        this.atdTab = new CTabItem( this.tabFolder, SWT.NONE );
+        this.atdTab.setText( "Attribute Types" );
+        this.atdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ATD ) );
+        this.atdPage = new AttributeTypeDescriptionPage( this );
+        Control atdPageControl = this.atdPage.createControl( this.tabFolder );
+        this.atdTab.setControl( atdPageControl );
+
+        this.mrdTab = new CTabItem( this.tabFolder, SWT.NONE );
+        this.mrdTab.setText( "Matching Rules" );
+        this.mrdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_MRD ) );
+        this.mrdPage = new MatchingRuleDescriptionPage( this );
+        Control mrdPageControl = this.mrdPage.createControl( this.tabFolder );
+        this.mrdTab.setControl( mrdPageControl );
+
+        this.mrudTab = new CTabItem( this.tabFolder, SWT.NONE );
+        this.mrudTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_MRUD ) );
+        this.mrudTab.setText( "Matching Rule Use" );
+        this.mrudPage = new MatchingRuleUseDescriptionPage( this );
+        Control mrudPageControl = this.mrudPage.createControl( this.tabFolder );
+        this.mrudTab.setControl( mrudPageControl );
+
+        this.lsdTab = new CTabItem( this.tabFolder, SWT.NONE );
+        this.lsdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_LSD ) );
+        this.lsdTab.setText( "Syntaxes" );
+        this.lsdPage = new LdapSyntaxDescriptionPage( this );
+        Control lsdPageControl = this.lsdPage.createControl( this.tabFolder );
+        this.lsdTab.setControl( lsdPageControl );
+
+        this.tabFolder.setSelection( this.ocdTab );
+
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( parent,
+            BrowserUIPlugin.PLUGIN_ID + "." + "tools_schema_browser" );
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( tabFolder,
+            BrowserUIPlugin.PLUGIN_ID + "." + "tools_schema_browser" );
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( ocdPageControl,
+            BrowserUIPlugin.PLUGIN_ID + "." + "tools_schema_browser" );
+
+    }
+
+
+    public static void select( Object obj )
+    {
+
+        String targetId = SchemaBrowser.getId();
+        IEditorPart target = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditor(
+            SchemaBrowserInput.getInstance() );
+        if ( target == null )
+        {
+            try
+            {
+                target = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+                    SchemaBrowserInput.getInstance(), targetId, true );
+            }
+            catch ( PartInitException e )
+            {
+            }
+        }
+        if ( target != null && target instanceof SchemaBrowser )
+        {
+            // target.getSite().getPage().activate(target);
+            target.getSite().getPage().bringToTop( target );
+
+            SchemaBrowser schemaBrowser = ( ( SchemaBrowser ) target );
+            if ( obj instanceof ObjectClassDescription )
+            {
+                schemaBrowser.ocdPage.select( obj );
+                schemaBrowser.tabFolder.setSelection( schemaBrowser.ocdTab );
+            }
+            else if ( obj instanceof AttributeTypeDescription )
+            {
+                schemaBrowser.atdPage.select( obj );
+                schemaBrowser.tabFolder.setSelection( schemaBrowser.atdTab );
+            }
+            else if ( obj instanceof MatchingRuleDescription )
+            {
+                schemaBrowser.mrdPage.select( obj );
+                schemaBrowser.tabFolder.setSelection( schemaBrowser.mrdTab );
+            }
+            else if ( obj instanceof MatchingRuleUseDescription )
+            {
+                schemaBrowser.mrudPage.select( obj );
+                schemaBrowser.tabFolder.setSelection( schemaBrowser.mrudTab );
+            }
+            else if ( obj instanceof LdapSyntaxDescription )
+            {
+                schemaBrowser.lsdPage.select( obj );
+                schemaBrowser.tabFolder.setSelection( schemaBrowser.lsdTab );
+            }
+        }
+
+    }
+
+
+    public BackAction getBackAction()
+    {
+        return this.backAction;
+    }
+
+
+    public ForwardAction getForwardAction()
+    {
+        return this.forwardAction;
+    }
+
+
+    public ReloadSchemaAction getReloadSchemaAction()
+    {
+        return reloadSchemaAction;
+    }
+
+
+    public ShowDefaultSchemaAction getShowDefaultSchemaAction()
+    {
+        return showDefaultSchemaAction;
+    }
+
+
+    public void refresh()
+    {
+        this.ocdPage.refresh();
+        this.atdPage.refresh();
+        this.mrdPage.refresh();
+        this.mrudPage.refresh();
+        this.lsdPage.refresh();
+
+        this.reloadSchemaAction.updateEnabledState();
+    }
+
+
+    public boolean isShowDefaultSchema()
+    {
+        return this.showDefaultSchemaAction.isChecked();
+    }
+
+
+    public IConnection getSelectedConnection()
+    {
+        return this.ocdPage.getSelectedConnection();
+    }
+
+
+    public void setFocus()
+    {
+    }
+
+
+    public void doSave( IProgressMonitor monitor )
+    {
+    }
+
+
+    public void doSaveAs()
+    {
+    }
+
+
+    public boolean isDirty()
+    {
+        return false;
+    }
+
+
+    public boolean isSaveAsAllowed()
+    {
+        return false;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserInput.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserInput.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserInput.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaBrowserInput.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,78 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+
+public class SchemaBrowserInput implements IEditorInput
+{
+
+    private static final SchemaBrowserInput instance = new SchemaBrowserInput();
+
+
+    public static SchemaBrowserInput getInstance()
+    {
+        return instance;
+    }
+
+
+    public boolean exists()
+    {
+        return false;
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BROWSER_SCHEMABROWSEREDITOR );
+    }
+
+
+    public String getName()
+    {
+        return "Schema Browser";
+    }
+
+
+    public IPersistableElement getPersistable()
+    {
+        return null;
+    }
+
+
+    public String getToolTipText()
+    {
+        return "Schema Browser";
+    }
+
+
+    public Object getAdapter( Class adapter )
+    {
+        return null;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaDetailsPage.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaDetailsPage.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaDetailsPage.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,153 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.events.SchemaElementSelectionListener;
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleUseDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.SchemaPart;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+public abstract class SchemaDetailsPage implements SchemaElementSelectionListener
+{
+
+    protected Section rawSection;
+
+    protected Text rawText;
+
+    protected FormToolkit toolkit;
+
+    protected SchemaBrowser schemaBrowser;
+
+    protected ScrolledForm detailForm;
+
+
+    protected SchemaDetailsPage( SchemaBrowser schemaBrowser, FormToolkit toolkit )
+    {
+        this.schemaBrowser = schemaBrowser;
+        this.toolkit = toolkit;
+        EventRegistry.addSchemaElementSelectionListener( this );
+    }
+
+
+    public void dispose()
+    {
+        EventRegistry.removeSchemaElementSelectionListener( this );
+    }
+
+
+    public void attributeTypeDescriptionSelected( AttributeTypeDescription atd )
+    {
+    }
+
+
+    public void objectClassDescriptionSelected( ObjectClassDescription ocd )
+    {
+    }
+
+
+    public void matchingRuleDescriptionSelected( MatchingRuleDescription mrd )
+    {
+    }
+
+
+    public void ldapSyntacDescriptionSelected( LdapSyntaxDescription lsd )
+    {
+    }
+
+
+    public void matchingRuleUseDescriptionSelected( MatchingRuleUseDescription mrud )
+    {
+    }
+
+
+    public abstract void createContents( final ScrolledForm detailForm );
+
+
+    public void createRawSection()
+    {
+        rawSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        rawSection.setText( "Raw Schema Definition" );
+        rawSection.marginWidth = 0;
+        rawSection.marginHeight = 0;
+        rawSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( rawSection );
+        rawSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+    }
+
+
+    public void createRawContents( SchemaPart schemaPart )
+    {
+
+        if ( rawSection.getClient() != null && !rawSection.getClient().isDisposed() )
+        {
+            rawSection.getClient().dispose();
+        }
+
+        Composite client = toolkit.createComposite( rawSection, SWT.WRAP );
+        client.setLayout( new GridLayout() );
+        rawSection.setClient( client );
+
+        if ( schemaPart != null )
+        {
+            rawText = toolkit.createText( client, getNonNullString( schemaPart.getLine().getValueAsString() ), SWT.WRAP
+                | SWT.MULTI );
+            GridData gd2 = new GridData( GridData.FILL_HORIZONTAL );
+            gd2.widthHint = detailForm.getForm().getSize().x - 100 - 60;
+            // detailForm.getForm().getVerticalBar().getSize().x
+            // gd2.widthHint = 10;
+            rawText.setLayoutData( gd2 );
+            rawText.setEditable( false );
+        }
+
+        rawSection.layout();
+
+    }
+
+
+    protected String getNonNullString( String s )
+    {
+        return s == null ? "-" : s;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaPage.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaPage.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/SchemaPage.java Mon Dec 18 09:52:58 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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.ui.actions.SelectionUtils;
+import org.apache.directory.ldapstudio.browser.ui.views.connection.ConnectionView;
+
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+
+public abstract class SchemaPage implements ISelectionListener, ConnectionUpdateListener
+{
+
+    protected IConnection selectedConnection;
+
+    protected SchemaBrowser schemaBrowser;
+
+    protected FormToolkit toolkit;
+
+    protected Form form;
+
+    protected SashForm sashForm;
+
+    protected ScrolledForm masterForm;
+
+    protected ScrolledForm detailForm;
+
+    protected SchemaDetailsPage detailsPage;
+
+
+    public SchemaPage( SchemaBrowser schemaBrowser )
+    {
+        this.schemaBrowser = schemaBrowser;
+
+        this.selectedConnection = null;
+        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addSelectionListener( this );
+        EventRegistry.addConnectionUpdateListener( this );
+    }
+
+
+    protected abstract void refresh();
+
+
+    protected abstract void createMaster( Composite body );
+
+
+    protected abstract void createDetail( Composite body );
+
+
+    public void selectionChanged( IWorkbenchPart part, ISelection selection )
+    {
+        if ( part.getClass() == ConnectionView.class )
+        {
+            IConnection[] connections = SelectionUtils.getConnections( selection );
+            if ( connections.length == 1 )
+                this.connectionSelected( connections[0] );
+            else
+                this.connectionSelected( null );
+        }
+    }
+
+
+    void connectionSelected( IConnection connection )
+    {
+        this.selectedConnection = connection;
+        if ( this.toolkit != null && this.form != null && !this.form.isDisposed() )
+        {
+            this.refresh();
+        }
+    }
+
+
+    public final void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
+    {
+        if ( this.toolkit != null && this.form != null && !this.form.isDisposed() )
+        {
+            this.refresh();
+        }
+    }
+
+
+    public void dispose()
+    {
+        if ( this.selectedConnection != null )
+        {
+            this.selectedConnection = null;
+        }
+        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removeSelectionListener( this );
+        EventRegistry.removeConnectionUpdateListener( this );
+
+        this.detailsPage.dispose();
+
+        this.schemaBrowser = null;
+        this.toolkit.dispose();
+        this.toolkit = null;
+
+    }
+
+
+    public Control createControl( Composite parent )
+    {
+
+        this.toolkit = new FormToolkit( parent.getDisplay() );
+        this.form = this.toolkit.createForm( parent );
+        this.form.getBody().setLayout( new FillLayout() );
+
+        this.sashForm = new SashForm( this.form.getBody(), SWT.HORIZONTAL );
+        this.sashForm.setLayout( new FillLayout() );
+
+        this.masterForm = this.toolkit.createScrolledForm( this.sashForm );
+        // this.detailForm = this.toolkit.createScrolledForm(this.sashForm);
+        this.detailForm = new ScrolledForm( this.sashForm, SWT.V_SCROLL | this.toolkit.getOrientation() );
+        this.detailForm.setExpandHorizontal( true );
+        this.detailForm.setExpandVertical( true );
+        this.detailForm.setBackground( this.toolkit.getColors().getBackground() );
+        this.detailForm.setForeground( this.toolkit.getColors().getColor( FormColors.TITLE ) );
+        this.detailForm.setFont( JFaceResources.getHeaderFont() );
+        this.sashForm.setWeights( new int[]
+            { 50, 50 } );
+
+        this.masterForm.getBody().setLayout( new FillLayout() );
+        this.createMaster( this.masterForm.getBody() );
+
+        this.detailForm.getBody().setLayout( new FillLayout() );
+        this.createDetail( this.detailForm.getBody() );
+
+        this.form.getToolBarManager().add( schemaBrowser.getShowDefaultSchemaAction() );
+        this.form.getToolBarManager().add( new Separator() );
+        this.form.getToolBarManager().add( schemaBrowser.getReloadSchemaAction() );
+        this.form.getToolBarManager().add( new Separator() );
+        this.form.getToolBarManager().add( schemaBrowser.getBackAction() );
+        this.form.getToolBarManager().add( schemaBrowser.getForwardAction() );
+        this.form.updateToolBar();
+
+        if ( schemaBrowser.getEditorSite().getPage().getSelection() != null
+            && !schemaBrowser.getEditorSite().getPage().getSelection().isEmpty()
+            && schemaBrowser.getEditorSite().getPage().getSelection() instanceof IStructuredSelection )
+        {
+
+            IConnection[] connections = SelectionUtils.getConnections( ( IStructuredSelection ) schemaBrowser
+                .getEditorSite().getPage().getSelection() );
+            IEntry[] entries = SelectionUtils.getEntries( ( IStructuredSelection ) schemaBrowser.getEditorSite()
+                .getPage().getSelection() );
+            IAttribute[] attributes = SelectionUtils.getAttributes( ( IStructuredSelection ) schemaBrowser
+                .getEditorSite().getPage().getSelection() );
+            IValue[] values = SelectionUtils.getValues( ( IStructuredSelection ) schemaBrowser.getEditorSite()
+                .getPage().getSelection() );
+            if ( connections != null && connections.length == 1 )
+            {
+                this.selectedConnection = connections[0];
+            }
+            else if ( entries != null && entries.length == 1 )
+            {
+                this.selectedConnection = entries[0].getConnection();
+            }
+            else if ( attributes != null && attributes.length == 1 )
+            {
+                this.selectedConnection = attributes[0].getEntry().getConnection();
+            }
+            else if ( values != null && values.length == 1 )
+            {
+                this.selectedConnection = values[0].getAttribute().getEntry().getConnection();
+            }
+
+            // Object obj =
+            // ((IStructuredSelection)schemaBrowser.getEditorSite().getPage().getSelection()).getFirstElement();
+            // if (obj instanceof IConnection) {
+            // this.selectedConnection = (IConnection) obj;
+            // }
+        }
+        this.refresh();
+
+        return this.form;
+    }
+
+
+    public IConnection getSelectedConnection()
+    {
+        return selectedConnection;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ShowDefaultSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ShowDefaultSchemaAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ShowDefaultSchemaAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/schemabrowser/ShowDefaultSchemaAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,58 @@
+/*
+ *  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.ui.editors.schemabrowser;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.eclipse.jface.action.Action;
+
+
+public class ShowDefaultSchemaAction extends Action
+{
+
+    private SchemaBrowser schemaBrowser;
+
+
+    public ShowDefaultSchemaAction( SchemaBrowser schemaBrowserView )
+    {
+        super( "Show Default Schema", Action.AS_CHECK_BOX );
+        super.setToolTipText( "Show Default Schema" );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
+            BrowserUIConstants.IMG_DEFAULT_SCHEMA ) );
+        super.setEnabled( true );
+
+        this.schemaBrowser = schemaBrowserView;
+    }
+
+
+    public void run()
+    {
+        this.schemaBrowser.refresh();
+    }
+
+
+    public void dispose()
+    {
+        this.schemaBrowser = null;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractOpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractOpenEditorAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractOpenEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractOpenEditorAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,221 @@
+/*
+ *  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.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.TableItem;
+
+
+public abstract class AbstractOpenEditorAction extends AbstractSearchResultListenerAction implements FocusListener,
+    KeyListener, ModelModifier
+{
+
+    protected SearchResultEditorActionGroup actionGroup;
+
+    protected ValueProviderManager valueProviderManager;
+
+    protected TableViewer viewer;
+
+    protected SearchResultEditorCursor cursor;
+
+    protected CellEditor cellEditor;
+
+    private boolean isActive;
+
+
+    protected AbstractOpenEditorAction( TableViewer viewer, SearchResultEditorCursor cursor,
+        SearchResultEditorActionGroup actionGroup, ValueProviderManager valueProviderManager )
+    {
+        super( cursor, "Editor", null, null );
+        this.actionGroup = actionGroup;
+        this.viewer = viewer;
+        this.cursor = cursor;
+        this.valueProviderManager = valueProviderManager;
+        this.isActive = false;
+    }
+
+
+    public CellEditor getCellEditor()
+    {
+        return this.cellEditor;
+    }
+
+
+    public void run()
+    {
+        this.activateEditor();
+    }
+
+
+    private void activateEditor()
+    {
+
+        Object element = cursor.getRow().getData();
+        String property = ( String ) this.viewer.getColumnProperties()[cursor.getColumn()];
+
+        if ( !this.viewer.isCellEditorActive() && viewer.getCellModifier().canModify( element, property ) )
+        {
+
+            // check if attribute exists
+            /*
+             * if(element instanceof ISearchResult) { ISearchResult result =
+             * (ISearchResult)element; IAttribute attribute =
+             * result.getAttribute(property); if(attribute == null) {
+             * EventRegistry.suspendEventFireingInCurrentThread(); try {
+             * attribute = result.getEntry().createAttribute(property,
+             * this); System.out.println("activateEditor(): created
+             * attribute " + attribute); } catch (ModelModificationException
+             * e) { } EventRegistry.resumeEventFireingInCurrentThread(); } }
+             */
+
+            // set cell editor to viewer
+            for ( int i = 0; i < this.viewer.getCellEditors().length; i++ )
+            {
+                this.viewer.getCellEditors()[i] = this.cellEditor;
+            }
+
+            // add listener for end of editing
+            if ( this.cellEditor.getControl() != null )
+            {
+                this.cellEditor.getControl().addFocusListener( this );
+                this.cellEditor.getControl().addKeyListener( this );
+            }
+
+            // deactivate cursor
+            this.cursor.setVisible( false );
+
+            // deactivate global actions
+            this.actionGroup.deactivateGlobalActionHandlers();
+
+            // start editing
+            this.isActive = true;
+            this.viewer.editElement( element, cursor.getColumn() );
+
+            viewer.setSelection( null, true );
+            viewer.getTable().setSelection( new TableItem[0] );
+
+            if ( !this.viewer.isCellEditorActive() )
+            {
+                this.editorClosed();
+            }
+        }
+        else
+        {
+            this.valueProviderManager.setUserSelectedValueProvider( null );
+        }
+    }
+
+
+    private void editorClosed()
+    {
+
+        // check empty attribute
+        /*
+         * Object element = cursor.getRow().getData(); String property =
+         * (String)this.viewer.getColumnProperties()[cursor.getColumn()];
+         * if(element instanceof ISearchResult) { ISearchResult result =
+         * (ISearchResult)element; IAttribute attribute =
+         * result.getAttribute(property); if(attribute != null &&
+         * attribute.getValueSize() == 0) {
+         * EventRegistry.suspendEventFireingInCurrentThread(); try {
+         * result.getEntry().deleteAttribute(attribute, this);
+         * System.out.println("activateEditor(): deleted attribute " +
+         * attribute); } catch (ModelModificationException e) { }
+         * EventRegistry.resumeEventFireingInCurrentThread(); } }
+         */
+
+        // clear active flag
+        this.isActive = false;
+
+        // remove cell editors from viewer to prevend auto-editing
+        for ( int i = 0; i < this.viewer.getCellEditors().length; i++ )
+        {
+            this.viewer.getCellEditors()[i] = null;
+        }
+
+        // remove listener
+        if ( this.cellEditor.getControl() != null )
+        {
+            this.cellEditor.getControl().removeFocusListener( this );
+            this.cellEditor.getControl().removeKeyListener( this );
+        }
+
+        // activate global actions
+        this.actionGroup.activateGlobalActionHandlers();
+
+        this.valueProviderManager.setUserSelectedValueProvider( null );
+
+        // activate cursor
+        cursor.setVisible( true );
+        viewer.refresh();
+        cursor.redraw();
+        cursor.getDisplay().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                cursor.setFocus();
+            }
+        } );
+
+    }
+
+
+    public void focusGained( FocusEvent e )
+    {
+    }
+
+
+    public void focusLost( FocusEvent e )
+    {
+        this.editorClosed();
+    }
+
+
+    public void keyPressed( KeyEvent e )
+    {
+        if ( e.character == SWT.ESC && e.stateMask == SWT.NONE )
+        {
+            e.doit = false;
+        }
+    }
+
+
+    public void keyReleased( KeyEvent e )
+    {
+    }
+
+
+    public boolean isActive()
+    {
+        return isActive;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/AbstractSearchResultListenerAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,152 @@
+/*
+ *  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.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierachie;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.ui.actions.SelectionUtils;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+
+public abstract class AbstractSearchResultListenerAction extends Action implements ISelectionChangedListener,
+    EntryUpdateListener
+{
+
+    protected ISelectionProvider selectionProvider;
+
+    protected ISearch selectedSearch;
+
+    protected ISearchResult selectedSearchResult;
+
+    protected AttributeHierachie selectedAttributeHierarchie;
+
+    protected String selectedProperty;
+
+
+    AbstractSearchResultListenerAction( ISelectionProvider selectionProvider, String title, ImageDescriptor image,
+        String command, int style )
+    {
+        super( title, style );
+        super.setText( title );
+        super.setToolTipText( title );
+        super.setImageDescriptor( image );
+        super.setActionDefinitionId( command );
+        super.setEnabled( false );
+
+        this.selectionProvider = selectionProvider;
+
+        this.init();
+    }
+
+
+    AbstractSearchResultListenerAction( ISelectionProvider selectionProvider, String title, ImageDescriptor image,
+        String command )
+    {
+        this( selectionProvider, title, image, command, Action.AS_PUSH_BUTTON );
+    }
+
+
+    private void init()
+    {
+        this.selectionProvider.addSelectionChangedListener( this );
+        EventRegistry.addEntryUpdateListener( this );
+
+        this.selectedSearch = null;
+        this.selectedSearchResult = null;
+        this.selectedAttributeHierarchie = null;
+        this.selectedProperty = null;
+    }
+
+
+    public void selectionChanged( SelectionChangedEvent event )
+    {
+
+        ISelection selection = event.getSelection();
+
+        ISearchResult[] searchResults = SelectionUtils.getSearchResults( selection );
+        AttributeHierachie[] ah = SelectionUtils.getAttributeHierarchie( selection );
+        String[] selectedProperties = SelectionUtils.getProperties( selection );
+
+        if ( searchResults.length == 1 )
+        {
+            this.selectedSearchResult = searchResults[0];
+            this.selectedSearch = this.selectedSearchResult.getSearch();
+        }
+        else
+        {
+            this.selectedSearchResult = null;
+            this.selectedSearch = null;
+        }
+
+        if ( ah.length == 1 )
+        {
+            this.selectedAttributeHierarchie = ah[0];
+        }
+        else
+        {
+            this.selectedAttributeHierarchie = null;
+        }
+
+        if ( selectedProperties.length == 1 )
+        {
+            this.selectedProperty = selectedProperties[0];
+        }
+        else
+        {
+            this.selectedProperty = null;
+        }
+
+        this.updateEnabledState();
+    }
+
+
+    public final void entryUpdated( EntryModificationEvent event )
+    {
+        this.updateEnabledState();
+    }
+
+
+    protected abstract void updateEnabledState();
+
+
+    public void dispose()
+    {
+        EventRegistry.removeEntryUpdateListener( this );
+        this.selectionProvider.removeSelectionChangedListener( this );
+
+        this.selectedSearchResult = null;
+        this.selectedAttributeHierarchie = null;
+        this.selectedSearch = null;
+        this.selectedProperty = null;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenBestEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenBestEditorAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenBestEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenBestEditorAction.java Mon Dec 18 09:52:58 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.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProvider;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+import org.eclipse.jface.viewers.TableViewer;
+
+
+public class OpenBestEditorAction extends AbstractOpenEditorAction
+{
+
+    private ValueProvider valueProvider;
+
+
+    public OpenBestEditorAction( TableViewer viewer, SearchResultEditorCursor cursor,
+        SearchResultEditorActionGroup actionGroup, ValueProviderManager valueProviderManager )
+    {
+        super( viewer, cursor, actionGroup, valueProviderManager );
+    }
+
+
+    public ValueProvider getBestValueProvider()
+    {
+        return this.valueProvider;
+    }
+
+
+    protected void updateEnabledState()
+    {
+
+        if ( viewer.getCellModifier().canModify( this.selectedSearchResult, this.selectedProperty ) )
+        {
+
+            if ( this.selectedAttributeHierarchie == null )
+            {
+                this.valueProvider = this.valueProviderManager.getCurrentValueProvider( this.selectedSearchResult
+                    .getEntry(), this.selectedProperty );
+            }
+            else
+            {
+                this.valueProvider = this.valueProviderManager
+                    .getCurrentValueProvider( this.selectedAttributeHierarchie );
+            }
+
+            super.cellEditor = this.valueProvider.getCellEditor();
+            this.setEnabled( true );
+            this.setText( "" + this.valueProvider.getCellEditorName() );
+            this.setToolTipText( "" + this.valueProvider.getCellEditorName() );
+            this.setImageDescriptor( this.valueProvider.getCellEditorImageDescriptor() );
+
+        }
+        else
+        {
+            this.setEnabled( false );
+            this.cellEditor = null;
+            this.setText( "Best Editor" );
+            this.setToolTipText( "Best Editor" );
+            this.setImageDescriptor( null );
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenDefaultEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenDefaultEditorAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenDefaultEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenDefaultEditorAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,69 @@
+/*
+ *  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.ui.editors.searchresult;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+
+
+public class OpenDefaultEditorAction extends AbstractSearchResultListenerAction
+{
+
+    private OpenBestEditorAction proxy;
+
+
+    public OpenDefaultEditorAction( OpenBestEditorAction proxy )
+    {
+        super( proxy.selectionProvider, "Edit Value", null, BrowserUIConstants.ACTION_ID_EDIT_VALUE );
+
+        this.proxy = proxy;
+    }
+
+
+    public void run()
+    {
+        this.proxy.run();
+    }
+
+
+    protected void updateEnabledState()
+    {
+        this.proxy.updateEnabledState();
+        this.setEnabled( this.proxy.isEnabled() );
+
+        this.setImageDescriptor( this.proxy.getImageDescriptor() );
+    }
+
+
+    public void dispose()
+    {
+        this.proxy = null;
+
+        super.dispose();
+    }
+
+
+    public boolean isActive()
+    {
+        return this.proxy.isActive();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenEditorAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenEditorAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/OpenEditorAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,88 @@
+/*
+ *  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.ui.editors.searchresult;
+
+
+import java.util.Arrays;
+
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProvider;
+import org.apache.directory.ldapstudio.browser.ui.valueproviders.ValueProviderManager;
+import org.eclipse.jface.viewers.TableViewer;
+
+
+public class OpenEditorAction extends AbstractOpenEditorAction
+{
+
+    private ValueProvider valueProvider;
+
+
+    public OpenEditorAction( TableViewer viewer, SearchResultEditorCursor cursor,
+        SearchResultEditorActionGroup actionGroup, ValueProviderManager valueProviderManager,
+        ValueProvider valueProvider )
+    {
+        super( viewer, cursor, actionGroup, valueProviderManager );
+        super.cellEditor = valueProvider.getCellEditor();
+        this.valueProvider = valueProvider;
+        this.setText( "" + this.valueProvider.getCellEditorName() );
+        this.setToolTipText( "" + this.valueProvider.getCellEditorName() );
+        this.setImageDescriptor( this.valueProvider.getCellEditorImageDescriptor() );
+    }
+
+
+    public ValueProvider getValueProvider()
+    {
+        return this.valueProvider;
+    }
+
+
+    protected void updateEnabledState()
+    {
+
+        if ( viewer.getCellModifier().canModify( this.selectedSearchResult, this.selectedProperty ) )
+        {
+
+            ValueProvider[] alternativeVps;
+            if ( this.selectedAttributeHierarchie == null )
+            {
+                this.setEnabled( false );
+            }
+            else
+            {
+                alternativeVps = this.valueProviderManager
+                    .getAlternativeValueProvider( this.selectedAttributeHierarchie );
+                this.setEnabled( Arrays.asList( alternativeVps ).contains( this.valueProvider )
+                    && this.valueProvider.getRawValue( this.selectedAttributeHierarchie ) != null );
+            }
+        }
+        else
+        {
+            this.setEnabled( false );
+        }
+    }
+
+
+    public void run()
+    {
+        this.valueProviderManager.setUserSelectedValueProvider( this.valueProvider );
+        super.run();
+    }
+
+}