You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/07/03 17:51:58 UTC

svn commit: r1689040 [2/2] - in /directory/studio/trunk/plugins: openldap.common.ui/src/main/java/org/apache/directory/studio/openldap/common/ui/model/ openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/databases/ o...

Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java?rev=1689040&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/wrappers/DbIndexWrapper.java Fri Jul  3 15:51:57 2015
@@ -0,0 +1,360 @@
+/*
+ *  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.openldap.config.editor.wrappers;
+
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.directory.api.ldap.model.schema.SchemaUtils;
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.openldap.common.ui.model.DbIndexTypeEnum;
+
+/**
+ * A wrapper for the Databse indexes. It's used by the BDB, MDB,  or HDB/BDB. Here is the 
+ * index value's syntax :
+ * <pre>
+ * <olcDbIndex> ::= ATTR <attr-list> <index-types-e> | 'default' <index-types>
+ * <attr-list> ::= ',' ATTR <attr-list> | e
+ * <index-types> ::= <type> <types-e>
+ * <types-e> ::= ',' <type> <types-e> | e
+ * <type> ::= 'pres' | 'eq' | 'sub' | 'approx' | 'sub' | 'subinitial' | 'subany' | 
+ *              'subfinal' | 'substr' | 'notags' | 'nolang' | 'nosubtypes'
+ * <index-types-e> ::= <index-types> | e
+ * </pre>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DbIndexWrapper implements Cloneable, Comparable<DbIndexWrapper>
+{
+    /** A flag set when the 'default' special attribute is used */
+    private boolean isDefault;
+
+    /** The set of configured attributes */
+    private Set<String> attributes = new TreeSet<String>( new Comparator<String>()
+        {
+            @Override
+            public int compare( String string1, String string2 )
+            {
+                if ( string1 == null )
+                {
+                    return -1;
+                }
+                else if ( string2 == null )
+                {
+                    return 1;
+                }
+
+                return string1.compareTo( string2 );
+            }
+        }
+    );
+    
+    /** The set of configured attributes */
+    private Set<DbIndexTypeEnum> indexTypes = new HashSet<DbIndexTypeEnum>();
+        
+    /**
+     * Build a DbIndexWrapper from a String containing the description of the index.
+     *  
+     * @param indexStr The String that describes the index
+     */
+    public DbIndexWrapper( String indexStr )
+    {
+        // We first have to parse the attributes. It's a list of Strings, or OIDs, separated
+        // by ',' and that ends at the first ' ' or the end of the line.
+        int pos = 0;
+        int startPos = 0;
+        boolean endAttributes = false;
+        
+        // Valid chars are 'a'-'z', 'A'-'Z', '0'-'9', '.', '-' and '_'
+        for ( pos = 0; pos < indexStr.length(); pos++ )
+        {
+            char c = indexStr.charAt( pos );
+            endAttributes = c == ' ';
+            
+            if ( ( c == ',' ) || endAttributes )
+            {
+                // This is the end of the attribute
+                String attrStr = indexStr.substring( startPos, pos );
+                
+                if ( "default".equalsIgnoreCase( attrStr ) )
+                {
+                    isDefault = true;
+                    break;
+                }
+                
+                // Check that it's a valid Attribute
+                //if ( SchemaUtils.isAttributeNameValid( attrStr ) )
+                {
+                    attributes.add( Strings.toLowerCase( attrStr ) );
+                    startPos = pos + 1;
+                }
+            }
+            
+            if ( endAttributes )
+            {
+                break;
+            }
+        }
+        
+        // If the 'default' special attribute si presetn, we can discard all the other attributes
+        if ( isDefault )
+        {
+            attributes.clear();
+        }
+        
+        if ( endAttributes )
+        {
+            pos++;
+            
+            // Ok, we are done with the attributes, let's process the indexTypes now,
+            // starting where we left
+            for ( ; pos < indexStr.length(); pos++ )
+            {
+                char c = indexStr.charAt( pos );
+                
+                if ( c == ',' )
+                {
+                    String indexTypeName = indexStr.substring( startPos, pos );
+                    
+                    // Check if we have this indexType
+                    DbIndexTypeEnum indexType = DbIndexTypeEnum.getIndexType( indexTypeName );
+                    
+                    if ( indexType == DbIndexTypeEnum.NONE )
+                    {
+                        // This is an error, ignore it.
+                    }
+                    else
+                    {
+                        indexTypes.add( indexType );
+                    }
+                    
+                    startPos = pos + 1;
+                }
+            }
+        }
+    }
+    
+    
+    /**
+     * @return the isDefault
+     */
+    public boolean isDefault()
+    {
+        return isDefault;
+    }
+
+
+    /**
+     * @param isDefault the isDefault to set
+     */
+    public void setDefault( boolean isDefault )
+    {
+        this.isDefault = isDefault;
+    }
+
+    
+    /**
+     * @return The set of attributes 
+     */
+    public Set<String> getAttributes()
+    {
+        return attributes;
+    }
+    
+    
+    /**
+     * @return the indexTypes
+     */
+    public Set<DbIndexTypeEnum> getIndexTypes()
+    {
+        return indexTypes;
+    }
+
+
+    /**
+     * @return The set of index types 
+     */
+    public Set<DbIndexTypeEnum> getTypes()
+    {
+        return indexTypes;
+    }
+    
+    
+    /**
+     * @see Object#clone()
+     */
+    public DbIndexWrapper clone()
+    {
+        try
+        {
+            DbIndexWrapper clone = (DbIndexWrapper)super.clone();
+            
+            // Clone the attributes 
+            clone.attributes = new TreeSet<String>();
+            clone.attributes.addAll( attributes );
+            
+            // Clone the indexTypes
+            clone.indexTypes = new TreeSet<DbIndexTypeEnum>();
+            clone.indexTypes.addAll( indexTypes );
+            
+            return clone;
+        }
+        catch ( CloneNotSupportedException cnse )
+        {
+            return null;
+        }
+    }
+
+    
+    /**
+     * @see Object#hashCode()
+     */
+    public int hashCode()
+    {
+        int h = 37;
+        
+        // Only iterate on Attributes
+        for ( String attribute : attributes )
+        {
+            h += h*17 + attribute.hashCode();
+        }
+        
+        return h;
+    }
+
+
+    /**
+     * @see Object#equals()
+     */
+    public boolean equals( Object that )
+    {
+        if ( that == this )
+        {
+            return true;
+        }
+        
+        if ( ! ( that instanceof DbIndexWrapper ) )
+        {
+            return false;
+        }
+        
+        return compareTo( (DbIndexWrapper)that ) == 0;
+    }
+
+
+    /**
+     * @see Comparable#compareTo()
+     */
+    public int compareTo( DbIndexWrapper that )
+    {
+        // Compare by attributes only.
+        if ( that == null )
+        {
+            return 1;
+        }
+
+        // we will iterate on the two sets in parallel.
+        int limit = Math.min( attributes.size(), that.attributes.size() );
+        Iterator<String> thisIterator = attributes.iterator();
+        Iterator<String> thatIterator = that.attributes.iterator();
+        
+        for ( int i = 0; i <  limit; i++ )
+        {
+            int result = thisIterator.next().compareTo( thatIterator.next() );
+            
+            if ( result != 0)
+            {
+                return result;
+            }
+        }
+        
+        return attributes.size() - that.attributes.size();
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        // first, the Attribute, if it's not dafault
+        if ( isDefault )
+        {
+            if ( indexTypes.size() == 0 )
+            {
+                // No types either ? retrun a blank String
+                return "";
+            }
+            
+            sb.append( "default" );
+        }
+        else
+        {
+            boolean isFirst = true;
+            
+            for ( String attribute : attributes )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( ',' );
+                }
+                
+                sb.append( attribute );
+            }
+        }
+        
+        // A space before the indexTypes
+        sb.append( ' ' );
+        
+        if ( indexTypes.size() == 0 )
+        {
+            // No type ? Use default
+            sb.append( "default" );
+        }
+        else
+        {
+            boolean isFirst = true;
+            
+            for ( DbIndexTypeEnum indexType : indexTypes )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( ',' );
+                }
+                
+                sb.append( indexType.getName() );
+            }
+        }
+        
+        return sb.toString();
+    }
+}

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OlcDbIndex.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OlcDbIndex.java?rev=1689040&r1=1689039&r2=1689040&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OlcDbIndex.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OlcDbIndex.java Fri Jul  3 15:51:57 2015
@@ -21,7 +21,11 @@ package org.apache.directory.studio.open
 
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+
+import org.apache.directory.studio.openldap.common.ui.model.DbIndexTypeEnum;
 
 
 /**
@@ -47,7 +51,7 @@ public class OlcDbIndex
     private List<String> attributes = new ArrayList<String>();
 
     /** The list of index types */
