directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592087 [9/16] - in /directory/sandbox/felixk/studio-ldapbrowser-ui: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/...
Date Mon, 05 Nov 2007 17:01:46 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,526 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.actions.CopyAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.NewValueAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.PropertiesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.RefreshAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.ShowRawValuesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.ValueEditorPreferencesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.BrowserActionProxy;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopyAttributeDescriptionAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopyDnAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopyEntryAsCsvAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopySearchFilterAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopyUrlAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.CopyValueAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.LocateDnInDitAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.NewBatchOperationAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.NewSearchAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSchemaBrowserAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSearchResultAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.proxy.SearchResultEditorActionProxy;
+import org.apache.directory.studio.valueeditors.IValueEditor;
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ContributionItemFactory;
+import org.eclipse.ui.commands.ICommandService;
+
+
+public class SearchResultEditorActionGroup implements ActionHandlerManager, IMenuListener
+{
+
+    private ShowDNAction showDNAction;
+
+    private ShowLinksAction showLinksAction;
+
+    private ShowRawValuesAction showRawValuesAction;
+
+    private OpenSearchResultEditorPreferencePage openSearchResultEditorPreferencePage;
+
+    private ShowQuickFilterAction showQuickFilterAction;
+    
+    /** The open default editor action. */
+    private SearchResultEditorActionProxy openDefaultValueEditorActionProxy;
+
+    /** The open best editor action. */
+    private SearchResultEditorActionProxy openBestValueEditorActionProxy;
+
+    /** The open editor actions. */
+    private SearchResultEditorActionProxy[] openValueEditorActionProxies;
+    
+
+    private ValueEditorPreferencesAction openValueEditorPreferencesAction;
+
+    private static final String copyTableAction = "copyTableAction";
+
+    private static final String refreshSearchAction = "refreshSearchAction";
+
+    private final static String newValueAction = "newValueAction";
+
+    private final static String newSearchAction = "newSearchAction";
+
+    private static final String newBatchOperationAction = "newBatchOperationAction";
+
+    private final static String copyAction = "copyAction";
+
+    private final static String pasteAction = "pasteAction";
+
+    private final static String deleteAction = "deleteAction";
+
+    private static final String copyDnAction = "copyDnAction";
+
+    private static final String copyUrlAction = "copyUrlAction";
+
+    private static final String copyAttriuteDescriptionAction = "copyAttriuteDescriptionAction";
+
+    private static final String copyValueUtf8Action = "copyValueUtf8Action";
+
+    private static final String copyValueBase64Action = "copyValueBase64Action";
+
+    private static final String copyValueHexAction = "copyValueHexAction";
+
+    private static final String copyValueAsLdifAction = "copyValueAsLdifAction";
+
+    private static final String copySearchFilterAction = "copySearchFilterAction";
+
+    private static final String copyNotSearchFilterAction = "copyNotSearchFilterAction";
+
+    private static final String copyAndSearchFilterAction = "copyAndSearchFilterAction";
+
+    private static final String copyOrSearchFilterAction = "copyOrSearchFilterAction";
+
+    private static final String openSearchResultAction = "showEntryInSearchResultsAction";
+
+    private static final String locateDnInDitAction = "locateDnInDitAction";
+
+    private static final String showOcdAction = "showOcdAction";
+
+    private static final String showAtdAction = "showAtdAction";
+
+    private static final String showEqualityMrdAction = "showEqualityMrdAction";
+
+    private static final String showSubstringMrdAction = "showSubstringMrdAction";
+
+    private static final String showOrderingMrdAction = "showOrderingMrdAction";
+
+    private static final String showLsdAction = "showLsdAction";
+
+    private final static String propertyDialogAction = "propertyDialogAction";
+
+    private Map searchResultEditorActionMap;
+
+    private IActionBars actionBars;
+
+    private SearchResultEditor searchResultEditor;
+
+
+    public SearchResultEditorActionGroup( SearchResultEditor searchResultEditor )
+    {
+        this.searchResultEditor = searchResultEditor;
+        this.searchResultEditorActionMap = new HashMap();
+
+        TableViewer viewer = searchResultEditor.getMainWidget().getViewer();
+        SearchResultEditorCursor cursor = searchResultEditor.getConfiguration().getCursor( viewer );
+        ValueEditorManager valueEditorManager = searchResultEditor.getConfiguration().getValueEditorManager( viewer );
+
+        this.showDNAction = new ShowDNAction();
+        this.showLinksAction = new ShowLinksAction();
+        this.showRawValuesAction = new ShowRawValuesAction();
+        this.openSearchResultEditorPreferencePage = new OpenSearchResultEditorPreferencePage();
+        this.showQuickFilterAction = new ShowQuickFilterAction( searchResultEditor.getMainWidget()
+            .getQuickFilterWidget() );
+
+        openBestValueEditorActionProxy = new SearchResultEditorActionProxy( cursor, this, new OpenBestEditorAction(
+            viewer, cursor, valueEditorManager ) );
+        openDefaultValueEditorActionProxy = new SearchResultEditorActionProxy( cursor, this,
+            new OpenDefaultEditorAction( viewer, cursor, valueEditorManager, openBestValueEditorActionProxy ) );
+        IValueEditor[] valueEditors = searchResultEditor.getConfiguration().getValueEditorManager( viewer )
+            .getAllValueEditors();
+        openValueEditorActionProxies = new SearchResultEditorActionProxy[valueEditors.length];
+        for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+        {
+            openValueEditorActionProxies[i] = new SearchResultEditorActionProxy( cursor, this, new OpenEditorAction( viewer, cursor,
+                valueEditorManager, valueEditors[i] ) );
+        }        
+        this.openValueEditorPreferencesAction = new ValueEditorPreferencesAction();
+
+        this.searchResultEditorActionMap.put( copyTableAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyEntryAsCsvAction( CopyEntryAsCsvAction.MODE_TABLE ) ) );
+        this.searchResultEditorActionMap.put( refreshSearchAction, new SearchResultEditorActionProxy( cursor,
+            this, new RefreshAction() ) );
+
+        this.searchResultEditorActionMap.put( newValueAction, new SearchResultEditorActionProxy( cursor,
+            this, new NewValueAction() ) );
+        this.searchResultEditorActionMap.put( newSearchAction, new SearchResultEditorActionProxy( cursor,
+            this, new NewSearchAction() ) );
+        this.searchResultEditorActionMap.put( newBatchOperationAction, new SearchResultEditorActionProxy( cursor,
+            this, new NewBatchOperationAction() ) );
+
+        this.searchResultEditorActionMap.put( locateDnInDitAction, new SearchResultEditorActionProxy( cursor,
+            this, new LocateDnInDitAction() ) );
+        this.searchResultEditorActionMap.put( openSearchResultAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSearchResultAction() ) );
+
+        this.searchResultEditorActionMap.put( showOcdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_OBJECTCLASS ) ) );
+        this.searchResultEditorActionMap.put( showAtdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_ATTRIBUTETYPE ) ) );
+        this.searchResultEditorActionMap.put( showEqualityMrdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_EQUALITYMATCHINGRULE ) ) );
+        this.searchResultEditorActionMap.put( showSubstringMrdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_SUBSTRINGMATCHINGRULE ) ) );
+        this.searchResultEditorActionMap.put( showOrderingMrdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_ORDERINGMATCHINGRULE ) ) );
+        this.searchResultEditorActionMap.put( showLsdAction, new SearchResultEditorActionProxy( cursor,
+            this, new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_SYNTAX ) ) );
+
+        this.searchResultEditorActionMap.put( pasteAction, new SearchResultEditorActionProxy( cursor,
+            this, new SearchResultEditorPasteAction() ) );
+        this.searchResultEditorActionMap.put( copyAction, new SearchResultEditorActionProxy( cursor, this, new CopyAction(
+            ( BrowserActionProxy ) this.searchResultEditorActionMap.get( pasteAction ) ) ) );
+        this.searchResultEditorActionMap.put( deleteAction, new SearchResultEditorActionProxy( cursor,
+            this, new SearchResultDeleteAction() ) );
+
+        this.searchResultEditorActionMap.put( copyDnAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyDnAction() ) );
+        this.searchResultEditorActionMap.put( copyUrlAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyUrlAction() ) );
+        this.searchResultEditorActionMap.put( copyAttriuteDescriptionAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyAttributeDescriptionAction() ) );
+        this.searchResultEditorActionMap.put( copyValueUtf8Action, new SearchResultEditorActionProxy( cursor,
+            this, new CopyValueAction( CopyValueAction.MODE_UTF8 ) ) );
+        this.searchResultEditorActionMap.put( copyValueBase64Action, new SearchResultEditorActionProxy( cursor,
+            this, new CopyValueAction( CopyValueAction.MODE_BASE64 ) ) );
+        this.searchResultEditorActionMap.put( copyValueHexAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyValueAction( CopyValueAction.MODE_HEX ) ) );
+        this.searchResultEditorActionMap.put( copyValueAsLdifAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopyValueAction( CopyValueAction.MODE_LDIF ) ) );
+
+        this.searchResultEditorActionMap.put( copySearchFilterAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopySearchFilterAction( CopySearchFilterAction.MODE_EQUALS ) ) );
+        this.searchResultEditorActionMap.put( copyNotSearchFilterAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopySearchFilterAction( CopySearchFilterAction.MODE_NOT ) ) );
+        this.searchResultEditorActionMap.put( copyAndSearchFilterAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopySearchFilterAction( CopySearchFilterAction.MODE_AND ) ) );
+        this.searchResultEditorActionMap.put( copyOrSearchFilterAction, new SearchResultEditorActionProxy( cursor,
+            this, new CopySearchFilterAction( CopySearchFilterAction.MODE_OR ) ) );
+
+        this.searchResultEditorActionMap.put( propertyDialogAction, new SearchResultEditorActionProxy( cursor,
+            this, new PropertiesAction() ) );
+    }
+
+
+    public void dispose()
+    {
+
+        if ( this.searchResultEditor != null )
+        {
+            this.showRawValuesAction = null;
+            this.showDNAction.dispose();
+            this.showDNAction = null;
+            this.showLinksAction.dispose();
+            this.showLinksAction = null;
+            this.openSearchResultEditorPreferencePage = null;
+            this.showQuickFilterAction.dispose();
+            this.showQuickFilterAction = null;
+            
+            openDefaultValueEditorActionProxy.dispose();
+            openDefaultValueEditorActionProxy = null;
+            openBestValueEditorActionProxy.dispose();
+            openBestValueEditorActionProxy = null;
+            for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+            {
+                openValueEditorActionProxies[i].dispose();
+                openValueEditorActionProxies[i] = null;
+            }
+            this.openValueEditorPreferencesAction = null;
+
+            for ( Iterator it = this.searchResultEditorActionMap.keySet().iterator(); it.hasNext(); )
+            {
+                String key = ( String ) it.next();
+                SearchResultEditorActionProxy action = ( SearchResultEditorActionProxy ) this.searchResultEditorActionMap
+                    .get( key );
+                action.dispose();
+                action = null;
+                it.remove();
+            }
+            this.searchResultEditorActionMap.clear();
+            this.searchResultEditorActionMap = null;
+
+            this.actionBars = null;
+            this.searchResultEditor = null;
+        }
+    }
+
+
+    public void fillToolBar( IToolBarManager toolBarManager )
+    {
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( newValueAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyTableAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( this.showQuickFilterAction );
+        toolBarManager.update( true );
+    }
+
+
+    public void fillMenu( IMenuManager menuManager )
+    {
+        menuManager.add( this.showDNAction );
+        menuManager.add( this.showLinksAction );
+        menuManager.add( this.showRawValuesAction );
+        menuManager.add( new Separator() );
+        menuManager.add( this.openSearchResultEditorPreferencePage );
+        menuManager.addMenuListener( new IMenuListener()
+        {
+            public void menuAboutToShow( IMenuManager manager )
+            {
+                showRawValuesAction.setChecked( BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+                    BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
+            }
+        } );
+        menuManager.update( true );
+    }
+
+
+    public void enableGlobalActionHandlers( IActionBars actionBars )
+    {
+        this.actionBars = actionBars;
+        this.activateGlobalActionHandlers();
+    }
+
+
+    public void fillContextMenu( IMenuManager menuManager )
+    {
+        menuManager.setRemoveAllWhenShown( true );
+        menuManager.addMenuListener( this );
+    }
+
+
+    public void menuAboutToShow( IMenuManager menuManager )
+    {
+        // new
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newValueAction ) );
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newSearchAction ) );
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newBatchOperationAction ) );
+        menuManager.add( new Separator() );
+
+        // navigation
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction ) );
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction ) );
+        MenuManager schemaMenuManager = new MenuManager( "Open Schema Browser" );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showOcdAction ) );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showAtdAction ) );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showEqualityMrdAction ) );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showSubstringMrdAction ) );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showOrderingMrdAction ) );
+        schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showLsdAction ) );
+        menuManager.add( schemaMenuManager );
+        MenuManager showInSubMenu = new MenuManager( "Show In" );
+        showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN.create( PlatformUI.getWorkbench()
+            .getActiveWorkbenchWindow() ) );
+        menuManager.add( showInSubMenu );
+        menuManager.add( new Separator() );
+
+        // copy, paste, delete
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAction ) );
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( pasteAction ) );
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) );
+        MenuManager advancedMenuManager = new MenuManager( "Advanced" );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyDnAction ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyUrlAction ) );
+        advancedMenuManager.add( new Separator() );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAttriuteDescriptionAction ) );
+        advancedMenuManager.add( new Separator() );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueUtf8Action ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueBase64Action ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueHexAction ) );
+        advancedMenuManager.add( new Separator() );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueAsLdifAction ) );
+        advancedMenuManager.add( new Separator() );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copySearchFilterAction ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyNotSearchFilterAction ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAndSearchFilterAction ) );
+        advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyOrSearchFilterAction ) );
+        menuManager.add( advancedMenuManager );
+        menuManager.add( new Separator() );
+
+        // edit
+        menuManager.add( openDefaultValueEditorActionProxy );
+        MenuManager editorMenuManager = new MenuManager( "Edit Value With" );
+        if ( openBestValueEditorActionProxy.isEnabled() )
+        {
+            editorMenuManager.add( openBestValueEditorActionProxy );
+            editorMenuManager.add( new Separator() );
+        }
+        for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+        {
+            if ( openValueEditorActionProxies[i].isEnabled()
+                && ( ( OpenEditorAction ) openValueEditorActionProxies[i].getAction() ).getValueEditor().getClass() != ( ( OpenBestEditorAction ) openBestValueEditorActionProxy
+                    .getAction() ).getBestValueEditor().getClass() )
+            {
+                editorMenuManager.add( openValueEditorActionProxies[i] );
+            }
+        }
+        editorMenuManager.add( new Separator() );
+        editorMenuManager.add( this.openValueEditorPreferencesAction );
+        menuManager.add( editorMenuManager );
+        menuManager.add( new Separator() );
+
+        // refresh
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) );
+        menuManager.add( new Separator() );
+
+        // additions
+        menuManager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
+
+        // / properties
+        menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( propertyDialogAction ) );
+    }
+
+
+    public void activateGlobalActionHandlers()
+    {
+        if ( this.actionBars != null )
+        {
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) this.searchResultEditorActionMap
+                .get( copyAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(),
+                ( IAction ) this.searchResultEditorActionMap.get( pasteAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(),
+                ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(),
+                ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(),
+                ( IAction ) this.searchResultEditorActionMap.get( propertyDialogAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), this.showQuickFilterAction );
+            actionBars.updateActionBars();
+        }
+
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
+            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) );
+            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
+            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) );
+            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
+            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( new ActionHandler( osr ) );
+            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler(
+                new ActionHandler( openDefaultValueEditorActionProxy ) );
+        }
+    }
+
+
+    public void deactivateGlobalActionHandlers()
+    {
+        if ( this.actionBars != null )
+        {
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), null );
+            actionBars.updateActionBars();
+        }
+
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
+            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null );
+            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
+            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null );
+            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
+            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( null );
+            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler( null );
+        }
+    }
+
+
+    public OpenBestEditorAction getOpenBestEditorAction()
+    {
+        return ( OpenBestEditorAction ) openBestValueEditorActionProxy.getAction();
+    }
+
+
+    public void setInput( ISearch search )
+    {
+        for ( Iterator it = this.searchResultEditorActionMap.values().iterator(); it.hasNext(); )
+        {
+            SearchResultEditorActionProxy action = ( SearchResultEditorActionProxy ) it.next();
+            action.inputChanged( search );
+        }
+    }
+
+
+    public boolean isEditorActive()
+    {
+        if ( ((AbstractOpenEditorAction)openDefaultValueEditorActionProxy.getAction()).isActive() )
+        {
+            return true;
+        }
+        if ( ((AbstractOpenEditorAction)openBestValueEditorActionProxy.getAction()).isActive() )
+        {
+            return true;
+        }
+        for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+        {
+            if ( ((AbstractOpenEditorAction)openValueEditorActionProxies[i].getAction()).isActive() )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,179 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Item;
+
+
+public class SearchResultEditorCellModifier implements ICellModifier
+{
+
+    private TableViewer viewer;
+
+    private ValueEditorManager valueEditorManager;
+
+
+    public SearchResultEditorCellModifier( TableViewer viewer, ValueEditorManager valueEditorManager )
+    {
+        this.viewer = viewer;
+        this.valueEditorManager = valueEditorManager;
+    }
+
+
+    public void dispose()
+    {
+        this.viewer = null;
+        this.valueEditorManager = null;
+    }
+
+
+    public boolean canModify( Object element, String property )
+    {
+
+        if ( element != null && element instanceof ISearchResult && property != null )
+        {
+            ISearchResult result = ( ISearchResult ) element;
+            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+
+            // check DN
+            if ( BrowserUIConstants.DN.equals( property ) )
+            {
+                return false;
+            }
+
+            // attribute dummy
+            if ( ah == null )
+            {
+                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
+                    { new Attribute( result.getEntry(), property ) } );
+            }
+
+            // check schema modifyable
+            boolean isOneModifyable = false;
+            for ( Iterator it = ah.iterator(); it.hasNext(); )
+            {
+                IAttribute attribute = ( IAttribute ) it.next();
+                if ( SchemaUtils.isModifyable( attribute.getAttributeTypeDescription() ) )
+                {
+                    isOneModifyable = true;
+                    break;
+                }
+            }
+            if ( !isOneModifyable )
+            {
+                return false;
+            }
+
+            // check if property is valid for the entry
+            boolean isOneValid = false;
+            for ( Iterator it = ah.iterator(); it.hasNext(); )
+            {
+                IAttribute attribute = ( IAttribute ) it.next();
+                if ( attribute.isObjectClassAttribute() || attribute.isMustAttribute() || attribute.isMayAttribute() )
+                {
+                    isOneValid = true;
+                    break;
+                }
+            }
+            if ( !isOneValid )
+            {
+                return false;
+            }
+
+            // call value editor
+            return this.valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah ) != null;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    public Object getValue( Object element, String property )
+    {
+
+        if ( element != null && element instanceof ISearchResult && property != null )
+        {
+            ISearchResult result = ( ISearchResult ) element;
+            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+
+            if ( !this.canModify( element, property ) )
+            {
+                return null;
+            }
+
+            if ( ah == null )
+            {
+                ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
+                    { new Attribute( result.getEntry(), property ) } );
+            }
+
+            return this.valueEditorManager.getCurrentValueEditor( ah ).getRawValue( ah );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    public void modify( Object element, String property, Object newRawValue )
+    {
+        if ( element != null && element instanceof Item )
+        {
+            element = ( ( Item ) element ).getData();
+        }
+
+        if ( element != null && element instanceof ISearchResult && property != null )
+        {
+            ISearchResult result = ( ISearchResult ) element;
+            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+
+            // switch operation:
+            if ( ah == null && newRawValue != null )
+            {
+                this.valueEditorManager.createValue( result.getEntry(), property, newRawValue );
+            }
+            else if ( ah != null && newRawValue == null )
+            {
+                this.valueEditorManager.deleteAttribute( ah );
+            }
+            else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
+            {
+                this.valueEditorManager.modifyValue( ah.getAttribute().getValues()[0], newRawValue );
+            }
+        }
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorConfiguration.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorConfiguration.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorConfiguration.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,168 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class SearchResultEditorConfiguration
+{
+
+    private boolean disposed = false;
+
+    protected SearchResultEditorCursor cursor;
+
+    protected SearchResultEditorSorter sorter;
+
+    protected SearchResultEditorFilter filter;
+
+    protected SearchResultEditorContentProvider contentProvider;
+
+    protected SearchResultEditorLabelProvider labelProvider;
+
+    protected SearchResultEditorCellModifier cellModifier;
+
+    protected ValueEditorManager valueEditorManager;
+
+    protected MenuManager contextMenuManager;
+
+
+    public SearchResultEditorConfiguration( IWorkbenchPart part )
+    {
+        super();
+    }
+
+
+    public void dispose()
+    {
+        if ( !this.disposed )
+        {
+
+            if ( this.contentProvider != null )
+                this.contentProvider.dispose();
+            this.contentProvider = null;
+
+            if ( this.labelProvider != null )
+                this.labelProvider.dispose();
+            this.labelProvider = null;
+
+            if ( this.cellModifier != null )
+                this.cellModifier.dispose();
+            this.cellModifier = null;
+
+            if ( this.valueEditorManager != null )
+                this.valueEditorManager.dispose();
+            this.valueEditorManager = null;
+
+            if ( this.contextMenuManager != null )
+                this.contextMenuManager.dispose();
+            this.contextMenuManager = null;
+
+            if ( this.cursor != null )
+                this.cursor.dispose();
+            this.cursor = null;
+
+            this.disposed = true;
+        }
+    }
+
+
+    public SearchResultEditorSorter getSorter()
+    {
+        if ( this.sorter == null )
+            this.sorter = new SearchResultEditorSorter();
+
+        return sorter;
+    }
+
+
+    public SearchResultEditorFilter getFilter()
+    {
+        if ( this.filter == null )
+            this.filter = new SearchResultEditorFilter();
+
+        return filter;
+    }
+
+
+    public IMenuManager getContextMenuManager( TableViewer viewer )
+    {
+        if ( this.contextMenuManager == null )
+        {
+            this.contextMenuManager = new MenuManager();
+            Menu menu = this.contextMenuManager.createContextMenu( viewer.getControl() );
+            getCursor( viewer ).setMenu( menu );
+        }
+        return this.contextMenuManager;
+    }
+
+
+    public SearchResultEditorContentProvider getContentProvider( SearchResultEditorWidget mainWidget )
+    {
+        if ( this.contentProvider == null )
+            this.contentProvider = new SearchResultEditorContentProvider( mainWidget, this );
+
+        return contentProvider;
+    }
+
+
+    public SearchResultEditorLabelProvider getLabelProvider( TableViewer viewer )
+    {
+        if ( this.labelProvider == null )
+            this.labelProvider = new SearchResultEditorLabelProvider( viewer, this.getValueEditorManager( viewer ) );
+
+        return labelProvider;
+    }
+
+
+    public SearchResultEditorCellModifier getCellModifier( TableViewer viewer )
+    {
+        if ( this.cellModifier == null )
+            this.cellModifier = new SearchResultEditorCellModifier( viewer, this.getValueEditorManager( viewer ) );
+
+        return cellModifier;
+    }
+
+
+    public SearchResultEditorCursor getCursor( TableViewer viewer )
+    {
+        if ( this.cursor == null )
+            this.cursor = new SearchResultEditorCursor( viewer );
+
+        return cursor;
+    }
+
+
+    public ValueEditorManager getValueEditorManager( TableViewer viewer )
+    {
+        if ( this.valueEditorManager == null )
+            this.valueEditorManager = new ValueEditorManager( viewer.getTable() );
+
+        return valueEditorManager;
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorContentProvider.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorContentProvider.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorContentProvider.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,205 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import org.apache.directory.studio.ldapbrowser.common.jobs.RunnableContextJobAdapter;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.viewers.ILazyContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+
+
+public class SearchResultEditorContentProvider implements ILazyContentProvider
+{
+
+    private SearchResultEditorWidget mainWidget;
+
+    private SearchResultEditorConfiguration configuration;
+
+    private Object input;
+
+    private Object[] elements;
+
+    private Object[] filteredAndSortedElements;
+
+
+    public SearchResultEditorContentProvider( SearchResultEditorWidget mainWidget,
+        SearchResultEditorConfiguration configuration )
+    {
+        this.mainWidget = mainWidget;
+        this.configuration = configuration;
+
+        this.configuration.getFilter().connect( this );
+        this.configuration.getSorter().connect( this );
+    }
+
+
+    public void dispose()
+    {
+        this.mainWidget = null;
+        this.configuration = null;
+        this.elements = null;
+        this.filteredAndSortedElements = null;
+    }
+
+
+    public void refresh()
+    {
+        this.filterAndSort();
+        this.mainWidget.getViewer().refresh();
+    }
+
+
+    private void filterAndSort()
+    {
+
+        this.filteredAndSortedElements = elements;
+
+        // filter and sort, use Job if too much elements
+        if ( this.configuration.getFilter().isFiltered() || this.configuration.getSorter().isSorted() )
+        {
+            if ( elements.length > 1000 && this.mainWidget.getViewer() != null
+                && !this.mainWidget.getViewer().getTable().isDisposed() )
+            {
+                FilterAndSortJob job = new FilterAndSortJob( this.configuration, this.mainWidget, this.elements );
+                //RunnableContextJobAdapter.execute( job, new TimeTriggeredProgressMonitorDialog( Display.getCurrent()
+                //    .getActiveShell(), 5000 ) );
+                RunnableContextJobAdapter.execute( job, new ProgressMonitorDialog( Display.getCurrent()
+                    .getActiveShell() ) );
+                this.filteredAndSortedElements = job.getFilteredAndSortedElements();
+            }
+            else if ( elements.length > 0 && this.mainWidget.getViewer() != null
+                && !this.mainWidget.getViewer().getTable().isDisposed() )
+            {
+                this.filteredAndSortedElements = this.configuration.getFilter().filter( this.mainWidget.getViewer(),
+                    "", elements );
+                this.configuration.getSorter().sort( this.mainWidget.getViewer(), this.filteredAndSortedElements );
+            }
+        }
+
+        // update virtual table
+        this.mainWidget.getViewer().setItemCount( this.filteredAndSortedElements.length );
+
+        // update state
+        String url = "";
+        boolean enabled = true;
+        if ( input != null && input instanceof ISearch )
+        {
+            ISearch search = ( ISearch ) input;
+
+            if ( filteredAndSortedElements.length < elements.length )
+            {
+                url += filteredAndSortedElements.length + " of ";
+            }
+
+            if ( search.getSearchResults() == null )
+            {
+                url += "Search not performed  -  ";
+                enabled = false;
+            }
+            else if ( search.getSearchResults().length == 1 )
+            {
+                url += search.getSearchResults().length + " Result  -  ";
+            }
+            else
+            {
+                url += search.getSearchResults().length + " Results  -  ";
+            }
+
+            // url += search.getURL();
+            url += "Search Base: " + search.getSearchBase().getUpName() + "  -  ";
+            url += "Filter: " + search.getFilter();
+
+            boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
+                BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )
+                || search.getReturningAttributes().length == 0;
+            this.configuration.getFilter().inputChanged( search, showDn );
+            this.configuration.getSorter().inputChanged( search, showDn );
+        }
+        else
+        {
+            url = "No search selected";;
+            enabled = false;
+        }
+
+        if ( this.mainWidget.getInfoText() != null && !this.mainWidget.getInfoText().isDisposed() )
+        {
+            this.mainWidget.getInfoText().setText( url );
+        }
+        if ( this.mainWidget.getQuickFilterWidget() != null )
+        {
+            this.mainWidget.getQuickFilterWidget().setEnabled( enabled );
+        }
+        if ( this.mainWidget.getViewer() != null && !this.mainWidget.getViewer().getTable().isDisposed() )
+        {
+            this.mainWidget.getViewer().getTable().setEnabled( enabled );
+        }
+
+    }
+
+
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        this.input = newInput;
+        this.elements = getElements( newInput );
+        // this.filterAndSort();
+    }
+
+
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement != null && inputElement instanceof ISearch )
+        {
+            ISearch search = ( ISearch ) inputElement;
+            return search.getSearchResults() != null ? search.getSearchResults() : new Object[0];
+        }
+        else
+        {
+            return new Object[]
+                {};
+            // return new Object[]{inputElement};
+        }
+    }
+
+
+    public TableViewer getViewer()
+    {
+        return this.mainWidget.getViewer();
+    }
+
+
+    public void updateElement( int index )
+    {
+        // if(sortedAndSortedElements instanceof ISearchResult[]) {
+        if ( filteredAndSortedElements != null && filteredAndSortedElements.length > 0
+            && index < filteredAndSortedElements.length )
+        {
+            // System.out.println(index);
+            mainWidget.getViewer().replace( filteredAndSortedElements[index], index );
+        }
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCursor.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCursor.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCursor.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,238 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableCursor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Display;
+
+
+public class SearchResultEditorCursor extends TableCursor implements ISelectionProvider, EntryUpdateListener
+{
+
+    private TableViewer viewer;
+
+
+    public SearchResultEditorCursor( TableViewer viewer )
+    {
+        super( viewer.getTable(), SWT.NONE );
+        this.viewer = viewer;
+
+        setBackground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION ) );
+        setForeground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION_TEXT ) );
+
+        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+
+        initSelectionChecker();
+        initSelectionProvider();
+    }
+
+
+    private void initSelectionChecker()
+    {
+        this.addSelectionListener( new SelectionListener()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                checkSelection();
+            }
+
+
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+                checkSelection();
+            }
+
+
+            private void checkSelection()
+            {
+                if ( viewer != null && viewer.getColumnProperties() != null
+                    && viewer.getColumnProperties().length - 1 < getColumn() )
+                {
+                    setSelection( getRow(), viewer.getColumnProperties().length - 1 );
+                }
+            }
+        } );
+    }
+
+
+    public boolean setFocus()
+    {
+        return super.setFocus();
+    }
+
+
+    private void initSelectionProvider()
+    {
+        this.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                for ( Iterator it = selectionChangesListenerList.iterator(); it.hasNext(); )
+                {
+                    ( ( ISelectionChangedListener ) it.next() ).selectionChanged( new SelectionChangedEvent(
+                        SearchResultEditorCursor.this, getSelection() ) );
+                }
+            }
+        } );
+    }
+
+
+    public void dispose()
+    {
+        EventRegistry.removeEntryUpdateListener( this );
+        this.viewer = null;
+        super.dispose();
+    }
+
+
+    public void entryUpdated( EntryModificationEvent event )
+    {
+        this.viewer.refresh();
+        this.redraw();
+    }
+
+
+    public String getSelectedProperty()
+    {
+        if ( !this.isDisposed() && this.getRow() != null && this.viewer != null
+            && this.viewer.getColumnProperties() != null
+            && this.viewer.getColumnProperties().length >= this.getColumn() + 1 )
+        {
+            String property = ( String ) this.viewer.getColumnProperties()[this.getColumn()];
+            return property;
+        }
+        return null;
+    }
+
+
+    public AttributeHierarchy getSelectedAttributeHierarchie()
+    {
+        if ( !this.isDisposed() && this.getRow() != null && this.viewer != null
+            && this.viewer.getColumnProperties() != null
+            && this.viewer.getColumnProperties().length >= this.getColumn() + 1 )
+        {
+            Object o = this.getRow().getData();
+            String property = ( String ) this.viewer.getColumnProperties()[this.getColumn()];
+            if ( o instanceof ISearchResult && !BrowserUIConstants.DN.equals( property ) )
+            {
+                ISearchResult sr = ( ISearchResult ) o;
+                AttributeHierarchy ah = sr.getAttributeWithSubtypes( property );
+
+                if ( ah == null )
+                {
+                    ah = new AttributeHierarchy( sr.getEntry(), property, new IAttribute[]
+                        { new Attribute( sr.getEntry(), property ) } );
+                }
+
+                return ah;
+            }
+        }
+        return null;
+    }
+
+
+    public ISearchResult getSelectedSearchResult()
+    {
+        if ( !this.isDisposed() && this.getRow() != null )
+        {
+            Object o = this.getRow().getData();
+            if ( o instanceof ISearchResult )
+            {
+                return ( ISearchResult ) o;
+            }
+        }
+        return null;
+    }
+
+    private List selectionChangesListenerList = new ArrayList();
+
+
+    public void addSelectionChangedListener( ISelectionChangedListener listener )
+    {
+        if ( !this.selectionChangesListenerList.contains( listener ) )
+        {
+            this.selectionChangesListenerList.add( listener );
+        }
+    }
+
+
+    public ISelection getSelection()
+    {
+        ISearchResult searchResult = this.getSelectedSearchResult();
+        AttributeHierarchy ah = this.getSelectedAttributeHierarchie();
+        String property = this.getSelectedProperty();
+        // String attributeName = this.getSelectedAttributeName();
+
+        // System.out.println(attributes.length);
+
+        List list = new ArrayList();
+        if ( searchResult != null )
+            list.add( searchResult );
+        if ( ah != null )
+            list.add( ah );
+        if ( property != null )
+        {
+            list.add( property );
+        }
+        // if(attributeName != null) list.add(attributeName);
+
+        return new StructuredSelection( list );
+    }
+
+
+    public void removeSelectionChangedListener( ISelectionChangedListener listener )
+    {
+        if ( this.selectionChangesListenerList.contains( listener ) )
+        {
+            this.selectionChangesListenerList.remove( listener );
+        }
+    }
+
+
+    public void setSelection( ISelection selection )
+    {
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorFilter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorFilter.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorFilter.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorFilter.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,190 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import java.util.ArrayList;
+
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+
+public class SearchResultEditorFilter extends ViewerFilter
+{
+
+    protected SearchResultEditorContentProvider contentProvider;
+
+    protected String quickFilterValue;
+
+    private boolean showDn;
+
+
+    public SearchResultEditorFilter()
+    {
+        this.quickFilterValue = "";
+    }
+
+
+    public void connect( SearchResultEditorContentProvider contentProvider )
+    {
+        this.contentProvider = contentProvider;
+    }
+
+
+    public void inputChanged( ISearch newSearch, boolean showDn )
+    {
+        this.showDn = showDn;
+    }
+
+
+    public boolean isFiltered()
+    {
+        return this.quickFilterValue != null && !"".equals( quickFilterValue );
+    }
+
+
+    public Object[] filter( Viewer viewer, Object parent, Object[] elements )
+    {
+
+        if ( isFiltered() )
+        {
+            int size = elements.length;
+            ArrayList out = new ArrayList( size );
+            for ( int i = 0; i < size; ++i )
+            {
+                Object element = elements[i];
+                if ( select( viewer, parent, element ) )
+                    out.add( element );
+            }
+
+            return out.toArray();
+        }
+        else
+        {
+            return elements;
+        }
+
+    }
+
+
+    public boolean select( Viewer viewer, Object parentElement, Object element )
+    {
+
+        if ( element instanceof ISearchResult )
+        {
+            ISearchResult searchResult = ( ISearchResult ) element;
+
+            String[] returningAttributes = searchResult.getSearch().getReturningAttributes();
+            for ( int r = 0; r < returningAttributes.length; r++ )
+            {
+                String ra = returningAttributes[r];
+                AttributeHierarchy ah = searchResult.getAttributeWithSubtypes( ra );
+                if ( ah != null )
+                {
+                    IAttribute[] attributes = ah.getAttributes();
+                    for ( int i = 0; i < attributes.length; i++ )
+                    {
+                        IValue[] values = attributes[i].getValues();
+                        for ( int k = 0; k < values.length; k++ )
+                        {
+                            if ( this.goesThroughQuickFilter( values[k] ) )
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+
+            // IAttribute[] attributes = searchResult.getAttributes();
+            // for (int i = 0; i < attributes.length; i++) {
+            // IValue[] values = attributes[i].getValues();
+            // for (int k = 0; k < values.length; k++) {
+            // if (this.goesThroughQuickFilter(values[k])) {
+            // return true;
+            // }
+            // }
+            // }
+            if ( this.showDn
+                && searchResult.getDn().getUpName().toUpperCase().indexOf( this.quickFilterValue.toUpperCase() ) > -1 )
+            {
+                return true;
+            }
+
+            return false;
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+
+    private boolean goesThroughQuickFilter( IValue value )
+    {
+
+        // fitler value
+        // if(this.quickFilterValue != null &&
+        // !"".equals(this.quickFilterValue)) {
+        if ( value.isString()
+            && value.getStringValue().toUpperCase().indexOf( this.quickFilterValue.toUpperCase() ) == -1 )
+        {
+            return false;
+        }
+        else if ( value.isBinary() )
+        {
+            return false;
+        }
+        // }
+
+        return true;
+    }
+
+
+    public void dispose()
+    {
+        this.contentProvider = null;
+    }
+
+
+    public String getQuickFilterValue()
+    {
+        return quickFilterValue;
+    }
+
+
+    public void setQuickFilterValue( String quickFilterValue )
+    {
+        if ( !this.quickFilterValue.equals( quickFilterValue ) )
+        {
+            this.quickFilterValue = quickFilterValue;
+            if ( this.contentProvider != null )
+                this.contentProvider.refresh();
+        }
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorInput.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorInput.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorInput.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorInput.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,203 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+
+/**
+ * The input for the search result editor.
+ * 
+ * There is a trick to provide a single instance of the search result editor:
+ * <ul>
+ * <li>If oneInstanceHackEnabled is true the equals method returns always 
+ *     true as long as the compared object is also of type SearchResultEditorInput. 
+ *     With this trick only one instance of the search result editor is opened
+ *     by the eclipse editor framework.
+ * <li>If oneInstanceHackEnabled is false the equals method returns 
+ *     true only if the wrapped objects (ISearch) are equal. This is 
+ *     necessary for the history navigation because it must be able 
+ *     to distinguish the different input objects.
+ * </ul>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchResultEditorInput implements IEditorInput
+{
+
+    /** The search input */
+    private ISearch search;
+
+    /** One instance hack flag */
+    private static boolean oneInstanceHackEnabled = true;
+
+
+    /**
+     * Creates a new instance of SearchResultEditorInput.
+     *
+     * @param search the search input
+     */
+    public SearchResultEditorInput( ISearch search )
+    {
+        this.search = search;
+    }
+
+
+    /**
+     * This implementation always return false because
+     * a search should not be visible in the 
+     * "File Most Recently Used" menu.
+     * 
+     * {@inheritDoc}
+     */
+    public boolean exists()
+    {
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_BROWSER_SEARCHRESULTEDITOR );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName()
+    {
+        return "Search Result Editor";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getToolTipText()
+    {
+        return "";
+    }
+
+
+    /**
+     * This implementation always return null.
+     * 
+     * {@inheritDoc}
+     */
+    public IPersistableElement getPersistable()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object getAdapter( Class adapter )
+    {
+        return null;
+    }
+
+
+    /**
+     * Gets the search input, may be null.
+     *
+     * @return the search input or null
+     */
+    public ISearch getSearch()
+    {
+        return search;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int hashCode()
+    {
+        return getToolTipText().hashCode();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals( Object obj )
+    {
+
+        boolean equal;
+
+        if ( oneInstanceHackEnabled )
+        {
+            equal = ( obj instanceof SearchResultEditorInput );
+        }
+        else
+        {
+            if ( obj instanceof SearchResultEditorInput )
+            {
+                SearchResultEditorInput other = ( SearchResultEditorInput ) obj;
+                if ( this.search == null && other.search == null )
+                {
+                    return true;
+                }
+                else if ( this.search == null || other.search == null )
+                {
+                    return false;
+                }
+                else
+                {
+                    equal = other.search.equals( this.search );
+                }
+            }
+            else
+            {
+                equal = false;
+            }
+        }
+
+        return equal;
+    }
+
+
+    /**
+     * Enables or disabled the one instance hack.
+     *
+     * @param b 
+     *      true to enable the one instance hack,
+     *      false to disable the one instance hack
+     */
+    public static void enableOneInstanceHack( boolean b )
+    {
+        oneInstanceHackEnabled = b;
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorLabelProvider.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorLabelProvider.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,222 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.valueeditors.IValueEditor;
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableFontProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+
+public class SearchResultEditorLabelProvider extends LabelProvider implements ITableLabelProvider, ITableFontProvider,
+    ITableColorProvider
+{
+
+    private ValueEditorManager valueEditorManager;
+
+    private ISearch search;
+
+    private boolean showDn;
+
+
+    public SearchResultEditorLabelProvider( TableViewer viewer, ValueEditorManager valueEditorManager )
+    {
+        this.valueEditorManager = valueEditorManager;
+    }
+
+
+    public void inputChanged( ISearch newSearch, boolean showDn )
+    {
+        this.search = newSearch;
+        this.showDn = showDn;
+    }
+
+
+    public final String getColumnText( Object obj, int index )
+    {
+
+        if ( obj != null && obj instanceof ISearchResult )
+        {
+            String property;
+            try
+            {
+                ISearchResult result = ( ISearchResult ) obj;
+
+                if ( this.showDn && index == 0 )
+                {
+                    property = BrowserUIConstants.DN;
+                }
+                else if ( this.showDn && index > 0 )
+                {
+                    property = this.search.getReturningAttributes()[index - 1];
+                }
+                else
+                {
+                    property = this.search.getReturningAttributes()[index];
+                }
+
+                if ( property == BrowserUIConstants.DN )
+                {
+                    return result.getDn().getUpName();
+                }
+                else
+                {
+                    AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+                    return getDisplayValue( ah );
+                }
+
+            }
+            catch ( ArrayIndexOutOfBoundsException aioobe )
+            {
+                // occurs on "invisible" columns
+                return "";
+            }
+
+        }
+        else if ( obj != null )
+        {
+            return obj.toString();
+        }
+        else
+        {
+            return "";
+        }
+    }
+
+
+    public final Image getColumnImage( Object obj, int index )
+    {
+        return null;
+    }
+
+
+    private String getDisplayValue( AttributeHierarchy ah )
+    {
+
+        IValueEditor vp = this.valueEditorManager.getCurrentValueEditor( ah );
+        if ( vp == null )
+        {
+            return "";
+        }
+
+        String value = vp.getDisplayValue( ah );
+        if ( value.length() > 50 )
+        {
+            value = value.substring( 0, 47 ) + "...";
+        }
+        return value;
+    }
+
+
+    public Font getFont( Object element, int index )
+    {
+
+        if ( element instanceof ISearchResult )
+        {
+            ISearchResult result = ( ISearchResult ) element;
+            String property = null;
+
+            if ( this.showDn && index == 0 )
+            {
+                property = BrowserUIConstants.DN;
+            }
+            else if ( this.showDn && index > 0 && index - 1 < result.getSearch().getReturningAttributes().length )
+            {
+                property = result.getSearch().getReturningAttributes()[index - 1];
+            }
+            else if ( index < result.getSearch().getReturningAttributes().length )
+            {
+                property = result.getSearch().getReturningAttributes()[index];
+            }
+
+            if ( property != null && property == BrowserUIConstants.DN )
+            {
+                return null;
+            }
+            else if ( property != null )
+            {
+                AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+                if ( ah != null )
+                {
+                    for ( int i = 0; i < ah.getAttributes().length; i++ )
+                    {
+                        IAttribute attribute = ah.getAttributes()[i];
+                        if ( attribute.isObjectClassAttribute() )
+                        {
+                            FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                                .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_OBJECTCLASS_FONT );
+                            return BrowserCommonActivator.getDefault().getFont( fontData );
+                        }
+                        else if ( attribute.isMustAttribute() )
+                        {
+                            FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                                .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_MUSTATTRIBUTE_FONT );
+                            return BrowserCommonActivator.getDefault().getFont( fontData );
+                        }
+                        else if ( attribute.isOperationalAttribute() )
+                        {
+                            FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                                .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_OPERATIONALATTRIBUTE_FONT );
+                            return BrowserCommonActivator.getDefault().getFont( fontData );
+                        }
+                        else
+                        {
+                            FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserCommonActivator.getDefault()
+                                .getPreferenceStore(), BrowserCommonConstants.PREFERENCE_MAYATTRIBUTE_FONT );
+                            return BrowserCommonActivator.getDefault().getFont( fontData );
+                        }
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+
+    public Color getForeground( Object element, int index )
+    {
+        return null;
+    }
+
+
+    public Color getBackground( Object element, int index )
+    {
+        return null;
+    }
+
+}
\ No newline at end of file

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

Added: directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java?rev=592087&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorNavigationLocation.java Mon Nov  5 09:01:21 2007
@@ -0,0 +1,180 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.searchresult;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.NavigationLocation;
+
+
+/**
+ * This class is used to mark the search result editor input to the navigation history.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchResultEditorNavigationLocation extends NavigationLocation
+{
+
+    /**
+     * Creates a new instance of SearchResultEditorNavigationLocation.
+     *
+     * @param editor the search result editor
+     */
+    SearchResultEditorNavigationLocation( SearchResultEditor editor )
+    {
+        super( editor );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        ISearch search = getSearch();
+        if ( search != null )
+        {
+            return "Search " + search.getName();
+        }
+        else
+        {
+            return super.getText();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void saveState( IMemento memento )
+    {
+        ISearch search = getSearch();
+        memento.putString( "SEARCH", search.getName() );
+        memento.putString( "CONNECTION", search.getBrowserConnection().getConnection().getId() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void restoreState( IMemento memento )
+    {
+        IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById(
+            memento.getString( "CONNECTION" ) );
+        ISearch search = connection.getSearchManager().getSearch( memento.getString( "SEARCH" ) );
+        super.setInput( new SearchResultEditorInput( search ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void restoreLocation()
+    {
+        IEditorPart editorPart = getEditorPart();
+        if ( editorPart != null && editorPart instanceof SearchResultEditor )
+        {
+            SearchResultEditor searchResultEditor = ( SearchResultEditor ) editorPart;
+            searchResultEditor.setInput( ( SearchResultEditorInput ) getInput() );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean mergeInto( INavigationLocation currentLocation )
+    {
+        if ( currentLocation == null )
+        {
+            return false;
+        }
+
+        if ( getClass() != currentLocation.getClass() )
+        {
+            return false;
+        }
+
+        SearchResultEditorNavigationLocation location = ( SearchResultEditorNavigationLocation ) currentLocation;
+        ISearch other = location.getSearch();
+        ISearch search = getSearch();
+
+        if ( other == null && search == null )
+        {
+            return true;
+        }
+        else if ( other == null || search == null )
+        {
+            return false;
+        }
+        else
+        {
+            return search.equals( other );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void update()
+    {
+    }
+
+
+    /**
+     * Gets the search.
+     *
+     * @return the search
+     */
+    private ISearch getSearch()
+    {
+
+        Object editorInput = getInput();
+        if ( editorInput != null && editorInput instanceof SearchResultEditorInput )
+        {
+            SearchResultEditorInput searchResultEditorInput = ( SearchResultEditorInput ) editorInput;
+            ISearch search = searchResultEditorInput.getSearch();
+            if ( search != null )
+            {
+                return search;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return "" + getSearch();
+    }
+
+}

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



Mime
View raw message