directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r526693 [2/17] - in /directory/ldapstudio/trunk/ldapstudio-browser-common: ./ META-INF/ resources/ resources/icons/ resources/templates/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/dir...
Date Mon, 09 Apr 2007 09:49:57 GMT
Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonActivator.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,361 @@
+package org.apache.directory.ldapstudio.browser.common;
+
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.GlobalTemplateVariables;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class BrowserCommonActivator extends AbstractUIPlugin
+{
+
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.browser.common";
+
+    /** The shared instance */
+    private static BrowserCommonActivator plugin;
+
+    /** The font registry */
+    private FontRegistry fontRegistry;
+
+    /** The color registry */
+    private ColorRegistry colorRegistry;
+
+    /** The event dispatcher */
+    private ExceptionHandler exceptionHandler;
+
+    /** The value editor preferences */
+    private ValueEditorsPreferences valueEditorPreferences;
+
+    /** The filter template store. */
+    private ContributionTemplateStore filterTemplateStore;
+
+    /** The filter template context type registry. */
+    private ContributionContextTypeRegistry filterTemplateContextTypeRegistry;
+    
+    /** The event dispatcher */
+    private EventDispatcherSync eventDispatcher;
+    
+    
+    /**
+     * The constructor
+     */
+    public BrowserCommonActivator()
+    {
+        plugin = this;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        
+        if ( fontRegistry == null )
+        {
+            fontRegistry = new FontRegistry( getWorkbench().getDisplay() );
+        }
+        
+        if ( colorRegistry == null )
+        {
+            colorRegistry = new ColorRegistry( getWorkbench().getDisplay() );
+        }
+        
+        if ( exceptionHandler == null )
+        {
+            exceptionHandler = new ExceptionHandler();
+        }
+
+        if ( eventDispatcher == null )
+        {
+            eventDispatcher = new EventDispatcherSync();
+            eventDispatcher.startEventDispatcher();
+        }
+        EventRegistry.init( eventDispatcher );
+        
+        valueEditorPreferences = new ValueEditorsPreferences();
+        
+        if ( filterTemplateContextTypeRegistry == null )
+        {
+            filterTemplateContextTypeRegistry = new ContributionContextTypeRegistry();
+            filterTemplateContextTypeRegistry.addContextType( BrowserCommonConstants.FILTER_TEMPLATE_ID );
+            filterTemplateContextTypeRegistry.getContextType( BrowserCommonConstants.FILTER_TEMPLATE_ID ).addResolver(
+                new GlobalTemplateVariables.Cursor() );
+        }
+
+        if ( filterTemplateStore == null )
+        {
+
+
+        BrowserCorePlugin.getDefault().setAuthHandler( new BrowserCommonAuthHandler() );
+        BrowserCorePlugin.getDefault().setReferralHandler( new BrowserCommonReferralHandler() );}
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+        
+        if ( fontRegistry != null )
+        {
+            fontRegistry = null;
+        }
+        
+        if ( colorRegistry != null )
+        {
+            colorRegistry = null;
+        }
+        
+        if ( exceptionHandler != null )
+        {
+            exceptionHandler = null;
+        }
+
+        if ( eventDispatcher != null )
+        {
+            eventDispatcher.stopEventDispatcher();
+            eventDispatcher = null;
+        }
+        
+        if ( filterTemplateContextTypeRegistry != null )
+        {
+            filterTemplateContextTypeRegistry = null;
+        }
+        
+        if ( filterTemplateStore != null )
+        {
+            try
+            {
+                filterTemplateStore.save();
+            }
+            catch ( IOException e )
+            {
+                e.printStackTrace();
+            }
+            filterTemplateStore = null;
+        }
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static BrowserCommonActivator getDefault()
+    {
+        return plugin;
+    }
+
+
+    /**
+     * Use this method to get SWT images. Use the IMG_ constants from
+     * BrowserWidgetsConstants for the key.
+     * 
+     * @param key
+     *                The key (relative path to the image im filesystem)
+     * @return The image discriptor or null
+     */
+    public ImageDescriptor getImageDescriptor( String key )
+    {
+        if ( key != null )
+        {
+            URL url = FileLocator.find( getBundle(), new Path( key ), null );
+            if ( url != null )
+                return ImageDescriptor.createFromURL( url );
+            else
+                return null;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * Use this method to get SWT images. Use the IMG_ constants from
+     * BrowserWidgetsConstants for the key. A ImageRegistry is used to manage the
+     * the key->Image mapping.
+     * <p>
+     * Note: Don't dispose the returned SWT Image. It is disposed
+     * automatically when the plugin is stopped.
+     * 
+     * @param key
+     *                The key (relative path to the image im filesystem)
+     * @return The SWT Image or null
+     * @see BrowserCommonConstants
+     */
+    public Image getImage( String key )
+    {
+        Image image = getImageRegistry().get( key );
+        if ( image == null )
+        {
+            ImageDescriptor id = getImageDescriptor( key );
+            if ( id != null )
+            {
+                image = id.createImage();
+                getImageRegistry().put( key, image );
+            }
+        }
+        return image;
+    }
+
+    
+    /**
+     * Use this method to get SWT fonts. A FontRegistry is used to manage
+     * the FontData[]->Font mapping.
+     * <p>
+     * Note: Don't dispose the returned SWT Font. It is disposed
+     * automatically when the plugin is stopped.
+     * 
+     * @param fontData
+     *                the font data
+     * @return The SWT Font
+     */
+
+    public Font getFont( FontData[] fontData )
+    {
+        if ( !fontRegistry.hasValueFor( fontData[0].toString() ) )
+        {
+            fontRegistry.put( fontData[0].toString(), fontData );
+        }
+
+        return fontRegistry.get( fontData[0].toString() );
+    }
+
+
+    /**
+     * Use this method to get SWT colors. A ColorRegistry is used to manage
+     * the RGB->Color mapping.
+     * <p>
+     * Note: Don't dispose the returned color. It is disposed automatically
+     * when the plugin is stopped.
+     * 
+     * @param rgb
+     *                the rgb color data
+     * @return The SWT Color
+     */
+    public Color getColor( RGB rgb )
+    {
+        if ( !colorRegistry.hasValueFor( rgb.toString() ) )
+        {
+            colorRegistry.put( rgb.toString(), rgb );
+        }
+
+        return colorRegistry.get( rgb.toString() );
+    }
+    
+
+    /**
+     * 
+     * @return The exception handler
+     */
+    public ExceptionHandler getExceptionHandler()
+    {
+        return exceptionHandler;
+    }
+    
+    
+    /**
+     * Gets the value editors preferences.
+     * 
+     * @return the value editors preferences
+     */
+    public ValueEditorsPreferences getValueEditorsPreferences()
+    {
+        return valueEditorPreferences;
+    }
+    
+
+
+    /**
+     * 
+     * @return The filter template store
+     */
+    public TemplateStore getFilterTemplateStore()
+    {
+        return filterTemplateStore;
+    }
+
+
+    /**
+     * 
+     * @return The filter template context type registry
+     */
+    public ContextTypeRegistry getFilterTemplateContextTypeRegistry()
+    {
+        return filterTemplateContextTypeRegistry;
+    }
+    
+    
+    /**
+     * Checks, if this plugins runs in the Eclipse IDE or in RCP environment.
+     * This is done by looking for the Resource perspective extensions.
+     *
+     * @return true if this plugin runs in IDE environment
+     */
+    public static boolean isIDEEnvironment()
+    {
+        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
+            "org.eclipse.ui.perspectives" );
+        if ( extensionPoint != null )
+        {
+            IExtension[] extensions = extensionPoint.getExtensions();
+            if ( extensions != null )
+            {
+                for ( int i = 0; i < extensions.length; i++ )
+                {
+                    IExtension extension = extensions[i];
+                    IConfigurationElement[] elements = extension.getConfigurationElements();
+                    for ( int j = 0; j < elements.length; j++ )
+                    {
+                        IConfigurationElement element = elements[j];
+                        if ( element.getName().equals( "perspective" ) )
+                        {
+                            if ( "org.eclipse.ui.resourcePerspective".equals( element.getAttribute( "id" ) ) )
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        return false;
+    }
+    
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonAuthHandler.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonAuthHandler.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonAuthHandler.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,81 @@
+/*
+ *  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.common;
+
+
+import org.apache.directory.ldapstudio.browser.common.dialogs.CredentialsDialog;
+import org.apache.directory.ldapstudio.browser.core.internal.model.Credentials;
+import org.apache.directory.ldapstudio.browser.core.model.ConnectionParameter;
+import org.apache.directory.ldapstudio.browser.core.model.IAuthHandler;
+import org.apache.directory.ldapstudio.browser.core.model.ICredentials;
+
+import org.eclipse.ui.PlatformUI;
+
+
+public class BrowserCommonAuthHandler implements IAuthHandler
+{
+
+    public ICredentials getCredentials( final ConnectionParameter connectionParameter )
+    {
+
+        if ( connectionParameter.getBindPrincipal() == null || "".equals( connectionParameter.getBindPrincipal() ) )
+        {
+            return new Credentials( "", "", connectionParameter );
+        }
+        else if ( connectionParameter.getBindPassword() != null && !"".equals( connectionParameter.getBindPassword() ) )
+        {
+            return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter.getBindPassword(),
+                connectionParameter );
+        }
+        else
+        {
+            final String[] pw = new String[1];
+            PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
+            {
+                public void run()
+                {
+                    CredentialsDialog dialog = new CredentialsDialog( PlatformUI.getWorkbench().getDisplay()
+                        .getActiveShell(), "Enter Password for '" + connectionParameter.getName() + "'",
+                        "Please enter password of user " + connectionParameter.getBindPrincipal() + ":", "", null );
+                    if ( dialog.open() == CredentialsDialog.OK )
+                    {
+                        pw[0] = dialog.getValue();
+                    }
+                    else
+                    {
+                        pw[0] = null;
+                    }
+                }
+            } );
+
+            if ( pw[0] == null )
+            {
+                return null;
+            }
+            else
+            {
+                return new Credentials( connectionParameter.getBindPrincipal(), pw[0], connectionParameter );
+            }
+        }
+
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonConstants.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonConstants.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonConstants.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,233 @@
+
+package org.apache.directory.ldapstudio.browser.common;
+
+public interface BrowserCommonConstants
+{
+
+    public static final int HISTORYSIZE = 20;
+
+    
+    
+    public static final String ACTION_ID_EDIT_VALUE = "org.apache.directory.ldapstudio.browser.action.editValue";
+
+    public static final String ACTION_ID_EDIT_ATTRIBUTE_DESCRIPTION = "org.apache.directory.ldapstudio.browser.action.editAttributeDescription";
+
+
+    
+    public static final String DIALOGSETTING_KEY_RECENT_FILE_PATH = "recentFilePath";
+
+    public static final String DIALOGSETTING_KEY_FILE_HISTORY = "fileHistory";
+
+    public static final String DIALOGSETTING_KEY_RETURNING_ATTRIBUTES_HISTORY = "returningAttributesHistory";
+
+    public static final String DIALOGSETTING_KEY_SEARCH_FILTER_HISTORY = "searchFilterHistory";
+
+    public static final String DIALOGSETTING_KEY_DN_HISTORY = "dnHistory";
+
+    public static final String DIALOGSETTING_KEY_HOST_HISTORY = "hostHistory";
+
+    public static final String DIALOGSETTING_KEY_PORT_HISTORY = "portHistory";
+
+    
+    
+    public static final String FILTER_TEMPLATE_ID = "org.apache.directory.ldapstudio.browser.ui.templates.filter";
+
+    
+    public static final String PREFERENCE_TIME_LIMIT = "timeLimit";
+
+    public static final String PREFERENCE_COUNT_LIMIT = "countLimit";
+
+    public static final String PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS = "syntaxValueProviderRelations";
+
+    public static final String PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS = "attributeValueProviderRelations";
+
+    public static final String PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER = "formatTableAttributeDelimiter";
+
+    public static final String PREFERENCE_FORMAT_TABLE_VALUEDELIMITER = "formatTableValueDelimiter";
+
+    public static final String PREFERENCE_FORMAT_TABLE_QUOTECHARACTER = "formatTableQuoteCharacter";
+
+    public static final String PREFERENCE_FORMAT_TABLE_LINESEPARATOR = "formatTableLineSeparator";
+
+    public static final String PREFERENCE_FORMAT_TABLE_BINARYENCODING = "formatTableBinaryEncoding";
+    
+    public static final String PREFERENCE_SHOW_RAW_VALUES = "showRawValues";
+    
+    public static final String PREFERENCE_BROWSER_SORT_BY = "browserSortBy";
+
+    public static final String PREFERENCE_BROWSER_SORT_ORDER = "browserSortOrder";
+
+    public static final String PREFERENCE_BROWSER_SORT_LIMIT = "browserSortLimit";
+
+    public static final String PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST = "browserLeafEntriesFirst";
+
+    public static final String PREFERENCE_BROWSER_META_ENTRIES_LAST = "browserMetaEntriesLast";
+
+    public static final String PREFERENCE_BROWSER_SHOW_DIT = "browserShowDIT";
+
+    public static final String PREFERENCE_BROWSER_SHOW_SEARCHES = "browserShowSearches";
+
+    public static final String PREFERENCE_BROWSER_SHOW_BOOKMARKS = "browserShowBookmarks";
+
+    public static final String PREFERENCE_BROWSER_SHOW_DIRECTORY_META_ENTRIES = "browserShowDirectoryMetaEntries";
+
+    public static final String PREFERENCE_BROWSER_ENABLE_FOLDING = "browserEnableFolding";
+
+    public static final String PREFERENCE_BROWSER_FOLDING_SIZE = "browserFoldingSize";
+
+    public static final String PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES = "browserExpandBaseEntries";
+
+    public static final String PREFERENCE_BROWSER_ENTRY_LABEL = "browserEntryLabel";
+
+    public static final String PREFERENCE_BROWSER_ENTRY_ABBREVIATE = "browserEntryAbbreviate";
+
+    public static final String PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH = "browserentryAbbreviateMaxLength";
+
+    public static final String PREFERENCE_BROWSER_SEARCH_RESULT_LABEL = "browserSearchResultLabel";
+
+    public static final String PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE = "browserWearchResultAbbreviate";
+
+    public static final String PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH = "browserSearchResultAbbreviateMaxLength";
+
+    public static final String PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES = "entryeditorShowMayAttributes";
+
+    public static final String PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES = "entryeditorShowMustAttributes";
+
+    public static final String PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES = "entryeditorShowObjectClassAttribute";
+
+    public static final String PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES = "entryeditorShowOperationalAttributes";
+
+    public static final String PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING = "entryeditorEnableFolding";
+
+    public static final String PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD = "entryeditorFoldingThreshold";
+
+    public static final String PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST = "entryeditorObjectClassAndMustAttributesFirst";
+
+    public static final String PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST = "entryeditorOperationalAttributesLast";
+
+    public static final String PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY = "entryeditorDefaultSortBy";
+
+    public static final String PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_ORDER = "entryeditorDefaultSortOrder";
+    
+    public static final String PREFERENCE_OBJECTCLASS_COLOR = "objectClassColor";
+
+    public static final String PREFERENCE_OBJECTCLASS_FONT = "objectClassFont";
+
+    public static final String PREFERENCE_MUSTATTRIBUTE_COLOR = "mustAttributeColor";
+
+    public static final String PREFERENCE_MUSTATTRIBUTE_FONT = "mustAttributeFont";
+
+    public static final String PREFERENCE_MAYATTRIBUTE_COLOR = "mayAttributeColor";
+
+    public static final String PREFERENCE_MAYATTRIBUTE_FONT = "mayAttributeFont";
+
+    public static final String PREFERENCE_OPERATIONALATTRIBUTE_COLOR = "operationalAttributeColor";
+
+    public static final String PREFERENCE_OPERATIONALATTRIBUTE_FONT = "operationalAttributeFont";
+
+    public static final String PREFERENCE_QUICKFILTER_BACKGROUND_COLOR = "quickfilterBackgroundColor";
+
+    public static final String PREFERENCE_QUICKFILTER_FOREGROUND_COLOR = "quickfilterForegroundColor";
+
+    public static final String PREFERENCE_QUICKFILTER_FONT = "quickfilterFont";
+
+    public static final String PREFERENCE_ERROR_FONT = "errorFont";
+
+    public static final String PREFERENCE_ERROR_COLOR = "errorColor";
+    
+    public static final String PREFERENCE_WARNING_FONT = "warningFont";
+
+    public static final String PREFERENCE_WARNING_COLOR = "warningColor";
+
+    public static final int SHOW_DN = 0;
+
+    public static final int SHOW_RDN = 1;
+
+    public static final int SHOW_RDN_VALUE = 2;
+    
+    public static final String PREFERENCEPAGEID_VALUEEDITORS = "org.apache.directory.ldapstudio.browser.ui.dialogs.preferences.ValueEditorsPreferencePage";
+
+    public static final String IMG_TEMPLATE = "resources/icons/template.gif";
+    
+    public static final String IMG_CLEAR = "resources/icons/clear.gif";
+
+    public static final String IMG_HEXEDITOR = "resources/icons/hexeditor.gif";
+
+    public static final String IMG_TEXTEDITOR = "resources/icons/texteditor.gif";
+    
+    public static final String IMG_INPLACE_TEXTEDITOR = "resources/icons/inplace_texteditor.gif";
+    
+    public static final String IMG_MULTIVALUEDEDITOR = "resources/icons/multivaluededitor.gif";
+    
+    public static final String IMG_PULLDOWN = "resources/icons/pulldown.gif";
+    
+    public static final String IMG_SORT = "resources/icons/sort.gif";
+
+    public static final String IMG_DIT = "resources/icons/dit.gif";
+    
+    public static final String IMG_ENTRY = "resources/icons/entry_default.gif";
+
+    public static final String IMG_ENTRY_ROOT = "resources/icons/entry_root.gif";
+
+    public static final String IMG_ENTRY_DC = "resources/icons/entry_dc.gif";
+
+    public static final String IMG_ENTRY_ORG = "resources/icons/entry_org.gif";
+
+    public static final String IMG_ENTRY_PERSON = "resources/icons/entry_person.gif";
+
+    public static final String IMG_ENTRY_GROUP = "resources/icons/entry_group.gif";
+
+    public static final String IMG_ENTRY_REF = "resources/icons/entry_ref.gif";
+
+    public static final String IMG_ENTRY_ALIAS = "resources/icons/entry_alias.gif";
+    
+    public static final String IMG_SEARCHES = "resources/icons/searches.gif";
+    
+    public static final String IMG_SEARCH = "resources/icons/search.gif";
+
+    public static final String IMG_SEARCH_UNPERFORMED = "resources/icons/search_unperformed.gif";
+
+    public static final String IMG_BOOKMARKS = "resources/icons/bookmarks.gif";
+
+    public static final String IMG_BOOKMARK = "resources/icons/bookmark.gif";
+
+    public static final String IMG_BROWSER_SCHEMABROWSEREDITOR = "resources/icons/browser_schemabrowsereditor.gif";
+
+    public static final String IMG_CONNECTION_ADD = "resources/icons/connection_add.gif";
+
+    public static final String IMG_CONNECTION_CONNECTED = "resources/icons/connection_connected.gif";
+
+    public static final String IMG_CONNECTION_DISCONNECTED = "resources/icons/connection_disconnected.gif";
+
+    public static final String IMG_CONNECTION_CONNECT = "resources/icons/connection_connect.gif";
+
+    public static final String IMG_CONNECTION_DISCONNECT = "resources/icons/connection_disconnect.gif";
+    
+    public static final String IMG_CONNECTION_WIZARD = "resources/icons/connection_wizard.gif";
+    
+    public static final String IMG_REFRESH = "resources/icons/refresh.gif";
+    
+    public static final String IMG_COLLAPSEALL = "resources/icons/collapseall.gif";
+    
+    public static final String IMG_FILTER_DIT = "resources/icons/filter_dit.gif";
+    
+    public static final String IMG_PARENT = "resources/icons/parent.gif";
+    
+    public static final String IMG_UNFILTER_DIT = "resources/icons/unfilter_dit.gif";
+    
+    public static final String IMG_FILTER = "resources/icons/filter.gif";
+
+    public static final String IMG_SORT_ASCENDING = "resources/icons/sort_ascending.gif";
+
+    public static final String IMG_SORT_DESCENDING = "resources/icons/sort_descending.gif";
+
+    public static final String IMG_VALUE_ADD = "resources/icons/value_add.gif";
+    
+    public static final String IMG_ATTRIBUTE_ADD = "resources/icons/attribute_add.gif";
+    
+    public static final String IMG_DELETE_ALL = "resources/icons/delete_all.gif";
+
+
+
+    
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonPreferencesInitializer.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonPreferencesInitializer.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonPreferencesInitializer.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,162 @@
+/*
+ *  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.common;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants;
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeValueProviderRelation;
+import org.apache.directory.ldapstudio.browser.core.model.schema.SyntaxValueProviderRelation;
+import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager;
+import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager.ValueEditorExtension;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * This class is used to set default preference values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserCommonPreferencesInitializer extends AbstractPreferenceInitializer
+{
+    /**
+     * {@inheritDoc}
+     */
+    public void initializeDefaultPreferences()
+    {
+
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+
+        // Common
+        store.setDefault( BrowserCommonConstants.PREFERENCE_COUNT_LIMIT, 1000 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_TIME_LIMIT, 0 );
+
+        // Colors and Fonts
+        RGB rgbBlack = Display.getDefault().getSystemColor( SWT.COLOR_BLACK ).getRGB();
+        RGB rgbRed = Display.getDefault().getSystemColor( SWT.COLOR_RED ).getRGB();
+        RGB rgbYellow = Display.getDefault().getSystemColor( SWT.COLOR_YELLOW ).getRGB();
+        FontData[] fontData = Display.getDefault().getSystemFont().getFontData();
+        FontData fontDataNormal = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.NORMAL );
+        FontData fontDataItalic = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.ITALIC );
+        FontData fontDataBold = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD );
+        FontData fontDataBoldItalic = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD
+            | SWT.ITALIC );
+        // Attributes colors and fonts
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_OBJECTCLASS_COLOR, rgbBlack );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_OBJECTCLASS_FONT, fontDataBoldItalic );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_COLOR, rgbBlack );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_FONT, fontDataBold );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_COLOR, rgbBlack );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_FONT, fontDataNormal );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_COLOR, rgbBlack );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT, fontDataItalic );
+        // Error/Warning colors and fonts
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_WARNING_FONT, fontDataBoldItalic );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_WARNING_COLOR, rgbYellow );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_ERROR_FONT, fontDataBoldItalic );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_ERROR_COLOR, rgbRed );
+        // Quick filter background colors and fonts
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_QUICKFILTER_FONT, fontDataBold );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_QUICKFILTER_BACKGROUND_COLOR, rgbYellow );
+        PreferenceConverter.setDefault( store, BrowserCommonConstants.PREFERENCE_QUICKFILTER_FOREGROUND_COLOR, rgbBlack );
+
+        // Attributes
+        store.setDefault( BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES, false );
+
+        // Value Editors
+        Collection<AttributeValueProviderRelation> avprs = new ArrayList<AttributeValueProviderRelation>();
+        Collection<SyntaxValueProviderRelation> svprs = new ArrayList<SyntaxValueProviderRelation>();
+        Collection<ValueEditorExtension> valueEditorProxys = ValueEditorManager.getValueEditorProxys();
+        for ( ValueEditorExtension proxy : valueEditorProxys )
+        {
+            for ( String attributeType : proxy.attributeTypes )
+            {
+                AttributeValueProviderRelation avpr = new AttributeValueProviderRelation( attributeType,
+                    proxy.className );
+                avprs.add( avpr );
+            }
+            for ( String syntaxOid : proxy.syntaxOids )
+            {
+                SyntaxValueProviderRelation svpr = new SyntaxValueProviderRelation( syntaxOid, proxy.className );
+                svprs.add( svpr );
+            }
+        }
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultAttributeValueProviderRelations(
+            avprs.toArray( new AttributeValueProviderRelation[0] ) );
+        BrowserCommonActivator.getDefault().getValueEditorsPreferences().setDefaultSyntaxValueProviderRelations(
+            svprs.toArray( new SyntaxValueProviderRelation[0] ) );
+
+        // Browser
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_EXPAND_BASE_ENTRIES, false );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_FOLDING_SIZE, 100 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_LABEL, BrowserCommonConstants.SHOW_RDN );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_ENTRY_ABBREVIATE_MAX_LENGTH, 50 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_LABEL, BrowserCommonConstants.SHOW_DN );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SEARCH_RESULT_ABBREVIATE_MAX_LENGTH, 50 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_DIT, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_SEARCHES, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_BOOKMARKS, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SHOW_DIRECTORY_META_ENTRIES, false );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_BY, BrowserCoreConstants.SORT_BY_RDN_VALUE );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_ORDER, BrowserCoreConstants.SORT_ORDER_ASCENDING );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_SORT_LIMIT, 10000 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_LEAF_ENTRIES_FIRST, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_BROWSER_META_ENTRIES_LAST, true );
+
+        // Entry Editor
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD, 10 );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES, false );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST, true );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY,
+            BrowserCoreConstants.SORT_BY_ATTRIBUTE_DESCRIPTION );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_ORDER,
+            BrowserCoreConstants.SORT_ORDER_ASCENDING );
+
+        
+
+        // Text Format
+        store.setDefault( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_ATTRIBUTEDELIMITER, "\t" );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_VALUEDELIMITER, "|" );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_QUOTECHARACTER, "\"" );
+        store
+            .setDefault( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_LINESEPARATOR, BrowserCoreConstants.LINE_SEPARATOR );
+        store.setDefault( BrowserCommonConstants.PREFERENCE_FORMAT_TABLE_BINARYENCODING,
+            BrowserCoreConstants.BINARYENCODING_IGNORE );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonReferralHandler.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonReferralHandler.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonReferralHandler.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/BrowserCommonReferralHandler.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,85 @@
+/*
+ *  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.common;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.ldapstudio.browser.common.dialogs.SelectReferralConnectionDialog;
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IReferralHandler;
+import org.apache.directory.ldapstudio.browser.core.model.URL;
+
+import org.eclipse.ui.PlatformUI;
+
+
+public class BrowserCommonReferralHandler implements IReferralHandler
+{
+
+    private Map referralUrlToReferralConnectionCache = new HashMap();
+
+
+    public IConnection getReferralConnection( final URL referralUrl )
+    {
+
+        // check cache
+        if ( referralUrlToReferralConnectionCache.containsKey( referralUrl ) )
+        {
+            IConnection referralConnection = ( IConnection ) referralUrlToReferralConnectionCache.get( referralUrl );
+            if ( referralConnection != null )
+            {
+                IConnection[] connections = BrowserCorePlugin.getDefault().getConnectionManager().getConnections();
+                for ( int i = 0; i < connections.length; i++ )
+                {
+                    IConnection connection = connections[i];
+                    if ( referralConnection == connection )
+                    {
+                        return referralConnection;
+                    }
+                }
+            }
+        }
+
+        referralUrlToReferralConnectionCache.remove( referralUrl );
+
+        // open dialog
+        final IConnection[] referralConnection = new IConnection[1];
+        PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
+        {
+            public void run()
+            {
+                SelectReferralConnectionDialog dialog = new SelectReferralConnectionDialog( PlatformUI.getWorkbench()
+                    .getDisplay().getActiveShell(), referralUrl );
+                if ( dialog.open() == SelectReferralConnectionDialog.OK )
+                {
+                    IConnection connection = dialog.getReferralConnection();
+                    referralUrlToReferralConnectionCache.put( referralUrl, connection );
+                    referralConnection[0] = connection;
+                }
+            }
+        } );
+
+        return referralConnection[0];
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/EventDispatcherSync.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/EventDispatcherSync.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/EventDispatcherSync.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/EventDispatcherSync.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,148 @@
+/*
+ *  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.common;
+
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+import org.apache.directory.ldapstudio.browser.core.events.EventDispatcher;
+import org.apache.directory.ldapstudio.browser.core.events.EventListener;
+import org.apache.directory.ldapstudio.browser.core.events.EventRunnable;
+import org.eclipse.swt.widgets.Display;
+
+
+public class EventDispatcherSync implements EventDispatcher
+{
+
+    private Set pauseEventFireringThreadList;
+
+    private Object lock;
+
+
+    public EventDispatcherSync()
+    {
+        this.pauseEventFireringThreadList = new HashSet();;
+        this.lock = new Object();
+    }
+
+
+    public void resumeEventFireingInCurrentThread()
+    {
+        this.pauseEventFireringThreadList.remove( Thread.currentThread() );
+    }
+
+
+    public void suspendEventFireingInCurrentThread()
+    {
+        this.pauseEventFireringThreadList.add( Thread.currentThread() );
+    }
+
+
+    public boolean isEventFireingSuspendInCurrentThread()
+    {
+        return this.pauseEventFireringThreadList.contains( Thread.currentThread() );
+    }
+
+
+    public void dispatchEvent( Object source, EventListener target, EventRunnable runnable )
+    {
+
+        SourceTargetRunnableWrapper strw = new SourceTargetRunnableWrapper( source, target, runnable );
+
+        if ( isEventFireingSuspendInCurrentThread() )
+        {
+            return;
+        }
+
+        synchronized ( lock )
+        {
+            this.runSourceTargetRunnableWrapper( strw );
+        }
+    }
+
+
+    public synchronized void startEventDispatcher()
+    {
+    }
+
+
+    public synchronized void stopEventDispatcher()
+    {
+    }
+
+
+    private void runSourceTargetRunnableWrapper( SourceTargetRunnableWrapper strw )
+    {
+        // System.out.println(strw.toString());
+        Display.getDefault().asyncExec( strw.runnable );
+        // Display.getDefault().syncExec(strw.runnable);
+    }
+
+    class SourceTargetRunnableWrapper
+    {
+        Object source;
+
+        EventListener target;
+
+        EventRunnable runnable;
+
+
+        SourceTargetRunnableWrapper( Object source, EventListener target, EventRunnable runnable )
+        {
+            this.source = source;
+            this.target = target;
+            this.runnable = runnable;
+        }
+
+
+        public boolean equals( Object o )
+        {
+            if ( o instanceof SourceTargetRunnableWrapper )
+            {
+                SourceTargetRunnableWrapper strw = ( SourceTargetRunnableWrapper ) o;
+                return strw.source == this.source
+                    && strw.target == this.target
+                    && strw.runnable.getClass() == this.runnable.getClass()
+                    && ( strw.runnable.getEventObject() == null || this.runnable.getEventObject() == null || strw.runnable
+                        .getEventObject().getClass() == this.runnable.getEventObject().getClass() );
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+
+        public int hashCode()
+        {
+            return this.source.hashCode() + this.target.hashCode() + this.runnable.getClass().hashCode();
+        }
+
+
+        public String toString()
+        {
+            return "" + source.getClass().getName() + " - " + target.getClass().getName();
+        }
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ExceptionHandler.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ExceptionHandler.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ExceptionHandler.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,71 @@
+/*
+ *  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.common;
+
+
+import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * This class is used to handle exceptions thrown at runtime.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExceptionHandler
+{
+    /**
+     * Opens an error dialog to display the given error.
+     *
+     * @param status
+     *      the error to show to the user
+     */
+    public void handleException( IStatus status )
+    {
+        display( null, status );
+    }
+
+
+    /**
+     * Opens an error dialog to display the given error.
+     *
+     * @param message
+     *      the message to show in this dialog, or null to indicate that the error's message should be shown as the primary message
+     * @param status
+     *      the error to show to the user
+     */
+    private void display( final String message, final IStatus status )
+    {
+        Runnable runnable = new Runnable()
+        {
+            public void run()
+            {
+                ErrorDialog.openError( Display.getDefault().getActiveShell(), "Error", message, status );
+            }
+        };
+        Display.getDefault().asyncExec( runnable );
+        BrowserCorePlugin.getDefault().getLog().log( status );
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ValueEditorsPreferences.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ValueEditorsPreferences.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ValueEditorsPreferences.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/ValueEditorsPreferences.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,266 @@
+/*
+ *  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.common;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeValueProviderRelation;
+import org.apache.directory.ldapstudio.browser.core.model.schema.SyntaxValueProviderRelation;
+import org.apache.directory.ldapstudio.browser.core.utils.Utils;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * This class is used to manage and access the preferences of the Value Editors Plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueEditorsPreferences
+{
+
+    /** The attribute value editor cache. */
+    private Map<String, String> attributeValueEditorCache;
+
+    /** The syntax value editor cache. */
+    private Map<String, String> syntaxValueEditorCache;
+
+    
+    /**
+     * Gets a Map containing all the Attribute Value Editors.
+     *
+     * @return
+     *      a Map containing all the Attribute Value Editors
+     */
+    public Map getAttributeValueEditorMap()
+    {
+        if ( attributeValueEditorCache == null )
+        {
+            attributeValueEditorCache = new HashMap<String, String>();
+            AttributeValueProviderRelation[] relations = getAttributeValueProviderRelations();
+            for ( int i = 0; i < relations.length; i++ )
+            {
+                if ( relations[i].getAttributeNumericOidOrType() != null )
+                {
+                    attributeValueEditorCache.put( relations[i].getAttributeNumericOidOrType()
+                        .toLowerCase(), relations[i].getValueProviderClassname() );
+                }
+            }
+        }
+        return attributeValueEditorCache;
+    }
+
+
+    /**
+     * Gets an array containing all the Attribute Value Provider Relations.
+     *
+     * @return
+     *      an array containing all the Attribute Value Provider Relations
+     */
+    public AttributeValueProviderRelation[] getAttributeValueProviderRelations()
+    {
+        AttributeValueProviderRelation[] avpr = ( AttributeValueProviderRelation[] ) load( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS );
+        return avpr;
+    }
+
+
+    /**
+     * Sets the Attribute Value Provider Relations.
+     *
+     * @param attributeValueProviderRelations
+     *      an array containing all the Attribute Value Provider Relations
+     */
+    public void setAttributeValueProviderRelations( AttributeValueProviderRelation[] attributeValueProviderRelations )
+    {
+        store( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS, attributeValueProviderRelations );
+        attributeValueEditorCache = null;
+    }
+
+
+    /**
+     * Gets the default Attribute Value Provider Relations.
+     *
+     * @return
+     *      an array containing all the default Attribute Value Provider Relations
+     */
+    public AttributeValueProviderRelation[] getDefaultAttributeValueProviderRelations()
+    {
+        AttributeValueProviderRelation[] avpr = ( AttributeValueProviderRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS );
+        return avpr;
+    }
+
+
+    /**
+     * Sets the default Attribute Value Provider Relations.
+     *
+     * @param attributeValueProviderRelations
+     *      an array containing all the default Attribute Value Provider Relations
+     */
+    public void setDefaultAttributeValueProviderRelations(
+        AttributeValueProviderRelation[] attributeValueProviderRelations )
+    {
+        storeDefault( BrowserCommonConstants.PREFERENCE_ATTRIBUTE_VALUEPROVIDER_RELATIONS, attributeValueProviderRelations );
+    }
+
+
+
+    /**
+     * Gets a Map containing all the Syntax Value Editors.
+     *
+     * @return
+     *      a Map containing all the Syntax Value Editors
+     */
+    public Map getSyntaxValueEditorMap()
+    {
+        if ( syntaxValueEditorCache == null )
+        {
+            syntaxValueEditorCache = new HashMap<String, String>();
+            SyntaxValueProviderRelation[] relations = getSyntaxValueProviderRelations();
+            for ( int i = 0; i < relations.length; i++ )
+            {
+                if ( relations[i].getSyntaxOID() != null )
+                {
+                    syntaxValueEditorCache.put( relations[i].getSyntaxOID().toLowerCase(), relations[i]
+                        .getValueProviderClassname() );
+                }
+            }
+        }
+        return syntaxValueEditorCache;
+    }
+
+
+    /**
+     * Sets the Syntax Value Provider Relations.
+     *
+     * @param syntaxValueProviderRelations
+     *      an array containing the Syntax Value Provider Relations to set
+     */
+    public void setSyntaxValueProviderRelations( SyntaxValueProviderRelation[] syntaxValueProviderRelations )
+    {
+        store( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS, syntaxValueProviderRelations );
+        syntaxValueEditorCache = null;
+    }
+
+
+    /**
+     * Gets an array containing all the Syntax Value Provider Relations
+     *
+     * @return
+     *      an array containing all the Syntax Value Provider Relations
+     */
+    public SyntaxValueProviderRelation[] getSyntaxValueProviderRelations()
+    {
+        SyntaxValueProviderRelation[] svpr = ( SyntaxValueProviderRelation[] ) load( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS );
+        return svpr;
+    }
+
+
+    /**
+     * Gets an array containing all the default Syntax Value Provider Relations
+     *
+     * @return
+     *      an array containing all the default Syntax Value Provider Relations
+     */
+    public SyntaxValueProviderRelation[] getDefaultSyntaxValueProviderRelations()
+    {
+        SyntaxValueProviderRelation[] svpr = ( SyntaxValueProviderRelation[] ) loadDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS );
+        return svpr;
+    }
+
+
+    /**
+     * Sets the default Syntax Value Provider Relations.
+     *
+     * @param syntaxValueProviderRelations
+     *      an array containing the default Syntax Value Provider Relations to set
+     */
+    public void setDefaultSyntaxValueProviderRelations( SyntaxValueProviderRelation[] syntaxValueProviderRelations )
+    {
+        storeDefault( BrowserCommonConstants.PREFERENCE_SYNTAX_VALUEPROVIDER_RELATIONS, syntaxValueProviderRelations );
+    }
+
+
+    /**
+     * Loads the current value of the string-valued property with the given name.
+     *
+     * @param key
+     *      the name of the property
+     * @return
+     *      the corresponding object
+     */
+    private static Object load( String key )
+    {
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getString( key );
+        return Utils.deserialize( s );
+    }
+
+
+    /**
+     * Stores the current value of the string-valued property with the given name.
+     *
+     * @param key
+     *      the name of the property
+     * @param o
+     *      the new current value of the property
+     */
+    private static void store( String key, Object o )
+    {
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = Utils.serialize( o );
+        store.setValue( key, s );
+    }
+
+
+    /**
+     * Loads the default value for the string-valued property with the given name.
+     *
+     * @param key
+     *      the name of the property
+     * @return
+     *      the default value of the named property
+     */
+    private static Object loadDefault( String key )
+    {
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = store.getDefaultString( key );
+        return Utils.deserialize( s );
+    }
+
+
+    /**
+     * Stores the default value for the string-valued property with the given name.
+     *
+     * @param key
+     *      the name of the property
+     * @param o
+     *      the new default value for the property
+     */
+    private static void storeDefault( String key, Object o )
+    {
+        IPreferenceStore store = BrowserCommonActivator.getDefault().getPreferenceStore();
+        String s = Utils.serialize( o );
+        store.setDefault( key, s );
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/BrowserAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/BrowserAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/BrowserAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/BrowserAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,680 @@
+/*
+ *  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.common.actions;
+
+
+import org.apache.directory.ldapstudio.browser.common.widgets.browser.BrowserCategory;
+import org.apache.directory.ldapstudio.browser.common.widgets.browser.BrowserEntryPage;
+import org.apache.directory.ldapstudio.browser.common.widgets.browser.BrowserSearchResultPage;
+import org.apache.directory.ldapstudio.browser.core.events.BookmarkUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.ConnectionUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.events.SearchUpdateEvent;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
+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.ISearchResult;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.LdifFile;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.LdifPart;
+import org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This abstract class must be extended by each Action related to the Browser.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class BrowserAction implements IWorkbenchWindowActionDelegate
+{
+    /** The selected Connections */
+    private IConnection[] selectedConnections;
+
+    /** The selected Browser View Categories */
+    private BrowserCategory[] selectedBrowserViewCategories;
+
+    /** The selected Entries */
+    private IEntry[] selectedEntries;
+
+    /** The selected Browser Entry Pages */
+    private BrowserEntryPage[] selectedBrowserEntryPages;
+
+    /** The selected Searches */
+    private ISearch[] selectedSearches;
+
+    /** The selected Search Results */
+    private ISearchResult[] selectedSearchResults;
+
+    /** The selected Browser Search Result Pages */
+    private BrowserSearchResultPage[] selectedBrowserSearchResultPages;
+
+    /** The selected Bookmarks */
+    private IBookmark[] selectedBookmarks;
+
+    /** The selected Attributes */
+    private IAttribute[] selectedAttributes;
+
+    /** The selected Attribute Hierarchies */
+    private AttributeHierarchy[] selectedAttributeHierarchies;
+
+    /** The selected Values */
+    private IValue[] selectedValues;
+
+    /** The selectec LDIF Model */
+    private LdifFile selectedLdifModel;
+
+    /** The selected LDIF Containers */
+    private LdifContainer[] selectedLdifContainers;
+
+    /** The selected LDIF Parts */
+    private LdifPart[] selectedLdifParts;
+
+    /** The input */
+    private Object input;
+
+
+    /**
+     * Creates a new instance of BrowserAction.
+     */
+    protected BrowserAction()
+    {
+        this.init();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        this.init();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run( IAction action )
+    {
+        this.run();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        setSelectedConnections( SelectionUtils.getConnections( selection ) );
+
+        setSelectedBrowserViewCategories( SelectionUtils.getBrowserViewCategories( selection ) );
+        setSelectedEntries( SelectionUtils.getEntries( selection ) );
+        setSelectedBrowserEntryPages( SelectionUtils.getBrowserEntryPages( selection ) );
+        setSelectedSearchResults( SelectionUtils.getSearchResults( selection ) );
+        setSelectedBrowserSearchResultPages( SelectionUtils.getBrowserSearchResultPages( selection ) );
+        setSelectedBookmarks( SelectionUtils.getBookmarks( selection ) );
+
+        setSelectedSearches( SelectionUtils.getSearches( selection ) );
+
+        setSelectedAttributes( SelectionUtils.getAttributes( selection ) );
+        setSelectedAttributeHierarchies( SelectionUtils.getAttributeHierarchie( selection ) );
+        setSelectedValues( SelectionUtils.getValues( selection ) );
+
+        action.setEnabled( this.isEnabled() );
+        action.setText( this.getText() );
+        action.setToolTipText( this.getText() );
+    }
+
+
+    /**
+     * Returns the text for this action.
+     * <p>
+     * This method is associated with the <code>TEXT</code> property;
+     * property change events are reported when its value changes.
+     * </p>
+     *
+     * @return the text, or <code>null</code> if none
+     * @see #TEXT
+     */
+    public abstract String getText();
+
+
+    /**
+     * Returns the image for this action as an image descriptor.
+     * <p>
+     * This method is associated with the <code>IMAGE</code> property;
+     * property change events are reported when its value changes.
+     * </p>
+     *
+     * @return the image, or <code>null</code> if this action has no image
+     * @see #IMAGE
+     */
+    public abstract ImageDescriptor getImageDescriptor();
+
+
+    /**
+     * Returns the command identifier.
+     *
+     * @return
+     *      the command identifier
+     */
+    public abstract String getCommandId();
+
+
+    /**
+     * Returns whether this action is enabled.
+     * <p>
+     * This method is associated with the <code>ENABLED</code> property;
+     * property change events are reported when its value changes.
+     * </p>
+     *
+     * @return <code>true</code> if enabled, and
+     *   <code>false</code> if disabled
+     * @see #ENABLED
+     */
+    public abstract boolean isEnabled();
+
+
+    /**
+     * Runs this action.
+     * Each action implementation must define the steps needed to carry out this action.
+     * The default implementation of this method in <code>Action</code>
+     * does nothing.
+     */
+    public abstract void run();
+
+
+    /**
+     * Initializes this action
+     */
+    private void init()
+    {
+        this.selectedConnections = new IConnection[0];
+        this.selectedBrowserViewCategories = new BrowserCategory[0];
+        this.selectedEntries = new IEntry[0];
+        this.selectedBrowserEntryPages = new BrowserEntryPage[0];
+        this.selectedSearches = new ISearch[0];
+        this.selectedSearchResults = new ISearchResult[0];
+        this.selectedBrowserSearchResultPages = new BrowserSearchResultPage[0];
+        this.selectedBookmarks = new IBookmark[0];
+        this.selectedAttributes = new IAttribute[0];
+        this.selectedAttributeHierarchies = new AttributeHierarchy[0];
+        this.selectedValues = new IValue[0];
+
+        this.selectedLdifModel = null;
+        this.selectedLdifContainers = new LdifContainer[0];
+        this.selectedLdifParts = new LdifPart[0];
+
+        this.input = null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        this.selectedConnections = new IConnection[0];
+        this.selectedBrowserViewCategories = new BrowserCategory[0];
+        this.selectedEntries = new IEntry[0];
+        this.selectedBrowserEntryPages = new BrowserEntryPage[0];
+        this.selectedSearches = new ISearch[0];
+        this.selectedSearchResults = new ISearchResult[0];
+        this.selectedBrowserSearchResultPages = new BrowserSearchResultPage[0];
+        this.selectedBookmarks = new IBookmark[0];
+        this.selectedAttributes = new IAttribute[0];
+        this.selectedAttributeHierarchies = new AttributeHierarchy[0];
+        this.selectedValues = new IValue[0];
+
+        this.selectedLdifModel = null;
+        this.selectedLdifContainers = new LdifContainer[0];
+        this.selectedLdifParts = new LdifPart[0];
+
+        this.input = null;
+    }
+
+
+    /**
+     * Returns the current active shell
+     *
+     * @return
+     *      the current active shell
+     */
+    protected Shell getShell()
+    {
+        return PlatformUI.getWorkbench().getDisplay().getActiveShell();
+    }
+
+
+    /**
+     * This method is fired when an Entry is updated.
+     *
+     * @param event
+     *      the associated event
+     */
+    public final void entryUpdated( EntryModificationEvent event )
+    {
+    }
+
+
+    /**
+     * This method is fired when a Search is updated.
+     *
+     * @param searchUpdateEvent
+     *      the associated event
+     */
+    public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
+    {
+    }
+
+
+    /**
+     * This method is fired when a Bookmark is updated.
+     *
+     * @param bookmarkUpdateEvent
+     *      the associated event
+     */
+    public void bookmarkUpdated( BookmarkUpdateEvent bookmarkUpdateEvent )
+    {
+    }
+
+
+    /**
+     * This method is fired when a Connection is updated.
+     *
+     * @param connectionUpdateEvent
+     *      the associated event
+     */
+    public final void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
+    {
+    }
+
+
+    /**
+     * Gets the selected Attributes.
+     *
+     * @return
+     *      the selected attributes
+     */
+    public IAttribute[] getSelectedAttributes()
+    {
+        return selectedAttributes;
+    }
+
+
+    /**
+     * Sets the selected Attributes.
+     *
+     * @param selectedAttributes
+     *      the selected attributes to set
+     */
+    public void setSelectedAttributes( IAttribute[] selectedAttributes )
+    {
+        this.selectedAttributes = selectedAttributes;
+    }
+
+
+    /**
+     * Gets the selected Bookmarks.
+     *
+     * @return
+     *      the selected Bookmarks
+     */
+    public IBookmark[] getSelectedBookmarks()
+    {
+        return selectedBookmarks;
+    }
+
+
+    /**
+     * Sets the selected Bookmarks.
+     *
+     * @param selectedBookmarks
+     *      the selected Bookmarks to set
+     */
+    public void setSelectedBookmarks( IBookmark[] selectedBookmarks )
+    {
+        this.selectedBookmarks = selectedBookmarks;
+    }
+
+
+    /**
+     * Gets the selected Browser View categories.
+     *
+     * @return
+     *      the selected Browser View categories
+     */
+    public BrowserCategory[] getSelectedBrowserViewCategories()
+    {
+        return selectedBrowserViewCategories;
+    }
+
+
+    /**
+     * Sets the selected Browser View categories.
+     *
+     * @param selectedBrowserViewCategories
+     *      the selected Browser View categories to set
+     */
+    public void setSelectedBrowserViewCategories( BrowserCategory[] selectedBrowserViewCategories )
+    {
+        this.selectedBrowserViewCategories = selectedBrowserViewCategories;
+    }
+
+
+    /**
+     * Gets the selected Connections.
+     *
+     * @return
+     *      the selected Connections
+     */
+    public IConnection[] getSelectedConnections()
+    {
+        return selectedConnections;
+    }
+
+
+    /**
+     * Sets the selected Connections.
+     *
+     * @param selectedConnections
+     *      the selected Connections to set
+     */
+    public void setSelectedConnections( IConnection[] selectedConnections )
+    {
+        this.selectedConnections = selectedConnections;
+    }
+
+
+    /**
+     * Get the selected Entries.
+     *
+     * @return
+     */
+    public IEntry[] getSelectedEntries()
+    {
+        return selectedEntries;
+    }
+
+
+    /**
+     * Sets the selected Entries.
+     *
+     * @param selectedEntries
+     *      the selected Entries to set
+     */
+    public void setSelectedEntries( IEntry[] selectedEntries )
+    {
+        this.selectedEntries = selectedEntries;
+    }
+
+
+    /**
+     * Gets the selected Searches.
+     *
+     * @return
+     *      the selected Searches
+     */
+    public ISearch[] getSelectedSearches()
+    {
+        return selectedSearches;
+    }
+
+
+    /**
+     * Sets the selected Searches.
+     *
+     * @param selectedSearches
+     *      the selected Searches to set
+     */
+    public void setSelectedSearches( ISearch[] selectedSearches )
+    {
+        this.selectedSearches = selectedSearches;
+    }
+
+
+    /**
+     * Gets the selected Search Results.
+     *
+     * @return
+     *      the selected Search Results
+     */
+    public ISearchResult[] getSelectedSearchResults()
+    {
+        return selectedSearchResults;
+    }
+
+
+    /**
+     * Sets the selected Search Results.
+     *
+     * @param selectedSearchResults
+     *      the selected Search Results to set
+     */
+    public void setSelectedSearchResults( ISearchResult[] selectedSearchResults )
+    {
+        this.selectedSearchResults = selectedSearchResults;
+    }
+
+
+    /**
+     * Gets the selected Values.
+     *
+     * @return
+     *      the selected Values
+     */
+    public IValue[] getSelectedValues()
+    {
+        return selectedValues;
+    }
+
+
+    /**
+     * Sets the selected Values.
+     *
+     * @param selectedValues
+     *      the selected values to set
+     */
+    public void setSelectedValues( IValue[] selectedValues )
+    {
+        this.selectedValues = selectedValues;
+    }
+
+
+    /**
+     * Gets the input.
+     *
+     * @return
+     *      the input
+     */
+    public Object getInput()
+    {
+        return input;
+    }
+
+
+    /**
+     * Sets the input.
+     *
+     * @param input
+     *      the input to set
+     */
+    public void setInput( Object input )
+    {
+        this.input = input;
+    }
+
+
+    /**
+     * Gets the selected LDIF Containers.
+     *
+     * @return
+     *      the selected LDIF Containers
+     */
+    public LdifContainer[] getSelectedLdifContainers()
+    {
+        return selectedLdifContainers;
+    }
+
+
+    /**
+     * Sets the selected LDIF Containers.
+     *
+     * @param selectedLdifContainers
+     *      the selected LDIF Containers to set
+     */
+    public void setSelectedLdifContainers( LdifContainer[] selectedLdifContainers )
+    {
+        this.selectedLdifContainers = selectedLdifContainers;
+    }
+
+
+    /**
+     * Gets the selected LDIF Model.
+     * 
+     * @return
+     *      the selected LDIF Model
+     */
+    public LdifFile getSelectedLdifModel()
+    {
+        return selectedLdifModel;
+    }
+
+
+    /**
+     * Sets the selected LDIF Model.
+     *
+     * @param selectedLdifModel
+     *      the selected LDIF Model to set
+     */
+    public void setSelectedLdifModel( LdifFile selectedLdifModel )
+    {
+        this.selectedLdifModel = selectedLdifModel;
+    }
+
+
+    /**
+     * Gets the selected LDIF Parts.
+     *
+     * @return
+     *      the selected LDIF Parts
+     */
+    public LdifPart[] getSelectedLdifParts()
+    {
+        return selectedLdifParts;
+    }
+
+
+    /**
+     * Sets the selected LDIF Parts.
+     *
+     * @param selectedLdifParts
+     *      the selected LDIF Parts to set
+     */
+    public void setSelectedLdifParts( LdifPart[] selectedLdifParts )
+    {
+        this.selectedLdifParts = selectedLdifParts;
+    }
+
+
+    /**
+     * Gets the selected Browser Entry Pages.
+     *
+     * @return
+     *      the selected Browser Entru Pages
+     */
+    public BrowserEntryPage[] getSelectedBrowserEntryPages()
+    {
+        return selectedBrowserEntryPages;
+    }
+
+
+    /**
+     * Sets the selected Browser Entry Pages.
+     *
+     * @param selectedBrowserEntryPages
+     *      the selected Browser Entry Pages to set
+     */
+    public void setSelectedBrowserEntryPages( BrowserEntryPage[] selectedBrowserEntryPages )
+    {
+        this.selectedBrowserEntryPages = selectedBrowserEntryPages;
+    }
+
+
+    /**
+     * Gets the selected Browser Search Result Pages.
+     *
+     * @return
+     *      the selected Browser Search Result Pages
+     */
+    public BrowserSearchResultPage[] getSelectedBrowserSearchResultPages()
+    {
+        return selectedBrowserSearchResultPages;
+    }
+
+
+    /**
+     * Sets the selected Browser Search Result Pages.
+     *
+     * @param selectedBrowserSearchResultPages
+     *      the selected Browser Search result Pages to set
+     */
+    public void setSelectedBrowserSearchResultPages( BrowserSearchResultPage[] selectedBrowserSearchResultPages )
+    {
+        this.selectedBrowserSearchResultPages = selectedBrowserSearchResultPages;
+    }
+
+
+    /**
+     * Gets the selected Attribute Hierarchies.
+     *
+     * @return
+     *      the selected Attribute Hierarchies
+     */
+    public AttributeHierarchy[] getSelectedAttributeHierarchies()
+    {
+        return selectedAttributeHierarchies;
+    }
+
+
+    /**
+     * Sets the selected Attribute Hierarchies.
+     *
+     * @param ahs
+     *      the selected Attribute Hierarchies to set
+     */
+    public void setSelectedAttributeHierarchies( AttributeHierarchy[] ahs )
+    {
+        this.selectedAttributeHierarchies = ahs;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CloseConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CloseConnectionAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CloseConnectionAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CloseConnectionAction.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.browser.common.actions;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * This action closes the selected Connection(s).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CloseConnectionAction extends BrowserAction
+{
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( getSelectedConnections()[i].canClose() )
+            {
+                getSelectedConnections()[i].close();
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return getSelectedConnections().length > 1 ? "Close Connections" : "Close Connection";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_CONNECTION_DISCONNECT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    public boolean isEnabled()
+    {
+        boolean canClose = false;
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( getSelectedConnections()[i].canClose() )
+            {
+                canClose = true;
+                break;
+            }
+        }
+        return getSelectedConnections().length > 0 && canClose;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CollapseAllAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CollapseAllAction.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CollapseAllAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/browser/common/actions/CollapseAllAction.java Mon Apr  9 02:49:48 2007
@@ -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.common.actions;
+
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * This action collapses all nodes of the viewer's tree, starting with the root.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CollapseAllAction extends Action
+{
+    protected TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of CollapseAllAction.
+     *
+     * @param viewer
+     *      the attached Viewer
+     */
+    public CollapseAllAction( TreeViewer viewer )
+    {
+        super( "Collapse All", BrowserCommonActivator.getDefault().getImageDescriptor( BrowserCommonConstants.IMG_COLLAPSEALL ) );
+        super.setToolTipText( getText() );
+        super.setEnabled( true );
+
+        this.viewer = viewer;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        this.viewer.collapseAll();
+    }
+
+
+    /**
+     * Disposes the action delegate.
+     */
+    public void dispose()
+    {
+        this.viewer = null;
+    }
+}



Mime
View raw message