-    private List<OlcDbIndexTypeEnum> indexTypes = new ArrayList<OlcDbIndexTypeEnum>();
+    private Set<DbIndexTypeEnum> indexTypes = new HashSet<DbIndexTypeEnum>();
 
 
     /**
@@ -89,7 +93,7 @@ public class OlcDbIndex
                     {
                         for ( String indexType : indexTypes )
                         {
-                            OlcDbIndexTypeEnum type = OlcDbIndexTypeEnum.fromString( indexType );
+                            DbIndexTypeEnum type = DbIndexTypeEnum.valueOf( indexType );
 
                             if ( type != null )
                             {
@@ -148,7 +152,7 @@ public class OlcDbIndex
      *
      * @param indexType the index type
      */
-    public void addIndexType( OlcDbIndexTypeEnum indexType )
+    public void addIndexType( DbIndexTypeEnum indexType )
     {
         indexTypes.add( indexType );
     }
@@ -188,7 +192,7 @@ public class OlcDbIndex
      *
      * @param indexType the index type
      */
-    public void removeIndexType( OlcDbIndexTypeEnum indexType )
+    public void removeIndexType( DbIndexTypeEnum indexType )
     {
         indexTypes.remove( indexType );
     }
@@ -210,7 +214,7 @@ public class OlcDbIndex
      *
      * @return the index types
      */
