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

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

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/MoveAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/MoveAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/MoveAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/MoveAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,210 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import java.util.LinkedHashSet;
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.internal.model.BaseDNEntry;
+import org.apache.directory.ldapstudio.browser.core.internal.model.DirectoryMetadataEntry;
+import org.apache.directory.ldapstudio.browser.core.internal.model.RootDSE;
+import org.apache.directory.ldapstudio.browser.core.jobs.MoveEntriesJob;
+import org.apache.directory.ldapstudio.browser.core.model.DN;
+import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.ui.dialogs.MoveEntriesDialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+public class MoveAction extends BrowserAction implements ModelModifier
+{
+
+    public MoveAction()
+    {
+        super();
+    }
+
+
+    public String getText()
+    {
+
+        IEntry[] entries = getEntries();
+        ISearch[] searches = getSearches();
+        IBookmark[] bookmarks = getBookmarks();
+
+        if ( entries.length > 0 && searches.length == 0 && bookmarks.length == 0 )
+        {
+            return entries.length == 1 ? "Move Entry..." : "Move Entries...";
+        }
+        // else if(searches.length > 0 && entries.length==0 &&
+        // bookmarks.length==0) {
+        // return entries.length == 1 ? "Move Search..." : "Move Searches...";
+        // }
+        // else if(bookmarks.length > 0 && entries.length==0 &&
+        // searches.length==0) {
+        // return entries.length == 1 ? "Move Bookmark..." : "Move
+        // Bookmarks...";
+        // }
+        else
+        {
+            return "Move...";
+        }
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.MOVE;
+    }
+
+
+    public void run()
+    {
+
+        IEntry[] entries = getEntries();
+        ISearch[] searches = getSearches();
+        IBookmark[] bookmarks = getBookmarks();
+
+        if ( entries.length > 0 && searches.length == 0 && bookmarks.length == 0 )
+        {
+            moveEntries( entries );
+        }
+        else if ( searches.length > 0 && entries.length == 0 && bookmarks.length == 0 )
+        {
+            // tbd
+        }
+        else if ( bookmarks.length > 0 && entries.length == 0 && searches.length == 0 )
+        {
+            // tbd
+        }
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        try
+        {
+            IEntry[] entries = getEntries();
+            ISearch[] searches = getSearches();
+            IBookmark[] bookmarks = getBookmarks();
+
+            return entries.length > 0 && searches.length == 0 && bookmarks.length == 0;
+
+        }
+        catch ( Exception e )
+        {
+            return false;
+        }
+    }
+
+
+    protected IEntry[] getEntries()
+    {
+
+        if ( getSelectedConnections().length + getSelectedBookmarks().length + getSelectedSearches().length
+            + getSelectedAttributes().length + getSelectedValues().length == 0
+            && getSelectedEntries().length + getSelectedSearchResults().length > 0 )
+        {
+
+            LinkedHashSet entriesSet = new LinkedHashSet();
+            for ( int i = 0; i < getSelectedEntries().length; i++ )
+            {
+                entriesSet.add( getSelectedEntries()[i] );
+            }
+            for ( int i = 0; i < this.getSelectedSearchResults().length; i++ )
+            {
+                entriesSet.add( this.getSelectedSearchResults()[i].getEntry() );
+            }
+            IEntry[] entries = ( IEntry[] ) entriesSet.toArray( new IEntry[entriesSet.size()] );
+            for ( int i = 0; i < entries.length; i++ )
+            {
+                if ( entries[i] == null || entries[i] instanceof RootDSE
+                    || entries[i] instanceof DirectoryMetadataEntry || entries[i] instanceof BaseDNEntry )
+                {
+                    return new IEntry[0];
+                }
+            }
+            return entries;
+        }
+        else
+        {
+            return new IEntry[0];
+        }
+
+    }
+
+
+    protected void moveEntries( final IEntry[] entries )
+    {
+        MoveEntriesDialog moveDialog = new MoveEntriesDialog( getShell(), entries );
+        if ( moveDialog.open() == Dialog.OK )
+        {
+            DN newParentDn = moveDialog.getParentDn();
+            if ( newParentDn != null /* && !newRdn.equals(entry.getRdn()) */)
+            {
+                IEntry newParentEntry = entries[0].getConnection().getEntryFromCache( newParentDn );
+                if ( newParentEntry != null )
+                {
+                    new MoveEntriesJob( entries, newParentEntry ).execute();
+                }
+            }
+        }
+    }
+
+
+    protected ISearch[] getSearches()
+    {
+        if ( getSelectedSearches().length == 1 )
+        {
+            return getSelectedSearches();
+        }
+        else
+        {
+            return new ISearch[0];
+        }
+    }
+
+
+    protected IBookmark[] getBookmarks()
+    {
+        if ( getSelectedBookmarks().length == 1 )
+        {
+            return getSelectedBookmarks();
+        }
+        else
+        {
+            return new IBookmark[0];
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewAttributeAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewAttributeAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewAttributeAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewAttributeAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Attribute;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.wizards.AttributeWizard;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+
+
+public class NewAttributeAction extends BrowserAction implements ModelModifier
+{
+
+    public NewAttributeAction()
+    {
+        super();
+    }
+
+
+    public void dispose()
+    {
+        super.dispose();
+    }
+
+
+    public void run()
+    {
+
+        IEntry entry = null;
+        if ( getInput() != null && getInput() instanceof IEntry )
+        {
+            entry = ( IEntry ) getInput();
+        }
+        else if ( getSelectedEntries().length > 0 )
+        {
+            entry = getSelectedEntries()[0];
+        }
+        else if ( getSelectedAttributes().length > 0 )
+        {
+            entry = getSelectedAttributes()[0].getEntry();
+        }
+        else if ( getSelectedValues().length > 0 )
+        {
+            entry = getSelectedValues()[0].getAttribute().getEntry();
+        }
+
+        if ( entry != null )
+        {
+            AttributeWizard wizard = new AttributeWizard( "New Attribute", true, true, null, entry );
+            WizardDialog dialog = new WizardDialog( getShell(), wizard );
+            dialog.setBlockOnOpen( true );
+            dialog.create();
+            if ( dialog.open() == WizardDialog.OK )
+            {
+                String newAttributeDescription = wizard.getAttributeDescription();
+                if ( newAttributeDescription != null && !"".equals( newAttributeDescription ) )
+                {
+                    try
+                    {
+                        IAttribute att = entry.getAttribute( newAttributeDescription );
+                        if ( att == null )
+                        {
+                            att = new Attribute( entry, newAttributeDescription );
+                            entry.addAttribute( att, this );
+                        }
+
+                        att.addEmptyValue( this );
+                    }
+                    catch ( ModelModificationException mme )
+                    {
+                        MessageDialog.openError( Display.getDefault().getActiveShell(), "Error While Adding Attribute",
+                            mme.getMessage() );
+                    }
+                }
+            }
+        }
+    }
+
+
+    public String getText()
+    {
+        return "New Attribute...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ATTRIBUTE_ADD );
+    }
+
+
+    public String getCommandId()
+    {
+        return "org.apache.directory.ldapstudio.browser.action.addAttribute";
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        if ( ( getSelectedSearchResults().length == 1 && getSelectedAttributes().length > 0 ) )
+        {
+            return false;
+        }
+
+        return ( ( getInput() != null && getInput() instanceof IEntry ) || getSelectedEntries().length == 1
+            || getSelectedAttributes().length > 0 || getSelectedValues().length > 0 );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBatchOperationAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBatchOperationAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBatchOperationAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBatchOperationAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.wizards.BatchOperationWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+
+
+public class NewBatchOperationAction extends BrowserAction
+{
+
+    public NewBatchOperationAction()
+    {
+    }
+
+
+    public String getText()
+    {
+        return "New Batch Operation...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BATCH );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        return getSelectedSearches().length == 1
+            && getSelectedSearches()[0].getSearchResults() != null
+            || getSelectedEntries().length + getSelectedSearchResults().length + getSelectedBookmarks().length
+                + getSelectedAttributes().length + getSelectedValues().length > 0;
+    }
+
+
+    public void run()
+    {
+
+        BatchOperationWizard wizard = new BatchOperationWizard();
+        WizardDialog dialog = new WizardDialog( getShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        dialog.open();
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewBookmarkAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.wizards.NewBookmarkWizard;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+
+public class NewBookmarkAction extends BrowserAction
+{
+
+    public NewBookmarkAction()
+    {
+    }
+
+
+    public void run()
+    {
+        NewBookmarkWizard wizard = new NewBookmarkWizard();
+        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+        wizard.init( window.getWorkbench(), ( IStructuredSelection ) window.getSelectionService().getSelection() );
+        WizardDialog dialog = new WizardDialog( getShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    private IEntry getEntry()
+    {
+
+        if ( this.getSelectedEntries().length + this.getSelectedSearchResults().length
+            + this.getSelectedBookmarks().length != 1 )
+        {
+            return null;
+        }
+
+        if ( getSelectedEntries().length == 1 )
+        {
+            return getSelectedEntries()[0];
+        }
+        else if ( getSelectedSearchResults().length == 1 )
+        {
+            return getSelectedSearchResults()[0].getEntry();
+        }
+        else if ( getSelectedBookmarks().length == 1 )
+        {
+            return getSelectedBookmarks()[0].getEntry();
+        }
+
+        return null;
+    }
+
+
+    public String getText()
+    {
+        return "New Bookmark...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BOOKMARK_ADD );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return getEntry() != null && getEntry().getConnection() != null && getEntry().getConnection().isOpened();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewConnectionAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewConnectionAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewConnectionAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.wizards.NewConnectionWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+
+
+public class NewConnectionAction extends BrowserAction
+{
+
+    public NewConnectionAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        NewConnectionWizard wizard = new NewConnectionWizard();
+        WizardDialog dialog = new WizardDialog( getShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    public String getText()
+    {
+        return "New Connection...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_CONNECTION_ADD );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return true;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewEntryAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,102 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.wizards.NewEntryWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public class NewEntryAction extends BrowserAction
+{
+
+    private IWorkbenchWindow window;
+
+
+    public NewEntryAction()
+    {
+    }
+
+
+    public NewEntryAction( IWorkbenchWindow window )
+    {
+        super();
+        this.window = window;
+    }
+
+
+    public void dispose()
+    {
+        super.dispose();
+        this.window = null;
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+        super.init( window );
+        this.window = window;
+    }
+
+
+    public void run()
+    {
+        NewEntryWizard wizard = new NewEntryWizard();
+
+        wizard.init( this.window.getWorkbench(), ( IStructuredSelection ) this.window.getSelectionService()
+            .getSelection() );
+        WizardDialog dialog = new WizardDialog( getShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    public String getText()
+    {
+        return "New Entry...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_ADD );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return this.getSelectedEntries().length + this.getSelectedSearchResults().length
+            + this.getSelectedBookmarks().length == 1;
+        // return getSelectedEntries().length == 1;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewLdifFileAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewLdifFileAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewLdifFileAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewLdifFileAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.LdifEditor;
+import org.apache.directory.ldapstudio.browser.ui.editors.ldif.NonExistingLdifEditorInput;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+public class NewLdifFileAction extends BrowserAction
+{
+
+    public NewLdifFileAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        IEditorInput input = new NonExistingLdifEditorInput();
+        String editorId = LdifEditor.getId();
+        try
+        {
+            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+            page.openEditor( input, editorId );
+        }
+        catch ( PartInitException e )
+        {
+        }
+    }
+
+
+    public String getText()
+    {
+        return "New LDIF File";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LDIFEDITOR_NEW );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return true;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewSearchAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.search.SearchPage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.PlatformUI;
+
+
+public class NewSearchAction extends BrowserAction
+{
+
+    public NewSearchAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        NewSearchUI.openSearchDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), SearchPage.getId() );
+    }
+
+
+    public String getText()
+    {
+        return "New Search...";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_SEARCH_NEW );
+    }
+
+
+    public String getCommandId()
+    {
+        return "org.eclipse.search.ui.openSearchDialog";
+    }
+
+
+    public boolean isEnabled()
+    {
+        return getSelectedEntries().length + getSelectedSearchResults().length + getSelectedSearches().length
+            + getSelectedBookmarks().length + getSelectedConnections().length + getSelectedAttributes().length
+            + getSelectedAttributeHierarchies().length + getSelectedValues().length > 0;
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewValueAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewValueAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewValueAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/NewValueAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.model.schema.SchemaUtils;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class NewValueAction extends BrowserAction implements ModelModifier
+{
+
+    public NewValueAction()
+    {
+        super();
+    }
+
+
+    public void dispose()
+    {
+        super.dispose();
+    }
+
+
+    public void run()
+    {
+        if ( getSelectedValues().length == 1 )
+        {
+            getSelectedValues()[0].getAttribute().addEmptyValue( this );
+        }
+        else if ( getSelectedAttributes().length == 1 )
+        {
+            getSelectedAttributes()[0].addEmptyValue( this );
+        }
+        else if ( getSelectedAttributeHierarchies().length == 1 )
+        {
+            getSelectedAttributeHierarchies()[0].getAttribute().addEmptyValue( this );
+        }
+
+        if ( getSelectedSearchResults().length > 0 )
+        {
+
+        }
+    }
+
+
+    public String getText()
+    {
+        return "New Value";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_VALUE_ADD );
+    }
+
+
+    public String getCommandId()
+    {
+        return "org.apache.directory.ldapstudio.browser.action.addValue";
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        // System.out.println(getSelectedAttributeArrays());
+        // System.out.print("==> ");
+        // IAttribute[][] attArr = getSelectedAttributeArrays();
+        // for (int i = 0; i < attArr.length; i++) {
+        // for (int j = 0; j < attArr[i].length; j++) {
+        // IAttribute att = attArr[i][j];
+        // System.out.print(att + "|");
+        // }
+        // }
+        // System.out.println();
+
+        return ( getSelectedSearchResults().length == 0 && getSelectedAttributes().length == 0
+            && getSelectedValues().length == 1 && SchemaUtils.isModifyable( getSelectedValues()[0].getAttribute()
+            .getAttributeTypeDescription() ) )
+
+            || ( getSelectedSearchResults().length == 0 && getSelectedValues().length == 0
+                && getSelectedAttributes().length == 1 && SchemaUtils.isModifyable( getSelectedAttributes()[0]
+                .getAttributeTypeDescription() ) )
+
+            || ( getSelectedSearchResults().length == 1 && getSelectedValues().length == 0
+                && getSelectedAttributes().length == 0 && getSelectedAttributeHierarchies().length == 1 && SchemaUtils
+                .isModifyable( getSelectedAttributeHierarchies()[0].getAttribute().getAttributeTypeDescription() ) );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenConnectionAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenConnectionAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenConnectionAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.jobs.OpenConnectionsJob;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class OpenConnectionAction extends BrowserAction
+{
+
+    public OpenConnectionAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        OpenConnectionsJob ocj = new OpenConnectionsJob( getSelectedConnections() );
+        ocj.execute();
+    }
+
+
+    public String getText()
+    {
+        return getSelectedConnections().length > 1 ? "Open Connections" : "Open Connection";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_CONNECTION_CONNECT );
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        boolean canOpen = false;
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( getSelectedConnections()[i].canOpen() )
+            {
+                canOpen = true;
+                break;
+            }
+        }
+        return getSelectedConnections().length > 0 && canOpen;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenEncoderDecoderDialogAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenEncoderDecoderDialogAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenEncoderDecoderDialogAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenEncoderDecoderDialogAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.dialogs.EncoderDecoderDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+
+public class OpenEncoderDecoderDialogAction extends BrowserAction
+{
+
+    public OpenEncoderDecoderDialogAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        EncoderDecoderDialog dlg = new EncoderDecoderDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell() );
+        dlg.open();
+    }
+
+
+    public String getText()
+    {
+        return "Open Encoder/Decoder";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return true;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSchemaBrowserAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,322 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.MatchingRuleDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser.SchemaBrowser;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class OpenSchemaBrowserAction extends BrowserAction
+{
+
+    public static final int MODE_NONE = 0;
+
+    public static final int MODE_OBJECTCLASS = 10;
+
+    public static final int MODE_ATTRIBUTETYPE = 20;
+
+    public static final int MODE_EQUALITYMATCHINGRULE = 30;
+
+    public static final int MODE_SUBSTRINGMATCHINGRULE = 31;
+
+    public static final int MODE_ORDERINGMATCHINGRULE = 32;
+
+    public static final int MODE_SYNTAX = 40;
+
+    protected int mode;
+
+
+    public OpenSchemaBrowserAction()
+    {
+        super();
+        this.mode = MODE_NONE;
+    }
+
+
+    public OpenSchemaBrowserAction( int mode )
+    {
+        super();
+        this.mode = mode;
+    }
+
+
+    public void run()
+    {
+        if ( mode == MODE_NONE )
+        {
+            SchemaBrowser.select( null );
+        }
+        else if ( mode == MODE_OBJECTCLASS )
+        {
+            SchemaBrowser.select( getOcd() );
+        }
+        else if ( mode == MODE_ATTRIBUTETYPE )
+        {
+            SchemaBrowser.select( getAtd() );
+        }
+        else if ( mode == MODE_EQUALITYMATCHINGRULE )
+        {
+            SchemaBrowser.select( getEmrd() );
+        }
+        else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
+        {
+            SchemaBrowser.select( getSmrd() );
+        }
+        else if ( mode == MODE_ORDERINGMATCHINGRULE )
+        {
+            SchemaBrowser.select( getOmrd() );
+        }
+        else if ( mode == MODE_SYNTAX )
+        {
+            SchemaBrowser.select( getLsd() );
+        }
+        else
+        {
+            SchemaBrowser.select( null );
+        }
+    }
+
+
+    public String getText()
+    {
+        if ( mode == MODE_NONE )
+        {
+            return "Open Schema Browser";
+        }
+        else if ( mode == MODE_OBJECTCLASS )
+        {
+            return "Object Class Definition";
+        }
+        else if ( mode == MODE_ATTRIBUTETYPE )
+        {
+            return "Attribute Type Definiton";
+        }
+        else if ( mode == MODE_EQUALITYMATCHINGRULE )
+        {
+            return "Equality Matching Rule Definiton";
+        }
+        else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
+        {
+            return "Substring Matching Rule Definiton";
+        }
+        else if ( mode == MODE_ORDERINGMATCHINGRULE )
+        {
+            return "Ordering Matching Rule Definiton";
+        }
+        else if ( mode == MODE_SYNTAX )
+        {
+            return "Syntax Definiton";
+        }
+        else
+        {
+            return "Open Schema Browser";
+        }
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        if ( mode == MODE_NONE )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BROWSER_SCHEMABROWSEREDITOR );
+        }
+        else if ( mode == MODE_OBJECTCLASS )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_OCD );
+        }
+        else if ( mode == MODE_ATTRIBUTETYPE )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ATD );
+        }
+        else if ( mode == MODE_EQUALITYMATCHINGRULE )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_MRD_EQUALITY );
+        }
+        else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_MRD_SUBSTRING );
+        }
+        else if ( mode == MODE_ORDERINGMATCHINGRULE )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_MRD_ORDERING );
+        }
+        else if ( mode == MODE_SYNTAX )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LSD );
+        }
+        else
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BROWSER_SCHEMABROWSEREDITOR );
+        }
+    }
+
+
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        if ( mode == MODE_NONE )
+        {
+            return true;
+        }
+        else if ( mode == MODE_OBJECTCLASS )
+        {
+            return getOcd() != null;
+        }
+        else if ( mode == MODE_ATTRIBUTETYPE )
+        {
+            return getAtd() != null;
+        }
+        else if ( mode == MODE_EQUALITYMATCHINGRULE )
+        {
+            return getEmrd() != null;
+        }
+        else if ( mode == MODE_SUBSTRINGMATCHINGRULE )
+        {
+            return getSmrd() != null;
+        }
+        else if ( mode == MODE_ORDERINGMATCHINGRULE )
+        {
+            return getOmrd() != null;
+        }
+        else if ( mode == MODE_SYNTAX )
+        {
+            return getLsd() != null;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    private LdapSyntaxDescription getLsd()
+    {
+        AttributeTypeDescription atd = getAtd();
+
+        if ( atd != null && atd.getSyntaxDescriptionNumericOIDTransitive() != null
+            && atd.getSchema().hasLdapSyntaxDescription( atd.getSyntaxDescriptionNumericOIDTransitive() ) )
+        {
+            return atd.getSchema().getLdapSyntaxDescription( atd.getSyntaxDescriptionNumericOIDTransitive() );
+        }
+
+        return null;
+    }
+
+
+    private ObjectClassDescription getOcd()
+    {
+        if ( getSelectedAttributes().length == 0 && getSelectedValues().length == 1
+            && getSelectedValues()[0].getAttribute().isObjectClassAttribute() )
+        {
+            String ocdName = getSelectedValues()[0].getStringValue();
+            if ( ocdName != null
+                && getSelectedValues()[0].getAttribute().getEntry().getConnection().getSchema()
+                    .hasObjectClassDescription( ocdName ) )
+            {
+                return getSelectedValues()[0].getAttribute().getEntry().getConnection().getSchema()
+                    .getObjectClassDescription( ocdName );
+            }
+        }
+
+        return null;
+    }
+
+
+    private AttributeTypeDescription getAtd()
+    {
+        if ( ( getSelectedValues().length + getSelectedAttributes().length ) + getSelectedAttributeHierarchies().length == 1 )
+        {
+            AttributeTypeDescription atd = null;
+            if ( getSelectedValues().length == 1 )
+            {
+                atd = getSelectedValues()[0].getAttribute().getAttributeTypeDescription();
+            }
+            else if ( getSelectedAttributes().length == 1 )
+            {
+                atd = getSelectedAttributes()[0].getAttributeTypeDescription();
+            }
+            else if ( getSelectedAttributeHierarchies().length == 1 && getSelectedAttributeHierarchies()[0].size() == 1 )
+            {
+                atd = getSelectedAttributeHierarchies()[0].getAttribute().getAttributeTypeDescription();
+            }
+
+            return atd;
+        }
+
+        return null;
+    }
+
+
+    private MatchingRuleDescription getEmrd()
+    {
+        AttributeTypeDescription atd = getAtd();
+
+        if ( atd != null && atd.getEqualityMatchingRuleDescriptionOIDTransitive() != null
+            && atd.getSchema().hasMatchingRuleDescription( atd.getEqualityMatchingRuleDescriptionOIDTransitive() ) )
+        {
+            return atd.getSchema().getMatchingRuleDescription( atd.getEqualityMatchingRuleDescriptionOIDTransitive() );
+        }
+
+        return null;
+    }
+
+
+    private MatchingRuleDescription getSmrd()
+    {
+        AttributeTypeDescription atd = getAtd();
+
+        if ( atd != null && atd.getSubstringMatchingRuleDescriptionOIDTransitive() != null
+            && atd.getSchema().hasMatchingRuleDescription( atd.getSubstringMatchingRuleDescriptionOIDTransitive() ) )
+        {
+            return atd.getSchema().getMatchingRuleDescription( atd.getSubstringMatchingRuleDescriptionOIDTransitive() );
+        }
+
+        return null;
+    }
+
+
+    private MatchingRuleDescription getOmrd()
+    {
+        AttributeTypeDescription atd = getAtd();
+
+        if ( atd != null && atd.getOrderingMatchingRuleDescriptionOIDTransitive() != null
+            && atd.getSchema().hasMatchingRuleDescription( atd.getOrderingMatchingRuleDescriptionOIDTransitive() ) )
+        {
+            return atd.getSchema().getMatchingRuleDescription( atd.getOrderingMatchingRuleDescriptionOIDTransitive() );
+        }
+
+        return null;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.search.SearchPage;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+
+public class OpenSearchAction extends Action implements IWorkbenchWindowActionDelegate
+{
+
+    public OpenSearchAction()
+    {
+        super( "Search...", Action.AS_PUSH_BUTTON );
+        super.setText( "Search..." );
+        super.setToolTipText( "Search..." );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_SEARCH ) );
+        super.setEnabled( true );
+    }
+
+
+    public void run()
+    {
+        NewSearchUI.openSearchDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), SearchPage.getId() );
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+    }
+
+
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    public void dispose()
+    {
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchResultAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchResultAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchResultAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/OpenSearchResultAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.views.browser.BrowserView;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+public class OpenSearchResultAction extends BrowserAction
+{
+
+    public OpenSearchResultAction()
+    {
+        super();
+    }
+
+
+    public void run()
+    {
+        if ( getSelectedSearchResults().length == 1 )
+        {
+            String targetId = BrowserView.getId();
+            IViewPart targetView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(
+                targetId );
+            if ( targetView == null )
+            {
+                try
+                {
+                    targetView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(
+                        targetId, null, IWorkbenchPage.VIEW_ACTIVATE );
+                }
+                catch ( PartInitException e )
+                {
+                }
+            }
+            if ( targetView != null && targetView instanceof BrowserView )
+            {
+                ( ( BrowserView ) targetView ).select( getSelectedSearchResults()[0] );
+                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate( targetView );
+            }
+        }
+    }
+
+
+    public String getText()
+    {
+        return "Open Search Result";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_OPEN_SEARCHRESULT );
+    }
+
+
+    public String getCommandId()
+    {
+        return "org.apache.directory.ldapstudio.browser.action.openSearchResult";
+    }
+
+
+    public boolean isEnabled()
+    {
+        return getSelectedSearchResults().length == 1;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PasteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PasteAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PasteAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PasteAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,361 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.jobs.CopyEntriesJob;
+import org.apache.directory.ldapstudio.browser.core.jobs.CreateValuesJob;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContentRecord;
+import org.apache.directory.ldapstudio.browser.ui.dialogs.ScopeDialog;
+import org.apache.directory.ldapstudio.browser.ui.dnd.ConnectionTransfer;
+import org.apache.directory.ldapstudio.browser.ui.dnd.EntryTransfer;
+import org.apache.directory.ldapstudio.browser.ui.dnd.LdifContentRecordTransfer;
+import org.apache.directory.ldapstudio.browser.ui.dnd.ValuesTransfer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+public class PasteAction extends BrowserAction
+{
+
+    public PasteAction()
+    {
+        super();
+    }
+
+
+    public String getText()
+    {
+
+        // connection
+        IConnection[] connections = getConnectionsToPaste();
+        if ( connections != null )
+        {
+            return connections.length > 1 ? "Paste Connections" : "Paste Connection";
+        }
+
+        // entry
+        IEntry[] entries = getEntriesToPaste();
+        if ( entries != null )
+        {
+            return entries.length > 1 ? "Paste Entries" : "Paste Entry";
+        }
+        LdifContentRecord[] records = getLdifContentRecordToPaste();
+        if ( records != null )
+        {
+            return records.length > 1 ? "Paste Entries" : "Paste Entry";
+        }
+
+        // value
+        IValue[] values = getValuesToPaste();
+        if ( values != null )
+        {
+            return values.length > 1 ? "Paste Values" : "Paste Value";
+        }
+
+        return "Paste";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_PASTE );
+    }
+
+
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.PASTE;
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        // connection
+        if ( getConnectionsToPaste() != null )
+        {
+            return true;
+        }
+
+        // entry
+        else if ( getEntriesToPaste() != null )
+        {
+            return true;
+        }
+        else if ( getLdifContentRecordToPaste() != null )
+        {
+            return true;
+        }
+
+        // value
+        else if ( getValuesToPaste() != null )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+
+    public void run()
+    {
+
+        // connection
+        IConnection[] connections = getConnectionsToPaste();
+        if ( connections != null )
+        {
+            for ( int i = 0; i < connections.length; i++ )
+            {
+                IConnection newConnection = ( IConnection ) connections[i].clone();
+                BrowserCorePlugin.getDefault().getConnectionManager().addConnection( newConnection );
+            }
+            return;
+        }
+
+        // entry
+        IEntry[] entries = getEntriesToPaste();
+        if ( entries != null )
+        {
+            this.pasteEntries( getSelectedEntries()[0], entries );
+            return;
+        }
+        LdifContentRecord[] records = getLdifContentRecordToPaste();
+        if ( records != null )
+        {
+            this.pasteLdifContentRecord( getSelectedEntries()[0], records );
+            return;
+        }
+
+        // value
+        IValue[] values = getValuesToPaste();
+        if ( values != null )
+        {
+            this.pasteValues( values );
+            return;
+        }
+
+    }
+
+
+    private void pasteEntries( final IEntry parent, final IEntry[] entriesToPaste )
+    {
+
+        int scope = ISearch.SCOPE_OBJECT;
+        boolean askForScope = false;
+        for ( int i = 0; i < entriesToPaste.length; i++ )
+        {
+            if ( entriesToPaste[i].hasChildren() )
+            {
+                askForScope = true;
+                break;
+            }
+        }
+        if ( askForScope )
+        {
+            ScopeDialog scopeDialog = new ScopeDialog( Display.getDefault().getActiveShell(), "Select Copy Depth",
+                entriesToPaste.length > 1 );
+            scopeDialog.open();
+            scope = scopeDialog.getScope();
+        }
+
+        new CopyEntriesJob( parent, entriesToPaste, scope ).execute();
+    }
+
+
+    private void pasteLdifContentRecord( final IEntry parent, final LdifContentRecord[] recordsToPaste )
+    {
+
+    }
+
+
+    private void pasteValues( IValue[] values )
+    {
+        IEntry entry = null;
+        if ( getSelectedAttributes().length > 0 )
+        {
+            entry = getSelectedAttributes()[0].getEntry();
+        }
+        else if ( getSelectedValues().length > 0 )
+        {
+            entry = getSelectedValues()[0].getAttribute().getEntry();
+        }
+        else if ( getSelectedEntries().length == 1 )
+        {
+            entry = getSelectedEntries()[0];
+        }
+        else if ( getSelectedSearchResults().length == 1 )
+        {
+            entry = getSelectedSearchResults()[0].getEntry();
+        }
+        else if ( getSelectedBookmarks().length == 1 )
+        {
+            entry = getSelectedBookmarks()[0].getEntry();
+        }
+
+        if ( entry != null )
+        {
+            String[] attributeNames = new String[values.length];
+            Object[] rawValues = new Object[values.length];
+            for ( int v = 0; v < values.length; v++ )
+            {
+                attributeNames[v] = values[v].getAttribute().getDescription();
+                rawValues[v] = values[v].getRawValue();
+            }
+            new CreateValuesJob( entry, attributeNames, rawValues ).execute();
+        }
+    }
+
+
+    /**
+     * Conditions: - a connection is selected - there are connections in
+     * clipboard
+     * 
+     * @return
+     */
+    private IConnection[] getConnectionsToPaste()
+    {
+        if ( getSelectedBookmarks().length + getSelectedEntries().length + getSelectedSearchResults().length
+            + getSelectedSearches().length + getSelectedAttributes().length + getSelectedValues().length == 0
+            && getSelectedConnections().length > 0 )
+        {
+
+            Object content = this.getFromClipboard( ConnectionTransfer.getInstance() );
+            if ( content != null && content instanceof IConnection[] )
+            {
+                IConnection[] connections = ( IConnection[] ) content;
+                return connections;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Conditions: - an entry is selected - there are entries in clipboard
+     * 
+     * @return
+     */
+    private IEntry[] getEntriesToPaste()
+    {
+        if ( getSelectedBookmarks().length + getSelectedSearchResults().length + getSelectedSearches().length
+            + getSelectedConnections().length + getSelectedAttributes().length + getSelectedValues().length == 0
+            && getSelectedEntries().length == 1 )
+        {
+
+            Object content = this.getFromClipboard( EntryTransfer.getInstance() );
+            if ( content != null && content instanceof IEntry[] )
+            {
+                IEntry[] entries = ( IEntry[] ) content;
+                return entries;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Conditions: - an entry is selected - there are LdifContentRecords in
+     * clipboard
+     * 
+     * @return
+     */
+    private LdifContentRecord[] getLdifContentRecordToPaste()
+    {
+        if ( getSelectedBookmarks().length + getSelectedSearchResults().length + getSelectedSearches().length
+            + getSelectedConnections().length + getSelectedAttributes().length + getSelectedValues().length == 0
+            && getSelectedEntries().length == 1 )
+        {
+
+            Object content = this.getFromClipboard( LdifContentRecordTransfer.getInstance() );
+            if ( content != null && content instanceof LdifContentRecord[] )
+            {
+                LdifContentRecord[] records = ( LdifContentRecord[] ) content;
+                return records;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Conditions: - an attribute or value is selected - there are values in
+     * clipboard
+     * 
+     * @return
+     */
+    private IValue[] getValuesToPaste()
+    {
+        if ( ( getSelectedEntries().length + getSelectedSearchResults().length + getSelectedBookmarks().length
+            + getSelectedSearches().length + getSelectedConnections().length == 0 && ( getSelectedAttributes().length
+            + getSelectedValues().length > 0 ) )
+            || ( getSelectedAttributes().length + getSelectedValues().length + getSelectedSearchResults().length
+                + getSelectedBookmarks().length + getSelectedSearches().length + getSelectedConnections().length == 0 && ( getSelectedEntries().length == 1 ) )
+            || ( getSelectedAttributes().length + getSelectedValues().length + getSelectedEntries().length
+                + getSelectedSearchResults().length + getSelectedSearches().length + getSelectedConnections().length == 0 && ( getSelectedBookmarks().length == 1 ) )
+            || ( getSelectedAttributes().length + getSelectedValues().length + getSelectedEntries().length
+                + getSelectedBookmarks().length + getSelectedSearches().length + getSelectedConnections().length == 0 && ( getSelectedSearchResults().length == 1 ) )
+
+        )
+        {
+
+            Object content = this.getFromClipboard( ValuesTransfer.getInstance() );
+            if ( content != null && content instanceof IValue[] )
+            {
+                IValue[] values = ( IValue[] ) content;
+                return values;
+            }
+        }
+
+        return null;
+    }
+
+
+    protected Object getFromClipboard( Transfer dataType )
+    {
+        Clipboard clipboard = null;
+        try
+        {
+            clipboard = new Clipboard( Display.getCurrent() );
+            return clipboard.getContents( dataType );
+        }
+        finally
+        {
+            if ( clipboard != null )
+                clipboard.dispose();
+        }
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PropertiesAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PropertiesAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/PropertiesAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,141 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.utils.Utils;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+public class PropertiesAction extends BrowserAction
+{
+
+    public PropertiesAction()
+    {
+        super();
+    }
+
+
+    public String getText()
+    {
+        return "Properties";
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.PROPERTIES;
+    }
+
+
+    public boolean isEnabled()
+    {
+
+        return getSelectedConnections().length == 1
+            || getSelectedEntries().length + getSelectedSearchResults().length + getSelectedBookmarks().length
+                + getSelectedSearches().length == 1 || getSelectedAttributes().length + getSelectedValues().length == 1
+            || ( getSelectedAttributeHierarchies().length == 1 && getSelectedAttributeHierarchies()[0].size() == 1 );
+
+    }
+
+
+    public void run()
+    {
+
+        IAdaptable element = null;
+        String pageId = null;
+        String title = null;
+
+        if ( getSelectedValues().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedValues()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.ValuePropertyPage";
+            title = getSelectedValues()[0].toString();
+        }
+        else if ( getSelectedAttributes().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedAttributes()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.AttributePropertyPage";
+            title = getSelectedAttributes()[0].toString();
+        }
+        else if ( getSelectedAttributeHierarchies().length == 1 )
+        {
+            IAttribute att = getSelectedAttributeHierarchies()[0].getAttribute();
+            element = att;
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.AttributePropertyPage";
+            title = att.toString();
+        }
+        else if ( getSelectedSearches().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedSearches()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.SearchPropertyPage";
+            title = getSelectedSearches()[0].getName();
+        }
+        else if ( getSelectedBookmarks().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedBookmarks()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.BookmarkPropertyPage";
+            title = getSelectedBookmarks()[0].getName();
+        }
+        else if ( getSelectedEntries().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedEntries()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.EntryPropertyPage";
+            title = getSelectedEntries()[0].getDn().toString();
+        }
+        else if ( getSelectedSearchResults().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedSearchResults()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.EntryPropertyPage";
+            title = getSelectedSearchResults()[0].getDn().toString();
+        }
+        else if ( getSelectedConnections().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedConnections()[0];
+            pageId = "org.apache.directory.ldapstudio.browser.ui.dialogs.properties.ConnectionPropertyPage";
+            title = getSelectedConnections()[0].getName();
+        }
+
+        if ( element != null )
+        {
+            PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn( getShell(), element, pageId, null, null );
+            if ( dialog != null )
+                title = Utils.shorten( title, 30 );
+            dialog.getShell().setText( "Properties for '" + title + "'" );
+            dialog.open();
+
+        }
+
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/RefreshAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/RefreshAction.java?view=auto&rev=488368
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/RefreshAction.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser-ui/src/org/apache/directory/ldapstudio/browser/ui/actions/RefreshAction.java Mon Dec 18 09:52:58 2006
@@ -0,0 +1,198 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.ui.actions;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.core.events.ModelModifier;
+import org.apache.directory.ldapstudio.browser.core.jobs.InitializeAttributesJob;
+import org.apache.directory.ldapstudio.browser.core.jobs.InitializeChildrenJob;
+import org.apache.directory.ldapstudio.browser.core.jobs.SearchJob;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+public class RefreshAction extends BrowserAction implements ModelModifier
+{
+
+    public RefreshAction()
+    {
+        super();
+    }
+
+
+    public String getText()
+    {
+        IEntry[] entries = getEntries();
+        ISearch[] searches = getSearches();
+        IEntry entryInput = getEntryInput();
+        ISearch searchInput = getSearchInput();
+
+        if ( entries.length > 0 && searches.length == 0 && entryInput == null && searchInput == null )
+        {
+            return "Reload Attributes and Children";
+        }
+        else if ( searches.length > 0 && entries.length == 0 && entryInput == null && searchInput == null )
+        {
+            boolean searchAgain = true;
+            for ( int i = 0; i < searches.length; i++ )
+            {
+                if ( searches[i].getSearchResults() == null )
+                {
+                    searchAgain = false;
+                    break;
+                }
+            }
+            if ( searchAgain )
+            {
+                return "Search Again";
+            }
+            else
+            {
+                return searches.length == 1 ? "Perform Search" : "Perform Searches";
+            }
+        }
+        else if ( entryInput != null && searches.length == 0 && entries.length == 0 && searchInput == null )
+        {
+            return "Reload Attributes";
+        }
+        else if ( searchInput != null && searches.length == 0 && entryInput == null )
+        {
+            return searchInput.getSearchResults() == null ? "Perform Search" : "Search Again";
+        }
+        else
+        {
+            return "Refresh";
+        }
+    }
+
+
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_REFRESH );
+    }
+
+
+    public String getCommandId()
+    {
+        return "org.eclipse.ui.file.refresh";
+    }
+
+
+    public void run()
+    {
+        IEntry[] entries = getEntries();
+        ISearch[] searches = getSearches();
+        IEntry entryInput = getEntryInput();
+        ISearch searchInput = getSearchInput();
+        boolean soa = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+            BrowserUIConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );
+
+        if ( entries.length > 0 )
+        {
+            new InitializeAttributesJob( entries, soa ).execute();
+            new InitializeChildrenJob( entries ).execute();
+        }
+        if ( searches.length > 0 )
+        {
+            new SearchJob( searches ).execute();
+        }
+
+        if ( entryInput != null )
+        {
+            new InitializeAttributesJob( new IEntry[]
+                { entryInput }, soa ).execute();
+        }
+        if ( searchInput != null )
+        {
+            new SearchJob( new ISearch[]
+                { searchInput } ).execute();
+        }
+
+    }
+
+
+    public boolean isEnabled()
+    {
+        IEntry[] entries = getEntries();
+        ISearch[] searches = getSearches();
+        IEntry entryInput = getEntryInput();
+        ISearch searchInput = getSearchInput();
+
+        return entries.length > 0 || searches.length > 0 || entryInput != null || searchInput != null;
+    }
+
+
+    protected IEntry[] getEntries()
+    {
+        List entriesList = new ArrayList();
+        entriesList.addAll( Arrays.asList( getSelectedEntries() ) );
+        for ( int i = 0; i < getSelectedSearchResults().length; i++ )
+        {
+            entriesList.add( getSelectedSearchResults()[i].getEntry() );
+        }
+        for ( int i = 0; i < getSelectedBookmarks().length; i++ )
+        {
+            entriesList.add( getSelectedBookmarks()[i].getEntry() );
+        }
+        return ( IEntry[] ) entriesList.toArray( new IEntry[entriesList.size()] );
+    }
+
+
+    protected ISearch[] getSearches()
+    {
+        return getSelectedSearches();
+    }
+
+
+    private IEntry getEntryInput()
+    {
+        if ( getInput() != null && getInput() instanceof IEntry )
+        {
+            return ( IEntry ) getInput();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    private ISearch getSearchInput()
+    {
+        if ( getInput() != null && getInput() instanceof ISearch )
+        {
+            return ( ISearch ) getInput();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+}