directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592087 [7/16] - in /directory/sandbox/felixk/studio-ldapbrowser-ui: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/...
Date Mon, 05 Nov 2007 17:01:46 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,325 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+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.Label;
+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.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * The MatchingRuleDescriptionDetailsPage displays the details of an
+ * matching rule description.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MatchingRuleDescriptionDetailsPage extends SchemaDetailsPage
+{
+
+    /** The main section, contains oid, names and desc */
+    private Section mainSection;
+
+    /** The numeric oid field */
+    private Text numericOidText;
+
+    /** The names field */
+    private Text namesText;
+
+    /** The description field */
+    private Text descText;
+
+    /** The flag section, contains obsolete */
+    private Section flagSection;
+
+    /** The obsolete field */
+    private Label isObsoleteText;
+
+    /** The syntax section, contains syntax description and a link to the syntax */
+    private Section syntaxSection;
+
+    /** The syntax description field */
+    private Text syntaxDescText;
+
+    /** The link to the syntax */
+    private Hyperlink syntaxLink;
+
+    /** The used from section, contains links to attribute types */
+    private Section usedFromSection;
+
+    /** The links to attribute types using the matching rule */
+    private Hyperlink[] usedFromLinks;
+
+
+    /**
+     * Creates a new instance of MatchingRuleDescriptionDetailsPage.
+     *
+     * @param schemaPage the master schema page
+     * @param toolkit the toolkit used to create controls
+     */
+    public MatchingRuleDescriptionDetailsPage( SchemaPage scheamPage, FormToolkit toolkit )
+    {
+        super( scheamPage, toolkit );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createContents( final ScrolledForm detailForm )
+    {
+        this.detailForm = detailForm;
+        detailForm.getBody().setLayout( new GridLayout() );
+
+        // create main section
+        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 );
+
+        // create flag section
+        flagSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
+        flagSection.setText( "Flags" );
+        flagSection.marginWidth = 0;
+        flagSection.marginHeight = 0;
+        flagSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( flagSection );
+
+        // create flag content
+        Composite flagClient = toolkit.createComposite( flagSection, SWT.WRAP );
+        GridLayout flagLayout = new GridLayout();
+        flagLayout.numColumns = 1;
+        flagLayout.marginWidth = 0;
+        flagLayout.marginHeight = 0;
+        flagClient.setLayout( flagLayout );
+        flagSection.setClient( flagClient );
+
+        isObsoleteText = toolkit.createLabel( flagClient, "Obsolete", SWT.CHECK );
+        isObsoleteText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        isObsoleteText.setEnabled( false );
+
+        // create syntax section
+        syntaxSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
+        syntaxSection.setText( "Syntax" );
+        syntaxSection.marginWidth = 0;
+        syntaxSection.marginHeight = 0;
+        syntaxSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( syntaxSection );
+
+        // create syntax content
+        Composite syntaxClient = toolkit.createComposite( syntaxSection, SWT.WRAP );
+        GridLayout syntaxLayout = new GridLayout();
+        syntaxLayout.numColumns = 2;
+        syntaxLayout.marginWidth = 0;
+        syntaxLayout.marginHeight = 0;
+        syntaxClient.setLayout( syntaxLayout );
+        syntaxSection.setClient( syntaxClient );
+
+        toolkit.createLabel( syntaxClient, "Syntax OID:", SWT.NONE );
+        syntaxLink = toolkit.createHyperlink( syntaxClient, "", SWT.WRAP );
+        syntaxLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        syntaxLink.addHyperlinkListener( this );
+
+        toolkit.createLabel( syntaxClient, "Syntax Description:", SWT.NONE );
+        syntaxDescText = toolkit.createText( syntaxClient, "", SWT.NONE );
+        syntaxDescText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        syntaxDescText.setEditable( false );
+
+        // create used from section
+        usedFromSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        usedFromSection.setText( "Used from" );
+        usedFromSection.marginWidth = 0;
+        usedFromSection.marginHeight = 0;
+        usedFromSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( usedFromSection );
+        usedFromSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        // create raw section
+        createRawSection();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( Object input )
+    {
+        MatchingRuleDescription mrd = null;
+        if ( input instanceof MatchingRuleDescription )
+        {
+            mrd = ( MatchingRuleDescription ) input;
+        }
+
+        // create main content
+        createMainContent( mrd );
+
+        // set flag
+        isObsoleteText.setEnabled( mrd != null && mrd.isObsolete() );
+
+        // set syntax content
+        String lsdOid = null;
+        LdapSyntaxDescription lsd = null;
+        if ( mrd != null )
+        {
+            lsdOid = mrd.getSyntaxDescriptionNumericOID();
+            if ( lsdOid != null && mrd.getSchema().hasLdapSyntaxDescription( lsdOid ) )
+            {
+                lsd = mrd.getSchema().getLdapSyntaxDescription( lsdOid );
+            }
+        }
+        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOID() : lsdOid ) );
+        syntaxLink.setHref( lsd );
+        syntaxLink.setUnderlined( lsd != null );
+        syntaxLink.setEnabled( lsd != null );
+        syntaxDescText.setText( getNonNullString( lsd != null ? lsd.getDesc() : null ) );
+        syntaxSection.layout();
+
+        // create contents of dynamic sections
+        createUsedFromContents( mrd );
+        createRawContents( mrd );
+
+        detailForm.reflow( true );
+    }
+
+
+    /**
+     * Creates the content of the main section. It is newly created
+     * on every input change to ensure a proper layout of 
+     * multilined descriptions. 
+     *
+     * @param mrd the matching rule description
+     */
+    private void createMainContent( MatchingRuleDescription mrd )
+    {
+        // dispose old content
+        if ( mainSection.getClient() != null )
+        {
+            mainSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
+        GridLayout mainLayout = new GridLayout( 2, false );
+        mainClient.setLayout( mainLayout );
+        mainSection.setClient( mainClient );
+
+        // create new content
+        if ( mrd != null )
+        {
+            toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( mrd.getNumericOID() ), SWT.NONE );
+            numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            numericOidText.setEditable( false );
+
+            toolkit.createLabel( mainClient, "Matching rule names:", SWT.NONE );
+            namesText = toolkit.createText( mainClient, getNonNullString( mrd.toString() ), SWT.NONE );
+            namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            namesText.setEditable( false );
+
+            toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
+            descText = toolkit.createText( mainClient, getNonNullString( mrd.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 );
+        }
+
+        mainSection.layout();
+    }
+
+
+    /**
+     * Creates the content of the used from section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param mrd the matching rule description
+     */
+    private void createUsedFromContents( MatchingRuleDescription mrd )
+    {
+        // dispose old content
+        if ( usedFromSection.getClient() != null )
+        {
+            usedFromSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite usedFromClient = toolkit.createComposite( usedFromSection, SWT.WRAP );
+        usedFromClient.setLayout( new GridLayout() );
+        usedFromSection.setClient( usedFromClient );
+
+        // create new content
+        if ( mrd != null )
+        {
+            AttributeTypeDescription[] usedFromATDs = mrd.getUsedFromAttributeTypeDescriptions();
+            if ( usedFromATDs != null && usedFromATDs.length > 0 )
+            {
+                usedFromSection.setText( "Used from (" + usedFromATDs.length + ")" );
+                usedFromLinks = new Hyperlink[usedFromATDs.length];
+                for ( int i = 0; i < usedFromATDs.length; i++ )
+                {
+                    usedFromLinks[i] = toolkit.createHyperlink( usedFromClient, usedFromATDs[i].toString(), SWT.WRAP );
+                    usedFromLinks[i].setHref( usedFromATDs[i] );
+                    usedFromLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                    usedFromLinks[i].setUnderlined( true );
+                    usedFromLinks[i].setEnabled( true );
+                    usedFromLinks[i].addHyperlinkListener( this );
+                }
+            }
+            else
+            {
+                usedFromSection.setText( "Used from (0)" );
+                usedFromLinks = new Hyperlink[0];
+                Text usedFromText = toolkit.createText( usedFromClient, getNonNullString( null ), SWT.NONE );
+                usedFromText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                usedFromText.setEditable( false );
+            }
+        }
+        else
+        {
+            usedFromSection.setText( "Used from" );
+        }
+
+        usedFromSection.layout();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionDetailsPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,235 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * The MatchingRuleDescriptionPage displays a list with all
+ * matching rule descriptions and hosts the detail page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MatchingRuleDescriptionPage extends SchemaPage
+{
+
+    /**
+     * Creates a new instance of MatchingRuleDescriptionPage.
+     *
+     * @param schemaBrowser the schema browser
+     */
+    public MatchingRuleDescriptionPage( SchemaBrowser schemaBrowser )
+    {
+        super( schemaBrowser );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getTitle()
+    {
+        return "Matching Rules";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFilterDescription()
+    {
+        return "Please select a matching rule. Enter a filter to restrict the list.";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected IStructuredContentProvider getContentProvider()
+    {
+        return new MRDContentProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ITableLabelProvider getLabelProvider()
+    {
+        return new MRDLabelProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerSorter getSorter()
+    {
+        return new MRDViewerSorter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerFilter getFilter()
+    {
+        return new MRDViewerFilter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected SchemaDetailsPage getDetailsPage()
+    {
+        return new MatchingRuleDescriptionDetailsPage( this, this.toolkit );
+    }
+
+    /**
+     * The content provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class MRDContentProvider implements IStructuredContentProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public Object[] getElements( Object inputElement )
+        {
+            if ( inputElement instanceof Schema )
+            {
+                Schema schema = ( Schema ) inputElement;
+                if ( schema != null && schema.getMrdMapByName() != null )
+                {
+                    Set<Object> set = new HashSet<Object>( schema.getMrdMapByName().values() );
+                    return set.toArray();
+                }
+            }
+            return new Object[0];
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void dispose()
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+        {
+        }
+    }
+
+    /**
+     * The label provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class MRDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public String getColumnText( Object obj, int index )
+        {
+            return obj.toString();
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public Image getColumnImage( Object obj, int index )
+        {
+            return null;
+        }
+    }
+
+    /**
+     * The sorter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class MRDViewerSorter extends ViewerSorter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public int compare( Viewer viewer, Object e1, Object e2 )
+        {
+            return e1.toString().compareTo( e2.toString() );
+        }
+    }
+
+    /**
+     * The filter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    private class MRDViewerFilter extends ViewerFilter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public boolean select( Viewer viewer, Object parentElement, Object element )
+        {
+            if ( element instanceof MatchingRuleDescription )
+            {
+                MatchingRuleDescription mrd = ( MatchingRuleDescription ) element;
+                boolean matched = false;
+
+                if ( !matched )
+                    matched = mrd.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+                if ( !matched )
+                    matched = mrd.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+
+                return matched;
+            }
+            return false;
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleDescriptionPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,283 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleUseDescription;
+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.Label;
+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.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+public class MatchingRuleUseDescriptionDetailsPage extends SchemaDetailsPage
+{
+
+    /** The main section, contains oid, names and desc */
+    private Section mainSection;
+
+    /** The numeric oid field */
+    private Text numericOidText;
+    
+    /** The name link */
+    private Hyperlink nameLink;
+    
+    /** The description field */
+    private Text descText;
+
+    /** The flag section, contains obsolete */
+    private Section flagSection;
+
+    /** The obsolete field */
+    private Label isObsoleteText;
+
+    /** The applies section, contains links */
+    private Section appliesSection;
+
+    /** The links to attribute types the matching rule is applicaple to */
+    private Hyperlink[] appliesLinks;
+
+
+    /**
+     * Creates a new instance of MatchingRuleUseDescriptionDetailsPage.
+     *
+     * @param schemaPage the master schema page
+     * @param toolkit the toolkit used to create controls
+     */
+    public MatchingRuleUseDescriptionDetailsPage( SchemaPage schemaPage, FormToolkit toolkit )
+    {
+        super( schemaPage, toolkit );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createContents( final ScrolledForm detailForm )
+    {
+
+        this.detailForm = detailForm;
+        detailForm.getBody().setLayout( new GridLayout() );
+
+        // create main section
+        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 );
+
+        // create flag section
+        flagSection = toolkit.createSection( detailForm.getBody(), SWT.NONE );
+        flagSection.setText( "Flags" );
+        flagSection.marginWidth = 0;
+        flagSection.marginHeight = 0;
+        flagSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( flagSection );
+
+        // create flag content
+        Composite flagClient = toolkit.createComposite( flagSection, SWT.WRAP );
+        GridLayout flagLayout = new GridLayout();
+        flagLayout.numColumns = 1;
+        flagLayout.marginWidth = 0;
+        flagLayout.marginHeight = 0;
+        flagClient.setLayout( flagLayout );
+        flagSection.setClient( flagClient );
+
+        isObsoleteText = toolkit.createLabel( flagClient, "Obsolete", SWT.CHECK );
+        isObsoleteText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        isObsoleteText.setEnabled( false );
+
+        // create applies section
+        appliesSection = toolkit.createSection( detailForm.getBody(), Section.TWISTIE );
+        appliesSection.setText( "Applies" );
+        appliesSection.marginWidth = 0;
+        appliesSection.marginHeight = 0;
+        appliesSection.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+        toolkit.createCompositeSeparator( appliesSection );
+        appliesSection.addExpansionListener( new ExpansionAdapter()
+        {
+            public void expansionStateChanged( ExpansionEvent e )
+            {
+                detailForm.reflow( true );
+            }
+        } );
+
+        // create raw section
+        super.createRawSection();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( Object input )
+    {
+        MatchingRuleUseDescription mrud = null;
+        if ( input instanceof MatchingRuleUseDescription )
+        {
+            mrud = ( MatchingRuleUseDescription ) input;
+        }
+
+        // create main content
+        this.createMainContent( mrud );
+        
+        // set flag
+        isObsoleteText.setEnabled( mrud != null && mrud.isObsolete() );
+        
+        // create contents of dynamic sections
+        this.createAppliesContents( mrud );
+        super.createRawContents( mrud );
+
+        this.detailForm.reflow( true );
+    }
+
+
+    /**
+     * Creates the content of the main section. It is newly created
+     * on every input change to ensure a proper layout of 
+     * multilined descriptions. 
+     *
+     * @param mrud the matching rule use description
+     */
+    private void createMainContent( MatchingRuleUseDescription mrud )
+    {
+        // dispose old content
+        if ( mainSection.getClient() != null )
+        {
+            mainSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
+        GridLayout mainLayout = new GridLayout( 2, false );
+        mainClient.setLayout( mainLayout );
+        mainSection.setClient( mainClient );
+
+        // create new content
+        if ( mrud != null )
+        {
+            toolkit.createLabel( mainClient, "Numeric OID:", SWT.NONE );
+            numericOidText = toolkit.createText( mainClient, getNonNullString( mrud.getNumericOID() ), SWT.NONE );
+            numericOidText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            numericOidText.setEditable( false );
+
+            toolkit.createLabel( mainClient, "Matching rule names:", SWT.NONE );
+            nameLink = toolkit.createHyperlink( mainClient, "", SWT.WRAP );
+            nameLink.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            nameLink.addHyperlinkListener( this );
+
+            MatchingRuleDescription mrd = mrud.getSchema().hasMatchingRuleDescription( mrud.getNumericOID() ) ? mrud
+                .getSchema().getMatchingRuleDescription( mrud.getNumericOID() ) : null;
+            nameLink.setText( getNonNullString( mrd != null ? mrd.toString() : mrud.toString() ) );
+            nameLink.setHref( mrd );
+            nameLink.setUnderlined( mrd != null );
+            nameLink.setEnabled( mrd != null );
+
+            toolkit.createLabel( mainClient, "Descripton:", SWT.NONE );
+            descText = toolkit.createText( mainClient, getNonNullString( mrud.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 );
+        }
+
+        mainSection.layout();
+    }
+
+
+    /**
+     * Creates the content of the applies section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param mrud the matching rule use description
+     */
+    private void createAppliesContents( MatchingRuleUseDescription mrud )
+    {
+        // dispose old content
+        if ( appliesSection.getClient() != null )
+        {
+            appliesSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite appliesClient = toolkit.createComposite( appliesSection, SWT.WRAP );
+        appliesClient.setLayout( new GridLayout() );
+        appliesSection.setClient( appliesClient );
+
+        // create content
+        if ( mrud != null )
+        {
+            String[] names = mrud.getAppliesAttributeTypeDescriptionOIDs();
+            if ( names != null && names.length > 0 )
+            {
+                appliesSection.setText( "Applies (" + names.length + ")" );
+                appliesLinks = new Hyperlink[names.length];
+                for ( int i = 0; i < names.length; i++ )
+                {
+                    if ( mrud.getSchema().hasAttributeTypeDescription( names[i] ) )
+                    {
+                        AttributeTypeDescription appliesAtd = mrud.getSchema().getAttributeTypeDescription( names[i] );
+                        appliesLinks[i] = toolkit.createHyperlink( appliesClient, appliesAtd.toString(), SWT.WRAP );
+                        appliesLinks[i].setHref( appliesAtd );
+                        appliesLinks[i].setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                        appliesLinks[i].setUnderlined( true );
+                        appliesLinks[i].setEnabled( true );
+                        appliesLinks[i].addHyperlinkListener( this );
+                    }
+                    else
+                    {
+                        appliesLinks[i] = toolkit.createHyperlink( appliesClient, names[i], SWT.WRAP );
+                        appliesLinks[i].setHref( null );
+                        appliesLinks[i].setUnderlined( false );
+                        appliesLinks[i].setEnabled( false );
+                    }
+                }
+            }
+            else
+            {
+                appliesSection.setText( "Applies (0)" );
+                appliesLinks = new Hyperlink[0];
+                Text usedFromText = toolkit.createText( appliesClient, getNonNullString( null ), SWT.NONE );
+                usedFromText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+                usedFromText.setEditable( false );
+            }
+        }
+        else
+        {
+            appliesSection.setText( "Applies" );
+        }
+
+        appliesSection.layout();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionDetailsPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,236 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleUseDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * The MatchingRuleUseDescriptionPage displays a list with all
+ * matching rule use descriptions and hosts the detail page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MatchingRuleUseDescriptionPage extends SchemaPage
+{
+
+    /**
+     * 
+     * Creates a new instance of MatchingRuleUseDescriptionPage.
+     *
+     * @param schemaBrowser the schema browser
+     */
+    public MatchingRuleUseDescriptionPage( SchemaBrowser schemaBrowser )
+    {
+        super( schemaBrowser );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getTitle()
+    {
+        return "Matching Rule Use";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFilterDescription()
+    {
+        return "Please select a matching rule. Enter a filter to restrict the list.";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected IStructuredContentProvider getContentProvider()
+    {
+        return new MRUDContentProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ITableLabelProvider getLabelProvider()
+    {
+        return new MRUDLabelProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerSorter getSorter()
+    {
+        return new MRUDViewerSorter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerFilter getFilter()
+    {
+        return new MRUDViewerFilter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected SchemaDetailsPage getDetailsPage()
+    {
+        return new MatchingRuleUseDescriptionDetailsPage( this, this.toolkit );
+    }
+
+    /**
+     * The content provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class MRUDContentProvider implements IStructuredContentProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public Object[] getElements( Object inputElement )
+        {
+            if ( inputElement instanceof Schema )
+            {
+                Schema schema = ( Schema ) inputElement;
+                if ( schema != null && schema.getMrudMapByName() != null )
+                {
+                    Set<Object> set = new HashSet<Object>( schema.getMrudMapByName().values() );
+                    return set.toArray();
+                }
+            }
+            return new Object[0];
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void dispose()
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+        {
+        }
+    }
+
+    /**
+     * The label provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class MRUDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public String getColumnText( Object obj, int index )
+        {
+            return obj.toString();
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public Image getColumnImage( Object obj, int index )
+        {
+            return null;
+        }
+    }
+
+    /**
+     * The sorter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class MRUDViewerSorter extends ViewerSorter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public int compare( Viewer viewer, Object e1, Object e2 )
+        {
+            return e1.toString().compareTo( e2.toString() );
+        }
+    }
+
+    /**
+     * The filter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class MRUDViewerFilter extends ViewerFilter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public boolean select( Viewer viewer, Object parentElement, Object element )
+        {
+            if ( element instanceof MatchingRuleUseDescription )
+            {
+                MatchingRuleUseDescription mrud = ( MatchingRuleUseDescription ) element;
+                boolean matched = false;
+
+                if ( !matched )
+                    matched = mrud.toString().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+                if ( !matched )
+                    matched = mrud.getNumericOID().toLowerCase().indexOf( filterText.getText().toLowerCase() ) != -1;
+
+                return matched;
+            }
+            return false;
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/MatchingRuleUseDescriptionPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,535 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.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.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * The ObjectClassDescriptionDetailsPage displays the details of an
+ * object class description.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassDescriptionDetailsPage extends SchemaDetailsPage
+{
+
+    /** The main section, contains oid, names, desc and kind */
+    private Section mainSection;
+
+    /** The numeric oid field */
+    private Text numericOidText;
+
+    /** The names field */
+    private Text namesText;
+
+    /** The description field */
+    private Text descText;
+
+    /** The kind field */
+    private Text kindText;
+
+    /** The section with links to superior object classes */
+    private Section superclassesSection;
+
+    /** The links to superior object classes */
+    private Hyperlink[] superLinks;
+
+    /** The section with links to derived object classes */
+    private Section subclassesSection;
+
+    /** The links to derived object classes */
+    private Hyperlink[] subLinks;
+
+    /** The section with links to must attribute types */
+    private Section mustSection;
+
+    /** The links to must attribute types */
+    private Hyperlink[] mustLinks;
+
+    /** The section with links to may attribute types */
+    private Section maySection;
+
+    /** The links to may attribute types */
+    private Hyperlink[] mayLinks;
+
+
+    /**
+     * Creates a new instance of ObjectClassDescriptionDetailsPage.
+     *
+     * @param schemaPage the master schema page
+     * @param toolkit the toolkit used to create controls
+     */
+    public ObjectClassDescriptionDetailsPage( SchemaPage schemaPage, FormToolkit toolkit )
+    {
+        super( schemaPage, toolkit );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createContents( final ScrolledForm detailForm )
+    {
+        this.detailForm = detailForm;
+        detailForm.getBody().setLayout( new GridLayout() );
+
+        // create main section
+        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 );
+
+        // create must section
+        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 );
+            }
+        } );
+
+        // create may section
+        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 );
+            }
+        } );
+
+        // create superior section
+        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 );
+            }
+        } );
+
+        // create subclasses section
+        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 );
+            }
+        } );
+
+        // create raw section
+        createRawSection();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( Object input )
+    {
+        ObjectClassDescription ocd = null;
+        if ( input instanceof ObjectClassDescription )
+        {
+            ocd = ( ObjectClassDescription ) input;
+        }
+
+        // create main content
+        this.createMainContent( ocd );
+
+        // create contents of dynamic sections
+        this.createSuperclassContents( ocd );
+        this.createSubclassContents( ocd );
+        this.createMustContents( ocd );
+        this.createMayContents( ocd );
+        super.createRawContents( ocd );
+
+        this.detailForm.reflow( true );
+    }
+
+
+    /**
+     * Creates the content of the main section. It is newly created
+     * on every input change to ensure a proper layout of 
+     * multilined descriptions. 
+     *
+     * @param ocd the object class description
+     */
+    private void createMainContent( ObjectClassDescription ocd )
+    {
+        // dispose old content
+        if ( mainSection.getClient() != null )
+        {
+            mainSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite mainClient = toolkit.createComposite( mainSection, SWT.WRAP );
+        GridLayout mainLayout = new GridLayout( 2, false );
+        mainClient.setLayout( mainLayout );
+        mainSection.setClient( mainClient );
+
+        // create new content
+        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 );
+            namesText = toolkit.createText( mainClient, getNonNullString( ocd.toString() ), SWT.NONE );
+            namesText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+            namesText.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();
+    }
+
+
+    /**
+     * Creates the content of the must section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param ocd the object class description
+     */
+    private void createMustContents( ObjectClassDescription ocd )
+    {
+        // dispose old content
+        if ( mustSection.getClient() != null )
+        {
+            mustSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite mustClient = toolkit.createComposite( mustSection, SWT.WRAP );
+        mustClient.setLayout( new GridLayout() );
+        mustSection.setClient( mustClient );
+
+        // create new content
+        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( this );
+                    }
+                    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();
+    }
+
+
+    /**
+     * Creates the content of the may section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param ocd the object class description
+     */
+    private void createMayContents( ObjectClassDescription ocd )
+    {
+        // dispose old content
+        if ( maySection.getClient() != null )
+        {
+            maySection.getClient().dispose();
+        }
+
+        // create new client
+        Composite mayClient = toolkit.createComposite( maySection, SWT.WRAP );
+        mayClient.setLayout( new GridLayout() );
+        maySection.setClient( mayClient );
+
+        // create new content
+        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( this );
+                    }
+                    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();
+    }
+
+
+    /**
+     * Creates the content of the must section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param ocd the object class description
+     */
+    private void createSubclassContents( ObjectClassDescription ocd )
+    {
+        // dispose old content
+        if ( subclassesSection.getClient() != null )
+        {
+            subclassesSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite subClient = toolkit.createComposite( subclassesSection, SWT.WRAP );
+        subClient.setLayout( new GridLayout() );
+        subclassesSection.setClient( subClient );
+
+        // create new content
+        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( this );
+                }
+            }
+            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();
+    }
+
+
+    /**
+     * Creates the content of the must section. 
+     * It is newly created on every input change because the content
+     * of this section is dynamic.
+     *
+     * @param ocd the object class description
+     */
+    private void createSuperclassContents( ObjectClassDescription ocd )
+    {
+        // dispose old content
+        if ( superclassesSection.getClient() != null )
+        {
+            superclassesSection.getClient().dispose();
+        }
+
+        // create new client
+        Composite superClient = toolkit.createComposite( superclassesSection, SWT.WRAP );
+        superClient.setLayout( new GridLayout() );
+        superclassesSection.setClient( superClient );
+
+        // craete new content
+        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( this );
+                    }
+                    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( "Superclasses (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();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionDetailsPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,231 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * The ObjectClassDescriptionPage displays a list with all
+ * object class descriptions and hosts the detail page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassDescriptionPage extends SchemaPage
+{
+
+    /**
+     * Creates a new instance of ObjectClassDescriptionPage.
+     *
+     * @param schemaBrowser the schema browser
+     */
+    public ObjectClassDescriptionPage( SchemaBrowser schemaBrowser )
+    {
+        super( schemaBrowser );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getTitle()
+    {
+        return "Object Classes";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFilterDescription()
+    {
+        return "Please select an object class. Enter a filter to restrict the list.";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected IStructuredContentProvider getContentProvider()
+    {
+        return new OCDContentProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ITableLabelProvider getLabelProvider()
+    {
+        return new OCDLabelProvider();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerSorter getSorter()
+    {
+        return new OCDViewerSorter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected ViewerFilter getFilter()
+    {
+        return new OCDViewerFilter();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected SchemaDetailsPage getDetailsPage()
+    {
+        return new ObjectClassDescriptionDetailsPage( this, this.toolkit );
+    }
+
+    /**
+     * The content provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class OCDContentProvider implements IStructuredContentProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public Object[] getElements( Object inputElement )
+        {
+            if ( inputElement instanceof Schema )
+            {
+                Schema schema = ( Schema ) inputElement;
+                if ( schema != null )
+                {
+                    return schema.getObjectClassDescriptions();
+                }
+            }
+            return new Object[0];
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void dispose()
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+        {
+        }
+    }
+
+    /**
+     * The label provider used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class OCDLabelProvider extends LabelProvider implements ITableLabelProvider
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public String getColumnText( Object obj, int index )
+        {
+            return obj.toString();
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public Image getColumnImage( Object obj, int index )
+        {
+            return null;
+        }
+    }
+
+    /**
+     * The sorter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class OCDViewerSorter extends ViewerSorter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public int compare( Viewer viewer, Object e1, Object e2 )
+        {
+            return e1.toString().compareTo( e2.toString() );
+        }
+    }
+
+    /**
+     * The filter used by the viewer.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    class OCDViewerFilter extends ViewerFilter
+    {
+        /**
+         * {@inheritDoc}
+         */
+        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;
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ObjectClassDescriptionPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ReloadSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ReloadSchemaAction.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ReloadSchemaAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ReloadSchemaAction.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,91 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.jobs.ReloadSchemasJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.jface.action.Action;
+
+
+/**
+ * This action reloads the schema.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReloadSchemaAction extends Action
+{
+
+    /** The schema page */
+    private SchemaPage schemaPage;
+
+
+    /**
+     * Creates a new instance of ReloadSchemaAction.
+     *
+     * @param schemaPage the schema page
+     */
+    public ReloadSchemaAction( SchemaPage schemaPage )
+    {
+        super( "Reload Schema" );
+        super.setToolTipText( "Reload Schema" );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_REFRESH ) );
+        super.setEnabled( true );
+
+        this.schemaPage = schemaPage;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        final IBrowserConnection browserConnection = schemaPage.getConnection();
+        if ( browserConnection != null )
+        {
+            new ReloadSchemasJob( browserConnection ).execute();
+            schemaPage.getSchemaBrowser().refresh();
+        }
+    }
+
+
+    /**
+     * Disposes this action.
+     */
+    public void dispose()
+    {
+        schemaPage = null;
+    }
+
+
+    /**
+     * Updates the enabled state.
+     */
+    public void updateEnabledState()
+    {
+        setEnabled( schemaPage.getConnection() != null && !schemaPage.isShowDefaultSchema() );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/ReloadSchemaAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,354 @@
+/*
+ *  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.studio.ldapbrowser.ui.editors.schemabrowser;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.MatchingRuleUseDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaPart;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.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.INavigationLocation;
+import org.eclipse.ui.INavigationLocationProvider;
+import org.eclipse.ui.IReusableEditor;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.EditorPart;
+
+
+/**
+ * The schema browser editor part.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaBrowser extends EditorPart implements INavigationLocationProvider, IReusableEditor
+{
+
+    /** The tab folder with all the schema element tabs */
+    private CTabFolder tabFolder;
+
+    /** The object class tab */
+    private CTabItem ocdTab;
+
+    /** The object class page */
+    private ObjectClassDescriptionPage ocdPage;
+
+    /** The attribute type tab */
+    private CTabItem atdTab;
+
+    /** The attribute type page */
+    private AttributeTypeDescriptionPage atdPage;
+
+    /** The matching rule tab */
+    private CTabItem mrdTab;
+
+    /** The matching rule page */
+    private MatchingRuleDescriptionPage mrdPage;
+
+    /** The matching rule use tab */
+    private CTabItem mrudTab;
+
+    /** The matching rule use page */
+    private MatchingRuleUseDescriptionPage mrudPage;
+
+    /** The syntax tab */
+    private CTabItem lsdTab;
+
+    /** The syntax page */
+    private LdapSyntaxDescriptionPage lsdPage;
+
+
+    /**
+     * Gets the ID of the schema browser.
+     *
+     * @return the ID of the schema browser
+     */
+    public static String getId()
+    {
+        return SchemaBrowser.class.getName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void init( IEditorSite site, IEditorInput input ) throws PartInitException
+    {
+        setSite( site );
+
+        // mark dummy location, necessary because the first marked
+        // location doesn't appear in history
+        setInput( new SchemaBrowserInput( null, null ) );
+        getSite().getPage().getNavigationHistory().markLocation( this );
+
+        // set real input
+        setInput( input );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        ocdPage.dispose();
+        atdPage.dispose();
+        mrdPage.dispose();
+        mrudPage.dispose();
+        lsdPage.dispose();
+        tabFolder.dispose();
+        super.dispose();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createPartControl( Composite parent )
+    {
+        tabFolder = new CTabFolder( parent, SWT.BOTTOM );
+
+        ocdTab = new CTabItem( tabFolder, SWT.NONE );
+        ocdTab.setText( "Object Classes" );
+        ocdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD ) );
+        ocdPage = new ObjectClassDescriptionPage( this );
+        Control ocdPageControl = ocdPage.createControl( tabFolder );
+        ocdTab.setControl( ocdPageControl );
+
+        atdTab = new CTabItem( tabFolder, SWT.NONE );
+        atdTab.setText( "Attribute Types" );
+        atdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_ATD ) );
+        atdPage = new AttributeTypeDescriptionPage( this );
+        Control atdPageControl = atdPage.createControl( tabFolder );
+        atdTab.setControl( atdPageControl );
+
+        mrdTab = new CTabItem( tabFolder, SWT.NONE );
+        mrdTab.setText( "Matching Rules" );
+        mrdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_MRD ) );
+        mrdPage = new MatchingRuleDescriptionPage( this );
+        Control mrdPageControl = mrdPage.createControl( tabFolder );
+        mrdTab.setControl( mrdPageControl );
+
+        mrudTab = new CTabItem( tabFolder, SWT.NONE );
+        mrudTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_MRUD ) );
+        mrudTab.setText( "Matching Rule Use" );
+        mrudPage = new MatchingRuleUseDescriptionPage( this );
+        Control mrudPageControl = mrudPage.createControl( tabFolder );
+        mrudTab.setControl( mrudPageControl );
+
+        lsdTab = new CTabItem( tabFolder, SWT.NONE );
+        lsdTab.setImage( BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_LSD ) );
+        lsdTab.setText( "Syntaxes" );
+        lsdPage = new LdapSyntaxDescriptionPage( this );
+        Control lsdPageControl = lsdPage.createControl( tabFolder );
+        lsdTab.setControl( lsdPageControl );
+
+        // set default selection
+        tabFolder.setSelection( ocdTab );
+
+        // init help context
+        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" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInput( IEditorInput input )
+    {
+        super.setInput( input );
+
+        if ( input instanceof SchemaBrowserInput && tabFolder != null )
+        {
+            SchemaBrowserInput sbi = ( SchemaBrowserInput ) input;
+
+            // set connection;
+            IBrowserConnection connection = sbi.getConnection();
+            setConnection( connection );
+
+            // set schema element and activate tab
+            SchemaPart schemaElement = sbi.getSchemaElement();
+            if ( schemaElement instanceof ObjectClassDescription )
+            {
+                ocdPage.select( schemaElement );
+                tabFolder.setSelection( ocdTab );
+            }
+            else if ( schemaElement instanceof AttributeTypeDescription )
+            {
+                atdPage.select( schemaElement );
+                tabFolder.setSelection( atdTab );
+            }
+            else if ( schemaElement instanceof MatchingRuleDescription )
+            {
+                mrdPage.select( schemaElement );
+                tabFolder.setSelection( mrdTab );
+            }
+            else if ( schemaElement instanceof MatchingRuleUseDescription )
+            {
+                mrudPage.select( schemaElement );
+                tabFolder.setSelection( mrudTab );
+            }
+            else if ( schemaElement instanceof LdapSyntaxDescription )
+            {
+                lsdPage.select( schemaElement );
+                tabFolder.setSelection( lsdTab );
+            }
+
+            if ( connection != null && schemaElement != null )
+            {
+                // enable one instance hack before fireing the input change event 
+                // otherwise the navigation history is cleared.
+                SchemaBrowserInput.enableOneInstanceHack( true );
+                firePropertyChange( IEditorPart.PROP_INPUT );
+
+                // disable one instance hack for marking the location
+                SchemaBrowserInput.enableOneInstanceHack( false );
+                getSite().getPage().getNavigationHistory().markLocation( this );
+            }
+
+            // finally enable the one instance hack 
+            SchemaBrowserInput.enableOneInstanceHack( true );
+        }
+    }
+
+
+    /**
+     * Refreshes all pages.
+     */
+    public void refresh()
+    {
+        ocdPage.refresh();
+        atdPage.refresh();
+        mrdPage.refresh();
+        mrudPage.refresh();
+        lsdPage.refresh();
+    }
+
+
+    /**
+     * Sets the show defauls schema flag to all pages.
+     *
+     * @param b the default schema flag
+     */
+    public void setShowDefaultSchema( boolean b )
+    {
+        ocdPage.setShowDefaultSchema( b );
+        atdPage.setShowDefaultSchema( b );
+        mrdPage.setShowDefaultSchema( b );
+        mrudPage.setShowDefaultSchema( b );
+        lsdPage.setShowDefaultSchema( b );
+    }
+
+
+    /**
+     * Sets the connection.
+     * 
+     * @param connection the connection
+     */
+    public void setConnection( IBrowserConnection connection )
+    {
+        ocdPage.setConnection( connection );
+        atdPage.setConnection( connection );
+        mrdPage.setConnection( connection );
+        mrudPage.setConnection( connection );
+        lsdPage.setConnection( connection );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setFocus()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void doSave( IProgressMonitor monitor )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void doSaveAs()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDirty()
+    {
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSaveAsAllowed()
+    {
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public INavigationLocation createEmptyNavigationLocation()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public INavigationLocation createNavigationLocation()
+    {
+        return new SchemaBrowserNavigationLocation( this );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/schemabrowser/SchemaBrowser.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message