-    public List<OlcDbIndexTypeEnum> getIndexTypes()
+    public Set<DbIndexTypeEnum> getIndexTypes()
     {
         return indexTypes;
     }
@@ -222,6 +226,7 @@ public class OlcDbIndex
     public String toString()
     {
         StringBuilder sb = new StringBuilder();
+        boolean isFirst = true;
 
         if ( isDefault )
         {
@@ -233,25 +238,38 @@ public class OlcDbIndex
             {
                 for ( String attribute : attributes )
                 {
+                    if ( isFirst )
+                    {
+                        isFirst = false;
+                    }
+                    else
+                    {
+                        sb.append( COMMA_SEPARATOR );
+                    }
+                    
                     sb.append( attribute );
-                    sb.append( COMMA_SEPARATOR );
                 }
-
-                sb.deleteCharAt( sb.length() - 1 );
             }
         }
 
         if ( indexTypes.size() > 0 )
         {
             sb.append( SPACE_SEPARATOR );
+            isFirst = true;
 
-            for ( OlcDbIndexTypeEnum indexType : indexTypes )
+            for ( DbIndexTypeEnum indexType : indexTypes )
             {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( COMMA_SEPARATOR );
+                }
+                
                 sb.append( indexType.toString() );
-                sb.append( COMMA_SEPARATOR );
             }
-
-            sb.deleteCharAt( sb.length() - 1 );
         }
 
         return sb.toString();

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/widgets/IndicesWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/widgets/IndicesWidget.java?rev=1689040&r1=1689039&r2=1689040&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/widgets/IndicesWidget.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/widgets/IndicesWidget.java Fri Jul  3 15:51:57 2015
@@ -25,6 +25,7 @@ import java.util.List;
 
 import org.apache.directory.studio.common.ui.widgets.AbstractWidget;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.common.ui.widgets.TableWidget;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -44,84 +45,32 @@ import org.eclipse.swt.layout.GridLayout
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
 import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginConstants;
-import org.apache.directory.studio.openldap.config.editor.dialogs.IndexDialog;
+import org.apache.directory.studio.openldap.config.editor.dialogs.DbIndexDialog;
+import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexDecorator;
+import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexWrapper;
 import org.apache.directory.studio.openldap.config.model.OlcDbIndex;
 
 
 /**
- * The IndicesWidget provides a table viewer to add/edit/remove an index.
+ * The IndicesWidget provides a table viewer to add/edit/remove an index :
+ * <pre>
+ * Attributes
+ * +----------------------------+
+ * | Index 1                    | (Add...)
+ * | Index 2                    | (Edit...)
+ * |                            | (Delete)
+ * +----------------------------+
+ * </pre>
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class IndicesWidget extends AbstractWidget
+public class IndicesWidget extends TableWidget<DbIndexWrapper>
 {
-    /** The indices list */
-    private List<String> indices = new ArrayList<String>();
-
-    /** The connection */
-    private IBrowserConnection browserConnection;
-
-    // UI widgets
-    private Composite composite;
-    private Table indexTable;
-    private TableViewer indexTableViewer;
-    private Button addButton;
-    private Button editButton;
-    private Button deleteButton;
-
-    // A listener on the Index table, that modifies the button when a index is selected
-    private ISelectionChangedListener tableViewerSelectionChangedListener = new ISelectionChangedListener()
-    {
-        public void selectionChanged( SelectionChangedEvent event )
-        {
-            StructuredSelection selection = ( StructuredSelection ) indexTableViewer.getSelection();
-
-            editButton.setEnabled( !selection.isEmpty() );
-            deleteButton.setEnabled( !selection.isEmpty() );
-        }
-    };
-    
-    // A listener on the Index table, that reacts to a doubleClick : it's opening the index editor
-    private IDoubleClickListener tableViewerDoubleClickListener = new IDoubleClickListener()
-    {
-        public void doubleClick( DoubleClickEvent event )
-        {
-            editIndex();
-        }
-    };
-    
-    // A listener on the Add button, which opens the index addition editor
-    private SelectionListener addButtonListener = new SelectionAdapter()
-    {
-        public void widgetSelected( SelectionEvent e )
-        {
-            addIndex();
-        }
-    };
-    
-    // A listener on the Edit button, that open the index editor
-    private SelectionListener editButtonListener = new SelectionAdapter()
-    {
-        public void widgetSelected( SelectionEvent e )
-        {
-            editIndex();
-        }
-    };
-    
-    // A listener on the Delete button, which delete the selected index
-    private SelectionListener deleteButtonListener = new SelectionAdapter()
-    {
-        public void widgetSelected( SelectionEvent e )
-        {
-            deleteIndex();
-        }
-    };
-
-
     /**
      * Creates a new instance of IndicesWidget.
      *
@@ -129,235 +78,6 @@ public class IndicesWidget extends Abstr
      */
     public IndicesWidget( IBrowserConnection browserConnection )
     {
-        this.browserConnection = browserConnection;
-    }
-
-
-    /**
-     * Creates the widget.
-     * 
-     * @param parent the parent
-     */
-    public void createWidget( Composite parent )
-    {
-        createWidget( parent, null );
-    }
-
-
-    /**
-     * Creates the Index widget. It's a Table and three button :
-     * <pre>
-     * +--------------------------------------+
-     * | Index 1                              | (Add... )
-     * | Index 2                              | (Edit...)
-     * |                                      | (Delete )
-     * +--------------------------------------+
-     * </pre>
-     * 
-     * @param parent the parent
-     * @param toolkit the toolkit
-     */
-    public void createWidget( Composite parent, FormToolkit toolkit )
-    {
-        // Composite
-        if ( toolkit != null )
-        {
-            composite = toolkit.createComposite( parent );
-        }
-        else
-        {
-            composite = new Composite( parent, SWT.NONE );
-        }
-        
-        // First, define a grid of 2 columns
-        GridLayout compositeGridLayout = new GridLayout( 2, false );
-        compositeGridLayout.marginHeight = compositeGridLayout.marginWidth = 0;
-        composite.setLayout( compositeGridLayout );
-
-        // Create the index Table and Table Viewer
-        if ( toolkit != null )
-        {
-            indexTable = toolkit.createTable( composite, SWT.NULL );
-        }
-        else
-        {
-            indexTable = new Table( composite, SWT.NULL );
-        }
-        
-        // Define the table size and height. It will span on 3 lines.
-        GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 );
-        gd.heightHint = 20;
-        gd.widthHint = 100;
-        indexTable.setLayoutData( gd );
-        
-        // Create the index TableViewer
-        indexTableViewer = new TableViewer( indexTable );
-        indexTableViewer.setContentProvider( new ArrayContentProvider() );
-        
-        // The LabelProvider
-        indexTableViewer.setLabelProvider( new LabelProvider()
-        {
-            public Image getImage( Object element )
-            {
-                return OpenLdapConfigurationPlugin.getDefault().getImage(
-                    OpenLdapConfigurationPluginConstants.IMG_INDEX );
-            }
-        } );
-        
-        // Listeners : we want to catch changes and double clicks
-        indexTableViewer.addSelectionChangedListener( tableViewerSelectionChangedListener );
-        indexTableViewer.addDoubleClickListener( tableViewerDoubleClickListener );
-        
-        // Inject the existing indices
-        indexTableViewer.setInput( indices );
-
-        // Create the Add Button and its listener
-        if ( toolkit != null )
-        {
-            addButton = toolkit.createButton( composite, "Add...", SWT.PUSH );
-        }
-        else
-        {
-            addButton = BaseWidgetUtils.createButton( composite, "Add...", 1 );
-        }
-        
-        addButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
-        addButton.addSelectionListener( addButtonListener );
-
-        // Create the Edit Button and its listener
-        if ( toolkit != null )
-        {
-            editButton = toolkit.createButton( composite, "Edit...", SWT.PUSH );
-        }
-        else
-        {
-            editButton = BaseWidgetUtils.createButton( composite, "Edit...", SWT.PUSH );
-        }
-        
-        // It's not enabled unless we have selected an index
-        editButton.setEnabled( false );
-        editButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
-        editButton.addSelectionListener( editButtonListener );
-
-        // Create the Delete Button and its listener
-        if ( toolkit != null )
-        {
-            deleteButton = toolkit.createButton( composite, "Delete", SWT.PUSH );
-        }
-        else
-        {
-            deleteButton = BaseWidgetUtils.createButton( composite, "Delete", SWT.PUSH );
-        }
-        
-        // It's not selected unless we have selected an index
-        deleteButton.setEnabled( false );
-        deleteButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
-        deleteButton.addSelectionListener( deleteButtonListener );
-    }
-
-
-    /**
-     * Returns the primary control associated with this widget.
-     *
-     * @return the primary control associated with this widget.
-     */
-    public Control getControl()
-    {
-        return composite;
-    }
-
-
-    /**
-     * Sets the indices.
-     *
-     * @param indices the indices
-     */
-    public void setIndices( List<String> indices )
-    {
-        if ( ( indices != null ) && ( indices.size() > 0 ) )
-        {
-            this.indices.addAll( indices );
-        }
-
-        indexTableViewer.refresh();
-    }
-
-
-    /**
-     * Gets the indices.
-     *
-     * @return the indices
-     */
-    public List<String> getIndices()
-    {
-        return indices;
-    }
-
-
-    /**
-     * This method is called when the 'Add...' button is clicked.
-     */
-    private void addIndex()
-    {
-        IndexDialog dialog = new IndexDialog( addButton.getShell(), null, browserConnection );
-        
-        if ( dialog.open() == IndexDialog.OK )
-        {
-            OlcDbIndex newIndex = dialog.getNewIndex();
-            indices.add( newIndex.toString() );
-            indexTableViewer.refresh();
-            indexTableViewer.setSelection( new StructuredSelection( newIndex.toString() ) );
-            notifyListeners();
-        }
-    }
-
-
-    /**
-     * This method is called when the 'Edit...' button is clicked
-     * or the table viewer is double-clicked.
-     */
-    private void editIndex()
-    {
-        StructuredSelection selection = ( StructuredSelection ) indexTableViewer.getSelection();
-
-        if ( !selection.isEmpty() )
-        {
-            String selectedIndex = ( String ) selection.getFirstElement();
-
-            // Open the index dialog, with the selected index
-            IndexDialog dialog = new IndexDialog( editButton.getShell(), new OlcDbIndex( selectedIndex ),
-                browserConnection );
-            
-            if ( dialog.open() == IndexDialog.OK )
-            {
-                OlcDbIndex newIndex = dialog.getNewIndex();
-                int selectedIndexPosition = indices.indexOf( selectedIndex );
-                
-                // We will remove the modifie dindex, and replace it with the new index
-                indices.remove( selectedIndex );
-                indices.add( selectedIndexPosition, newIndex.toString() );
-                indexTableViewer.refresh();
-                indexTableViewer.setSelection( new StructuredSelection( newIndex.toString() ) );
-                notifyListeners();
-            }
-        }
-    }
-
-
-    /**
-     * This method is called when the 'Delete' button is clicked.
-     */
-    private void deleteIndex()
-    {
-        StructuredSelection selection = ( StructuredSelection ) indexTableViewer.getSelection();
-
-        if ( !selection.isEmpty() )
-        {
-            String selectedIndex = ( String ) selection.getFirstElement();
-
-            indices.remove( selectedIndex );
-            indexTableViewer.refresh();
-            notifyListeners();
-        }
+        super( new DbIndexDecorator( null, browserConnection ) );
     }
 }