directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r509339 [1/3] - in /directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui: actions/ editors/entry/ editors/searchresult/ views/browser/ views/connection/ widgets/browser/ widgets/connectio...
Date Mon, 19 Feb 2007 21:37:31 GMT
Author: seelmann
Date: Mon Feb 19 13:37:30 2007
New Revision: 509339

URL: http://svn.apache.org/viewvc?view=rev&rev=509339
Log:
Final patch for DIRSTUDIO-49:
- Added a LinkWithEditor action to the connection view
- Added navigation between connections
- Refactored communication between the parts
- Code cleaning and Javadoc

Added:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/LinkWithEditorAction.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorManager.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorManager.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/SelectionUtils.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserView.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/LinkWithEditorAction.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionView.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewUniversalListener.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/browser/BrowserActionGroup.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/connection/ConnectionActionGroup.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/widgets/entryeditor/EntryEditorWidgetUniversalListener.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/SelectionUtils.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/SelectionUtils.java?view=diff&rev=509339&r1=509338&r2=509339
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/SelectionUtils.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/SelectionUtils.java Mon Feb 19 13:37:30 2007
@@ -429,4 +429,16 @@
         return list.toArray( new BrowserSearchResultPage[list.size()] );
     }
 
+    
+    /**
+     * Gets the objects contained in the given selection.
+     *
+     * @param selection the selection
+     * @return an array with object, may be empty.
+     */
+    public static Object[] getObjects( ISelection selection )
+    {
+        List<Object> list = getTypes( selection, Object.class );
+        return list.toArray( new Object[list.size()] );
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorUniversalListener.java?view=diff&rev=509339&r1=509338&r2=509339
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/entry/EntryEditorUniversalListener.java Mon Feb 19 13:37:30 2007
@@ -22,11 +22,17 @@
 
 
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
+import org.apache.directory.ldapstudio.browser.core.model.IBookmark;
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.ISearchResult;
+import org.apache.directory.ldapstudio.browser.ui.actions.SelectionUtils;
 import org.apache.directory.ldapstudio.browser.ui.editors.ldif.LdifOutlinePage;
+import org.apache.directory.ldapstudio.browser.ui.views.browser.BrowserView;
 import org.apache.directory.ldapstudio.browser.ui.widgets.entryeditor.EntryEditorWidgetUniversalListener;
-
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.INullSelectionListener;
 import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.contexts.IContextActivation;
@@ -34,113 +40,219 @@
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 
 
-public class EntryEditorUniversalListener extends EntryEditorWidgetUniversalListener implements IPartListener2
+/**
+ * The EntryEditorUniversalListener manages all events for the entry editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorUniversalListener extends EntryEditorWidgetUniversalListener
 {
 
+    /** The entry editor */
     private EntryEditor entryEditor;
 
+    /** Token used to activate and deactivate shortcuts in the editor */
     private IContextActivation contextActivation;
 
-
-    public EntryEditorUniversalListener( EntryEditor entryEditor )
+    /** Listener that listens for selections of IEntry, ISeachResult and IBookmark objects. */
+    private INullSelectionListener entrySelectionListener = new INullSelectionListener()
     {
-        super( entryEditor.getMainWidget().getViewer(), entryEditor.getActionGroup().getOpenDefaultEditorAction() );
-        this.entryEditor = entryEditor;
-        entryEditor.getSite().getPage().addPartListener( this );
-    }
-
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation sets the editor's input when a entry, search result or bookmark is selected.
+         */
+        public void selectionChanged( IWorkbenchPart part, ISelection selection )
+        {
+            if ( entryEditor != null && part != null )
+            {
+                if ( entryEditor.getSite().getWorkbenchWindow() == part.getSite().getWorkbenchWindow() )
+                {
+                    IEntry[] entries = SelectionUtils.getEntries( selection );
+                    ISearchResult[] searchResults = SelectionUtils.getSearchResults( selection );
+                    IBookmark[] bookmarks = SelectionUtils.getBookmarks( selection );
+                    Object[] objects = SelectionUtils.getObjects( selection );
+                    if ( entries.length + searchResults.length + bookmarks.length == 1 && objects.length == 1 )
+                    {
+                        if ( entries.length == 1 )
+                        {
+                            entryEditor.setInput( new EntryEditorInput( entries[0] ) );
+                        }
+                        else if ( searchResults.length == 1 )
+                        {
+                            entryEditor.setInput( new EntryEditorInput( searchResults[0] ) );
+                        }
+                        else if ( bookmarks.length == 1 )
+                        {
+                            entryEditor.setInput( new EntryEditorInput( bookmarks[0] ) );
+                        }
+                    }
+                    else
+                    {
+                        entryEditor.setInput( new EntryEditorInput( ( IEntry ) null ) );
+                    }
+                }
+            }
+        }
+    };
 
-    public void dispose()
+    /** The part listener used to activate and deactivate the shortcuts */
+    private IPartListener2 partListener = new IPartListener2()
     {
-        if ( this.entryEditor != null )
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation deactivates the shortcuts when the part is deactivated.
+         */
+        public void partDeactivated( IWorkbenchPartReference partRef )
         {
-            entryEditor.getSite().getPage().removePartListener( this );
-            this.entryEditor = null;
-        }
+            if ( partRef.getPart( false ) == entryEditor && contextActivation != null )
+            {
 
-        super.dispose();
-    }
+                entryEditor.getActionGroup().deactivateGlobalActionHandlers();
 
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextService.deactivateContext( contextActivation );
+                contextActivation = null;
+            }
+        }
 
-    void setInput( IEntry entry )
-    {
-        if ( entry != this.viewer.getInput() )
+
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation activates the shortcuts when the part is activated.
+         */
+        public void partActivated( IWorkbenchPartReference partRef )
         {
-            this.viewer.setInput( entry );
-            this.entryEditor.getActionGroup().setInput( entry );
-        }
+            if ( partRef.getPart( false ) == entryEditor )
+            {
 
-    }
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextActivation = contextService
+                    .activateContext( "org.apache.directory.ldapstudio.browser.action.context" );
+                // org.eclipse.ui.contexts.dialogAndWindow
+                // org.eclipse.ui.contexts.window
+                // org.eclipse.ui.text_editor_context
 
+                entryEditor.getActionGroup().activateGlobalActionHandlers();
+            }
+        }
 
-    public void partDeactivated( IWorkbenchPartReference partRef )
-    {
-        if ( partRef.getPart( false ) == this.entryEditor && contextActivation != null )
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partBroughtToTop( IWorkbenchPartReference partRef )
         {
+        }
 
-            this.entryEditor.getActionGroup().deactivateGlobalActionHandlers();
 
-            IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
-                IContextService.class );
-            contextService.deactivateContext( contextActivation );
-            contextActivation = null;
+        /**
+         * {@inheritDoc}
+         */
+        public void partClosed( IWorkbenchPartReference partRef )
+        {
         }
-    }
 
 
-    public void partActivated( IWorkbenchPartReference partRef )
-    {
-        if ( partRef.getPart( false ) == this.entryEditor )
+        /**
+         * {@inheritDoc}
+         */
+        public void partOpened( IWorkbenchPartReference partRef )
         {
+        }
 
-            IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
-                IContextService.class );
-            contextActivation = contextService
-                .activateContext( "org.apache.directory.ldapstudio.browser.action.context" );
-            // org.eclipse.ui.contexts.dialogAndWindow
-            // org.eclipse.ui.contexts.window
-            // org.eclipse.ui.text_editor_context
 
-            this.entryEditor.getActionGroup().activateGlobalActionHandlers();
+        /**
+         * {@inheritDoc}
+         */
+        public void partHidden( IWorkbenchPartReference partRef )
+        {
         }
-    }
 
 
-    public void partBroughtToTop( IWorkbenchPartReference partRef )
-    {
-    }
+        /**
+         * {@inheritDoc}
+         */
+        public void partVisible( IWorkbenchPartReference partRef )
+        {
+        }
 
 
-    public void partClosed( IWorkbenchPartReference partRef )
-    {
-    }
+        /**
+         * {@inheritDoc}
+         */
+        public void partInputChanged( IWorkbenchPartReference partRef )
+        {
+        }
+    };
 
 
-    public void partOpened( IWorkbenchPartReference partRef )
+    /**
+     * Creates a new instance of EntryEditorUniversalListener.
+     *
+     * @param entryEditor the entry editor
+     */
+    public EntryEditorUniversalListener( EntryEditor entryEditor )
     {
-    }
-
+        super( entryEditor.getMainWidget().getViewer(), entryEditor.getActionGroup().getOpenDefaultEditorAction() );
+        this.entryEditor = entryEditor;
 
-    public void partHidden( IWorkbenchPartReference partRef )
-    {
+        // register listeners
+        entryEditor.getSite().getPage().addPartListener( partListener );
+        entryEditor.getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener( BrowserView.getId(),
+            entrySelectionListener );
     }
 
 
-    public void partVisible( IWorkbenchPartReference partRef )
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
     {
+        if ( entryEditor != null )
+        {
+            // deregister listneners
+            entryEditor.getSite().getPage().removePartListener( partListener );
+            entryEditor.getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(
+                BrowserView.getId(), entrySelectionListener );
+            entryEditor = null;
+        }
+
+        super.dispose();
     }
 
 
-    public void partInputChanged( IWorkbenchPartReference partRef )
+    /**
+     * Sets the input to the viewer.
+     *
+     * @param entry the entry input
+     */
+    void setInput( IEntry entry )
     {
+        if ( entry != viewer.getInput() )
+        {
+            viewer.setInput( entry );
+            entryEditor.getActionGroup().setInput( entry );
+        }
+
     }
 
 
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation updates the outline page when the entry is updated.
+     */
     public void entryUpdated( EntryModificationEvent event )
     {
         super.entryUpdated( event );
 
-        LdifOutlinePage outlinePage = ( LdifOutlinePage ) this.entryEditor.getAdapter( IContentOutlinePage.class );
+        LdifOutlinePage outlinePage = ( LdifOutlinePage ) entryEditor.getAdapter( IContentOutlinePage.class );
         if ( outlinePage != null )
         {
             outlinePage.refresh();

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java?view=diff&rev=509339&r1=509338&r2=509339
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/editors/searchresult/SearchResultEditorUniversalListener.java Mon Feb 19 13:37:30 2007
@@ -21,6 +21,12 @@
 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult;
 
 
+/**
+ * The SearchResultEditorUniversalListener manages all events for the search result editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 import org.apache.directory.ldapstudio.browser.core.events.EmptyValueAddedEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryModificationEvent;
 import org.apache.directory.ldapstudio.browser.core.events.EntryUpdateListener;
@@ -34,8 +40,10 @@
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
 import org.apache.directory.ldapstudio.browser.ui.actions.OpenSearchResultAction;
-
+import org.apache.directory.ldapstudio.browser.ui.actions.SelectionUtils;
+import org.apache.directory.ldapstudio.browser.ui.views.browser.BrowserView;
 import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.swt.SWT;
@@ -44,10 +52,12 @@
 import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.MouseAdapter;
 import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.MouseMoveListener;
 import org.eclipse.swt.events.MouseTrackListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Display;
@@ -55,8 +65,10 @@
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.INullSelectionListener;
+import org.eclipse.ui.IPartListener2;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.contexts.IContextActivation;
 import org.eclipse.ui.contexts.IContextService;
@@ -65,242 +77,474 @@
 import org.eclipse.ui.forms.widgets.Hyperlink;
 
 
-public class SearchResultEditorUniversalListener implements IPartListener, SearchUpdateListener, EntryUpdateListener
+public class SearchResultEditorUniversalListener implements SearchUpdateListener, EntryUpdateListener
 {
 
+    /** The search result editor */
     private SearchResultEditor editor;
 
+    /** The table viewer */
     private TableViewer viewer;
 
+    /** The cursor */
     private SearchResultEditorCursor cursor;
 
+    /** The action used to start the default value editor */
     private OpenBestEditorAction startEditAction;
 
+    /** The selected search that is displayed in the search result editor */
     private ISearch selectedSearch;
 
+    /** The hyperlink used for DNs */
     private Hyperlink dnLink;
 
+    /** The table editor, used to display the hyperlink */
     private TableEditor tableEditor;
 
+    /** Token used to activate and deactivate shortcuts in the editor */
+    private IContextActivation contextActivation;
 
-    public SearchResultEditorUniversalListener( SearchResultEditor editor )
+    /** Listener that listens for selections of ISearch objects. */
+    private INullSelectionListener searchSelectionListener = new INullSelectionListener()
     {
-        this.editor = editor;
-
-        this.startEditAction = this.editor.getActionGroup().getOpenBestEditorAction();
-        this.viewer = this.editor.getMainWidget().getViewer();
-        this.cursor = this.editor.getConfiguration().getCursor( this.viewer );
-
-        dnLink = new Hyperlink( viewer.getTable(), SWT.NONE );
-        dnLink.setLayoutData( new GridData( SWT.BOTTOM, SWT.LEFT, true, true ) );
-        dnLink.setText( "" );
-        dnLink.setMenu( viewer.getTable().getMenu() );
-        dnLink.addHyperlinkListener( new IHyperlinkListener()
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation sets the editor's input when a search is selected.
+         */
+        public void selectionChanged( IWorkbenchPart part, ISelection selection )
         {
-            public void linkActivated( HyperlinkEvent e )
+            if ( editor != null && part != null )
             {
-                ISearchResult sr = ( ISearchResult ) e.widget.getData();
-                OpenSearchResultAction action = new OpenSearchResultAction();
-                action.setSelectedSearchResults( new ISearchResult[]
-                    { sr } );
-                action.run();
+                if ( editor.getSite().getWorkbenchWindow() == part.getSite().getWorkbenchWindow() )
+                {
+                    ISearch[] searches = SelectionUtils.getSearches( selection );
+                    Object[] objects = SelectionUtils.getObjects( selection );
+                    if ( searches.length == 1 && objects.length == 1 )
+                    {
+                        editor.setInput( new SearchResultEditorInput( searches[0] ) );
+                    }
+                    else
+                    {
+                        editor.setInput( new SearchResultEditorInput( null ) );
+                    }
+                }
             }
+        }
+    };
 
-
-            public void linkEntered( HyperlinkEvent e )
+    /** The part listener used to activate and deactivate the shortcuts */
+    private IPartListener2 partListener = new IPartListener2()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation deactivates the shortcuts when the part is deactivated.
+         */
+        public void partDeactivated( IWorkbenchPartReference partRef )
+        {
+            if ( partRef.getPart( false ) == editor && contextActivation != null )
             {
+
+                editor.getActionGroup().deactivateGlobalActionHandlers();
+
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextService.deactivateContext( contextActivation );
+                contextActivation = null;
             }
+        }
 
 
-            public void linkExited( HyperlinkEvent e )
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation activates the shortcuts when the part is activated.
+         */
+        public void partActivated( IWorkbenchPartReference partRef )
+        {
+            if ( partRef.getPart( false ) == editor )
             {
+
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextActivation = contextService
+                    .activateContext( "org.apache.directory.ldapstudio.browser.action.context" );
+                // org.eclipse.ui.contexts.dialogAndWindow
+                // org.eclipse.ui.contexts.window
+                // org.eclipse.ui.text_editor_context
+
+                editor.getActionGroup().activateGlobalActionHandlers();
             }
-        } );
-        tableEditor = new TableEditor( viewer.getTable() );
-        tableEditor.horizontalAlignment = SWT.LEFT;
-        tableEditor.verticalAlignment = SWT.BOTTOM;
-        tableEditor.grabHorizontal = true;
-        tableEditor.grabVertical = true;
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partBroughtToTop( IWorkbenchPartReference partRef )
+        {
+        }
 
-        this.initListeners();
-    }
 
+        /**
+         * {@inheritDoc}
+         */
+        public void partClosed( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partOpened( IWorkbenchPartReference partRef )
+        {
+        }
 
-    private void initListeners()
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partHidden( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partVisible( IWorkbenchPartReference partRef )
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void partInputChanged( IWorkbenchPartReference partRef )
+        {
+        }
+    };
+
+    /** The listener used to handle clicks to the DN hyper link */
+    private IHyperlinkListener dnHyperlinkListener = new IHyperlinkListener()
     {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation opens the search result when clicking thd DN link.
+         */
+        public void linkActivated( HyperlinkEvent e )
+        {
+            ISearchResult sr = ( ISearchResult ) e.widget.getData();
+            OpenSearchResultAction action = new OpenSearchResultAction();
+            action.setSelectedSearchResults( new ISearchResult[]
+                { sr } );
+            action.run();
+        }
+
 
-        cursor.addMouseMoveListener( new MouseMoveListener()
+        /**
+         * {@inheritDoc}
+         */
+        public void linkEntered( HyperlinkEvent e )
         {
-            public void mouseMove( MouseEvent e )
-            {
-                if ( !cursor.isDisposed() )
-                {
-                    TableItem item = cursor.getRow();
-                    if ( cursor.getColumn() == 0
-                        && "DN".equalsIgnoreCase( cursor.getRow().getParent().getColumns()[0].getText() ) )
-                    {
-                        checkDnLink( item );
-                    }
-                }
-            }
-        } );
+        }
+
 
-        viewer.getTable().addMouseMoveListener( new MouseMoveListener()
+        /**
+         * {@inheritDoc}
+         */
+        public void linkExited( HyperlinkEvent e )
         {
-            public void mouseMove( MouseEvent e )
-            {
-                if ( !viewer.getTable().isDisposed() )
-                {
-                    TableItem item = viewer.getTable().getItem( new Point( e.x, e.y ) );
-                    viewer.getTable().getColumns()[0].getWidth();
-                    if ( e.x > 0 && e.x < viewer.getTable().getColumns()[0].getWidth()
-                        && "DN".equalsIgnoreCase( viewer.getTable().getColumns()[0].getText() ) )
-                    {
-                        checkDnLink( item );
-                    }
-                }
-            }
-        } );
+        }
+    };
 
-        dnLink.addMouseTrackListener( new MouseTrackListener()
+    /** This listener removes the DN link when then mouse exits the hyperlink control */
+    private MouseTrackListener dnMouseTrackListener = new MouseTrackListener()
+    {
+        /**
+         * {@inheritDoc}
+         */
+        public void mouseEnter( MouseEvent e )
         {
-            public void mouseEnter( MouseEvent e )
-            {
-            }
+        }
 
 
-            public void mouseExit( MouseEvent e )
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation removed the DN link.
+         */
+        public void mouseExit( MouseEvent e )
+        {
+            if ( !dnLink.isDisposed() )
             {
-                if ( !dnLink.isDisposed() )
-                {
-                    dnLink.setVisible( false );
-                    tableEditor.setEditor( null );
-                }
+                dnLink.setVisible( false );
+                tableEditor.setEditor( null );
             }
+        }
 
 
-            public void mouseHover( MouseEvent e )
-            {
-            }
-        } );
+        public void mouseHover( MouseEvent e )
+        {
+        }
+    };
 
-        cursor.addSelectionListener( new SelectionAdapter()
+    /** This listener renders the DN hyperlink when the mouse cursor moves over the DN */
+    private MouseMoveListener cursorMouseMoveListener = new MouseMoveListener()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation renders the DN link.
+         */
+        public void mouseMove( MouseEvent e )
         {
-            public void widgetSelected( SelectionEvent e )
+            if ( !cursor.isDisposed() )
             {
-                // viewer.setSelection(new StructuredSelection(getRow()), true);
-                // viewer.getTable().setSelection(new TableItem[]{getRow()});
-                viewer.setSelection( null, true );
-                viewer.getTable().setSelection( new TableItem[0] );
-
-                ISearchResult result = cursor.getSelectedSearchResult();
-                String property = cursor.getSelectedProperty();
-                if ( property != null && result != null && viewer.getCellModifier().canModify( result, property ) )
+                TableItem item = cursor.getRow();
+                if ( cursor.getColumn() == 0
+                    && "DN".equalsIgnoreCase( cursor.getRow().getParent().getColumns()[0].getText() ) )
                 {
-                    cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION ) );
+                    checkDnLink( item );
                 }
-                else
+            }
+        }
+    };
+
+    /** This listener renders the DN link when the mouse cursor moves over the DN */
+    private MouseMoveListener viewerMouseMoveListener = new MouseMoveListener()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation renders the DN link.
+         */
+        public void mouseMove( MouseEvent e )
+        {
+            if ( !viewer.getTable().isDisposed() )
+            {
+                TableItem item = viewer.getTable().getItem( new Point( e.x, e.y ) );
+                viewer.getTable().getColumns()[0].getWidth();
+                if ( e.x > 0 && e.x < viewer.getTable().getColumns()[0].getWidth()
+                    && "DN".equalsIgnoreCase( viewer.getTable().getColumns()[0].getText() ) )
                 {
-                    cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_TITLE_INACTIVE_FOREGROUND ) );
+                    checkDnLink( item );
                 }
-
-                // cursor.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
             }
+        }
+    };
 
-
-            public void widgetDefaultSelected( SelectionEvent e )
+    /** This listener starts the value editor and toggles the cursor's background color */
+    private SelectionListener cursorSelectionListener = new SelectionAdapter()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation sets the cursor's background color.
+         */
+        public void widgetSelected( SelectionEvent e )
+        {
+            // viewer.setSelection(new StructuredSelection(getRow()), true);
+            // viewer.getTable().setSelection(new TableItem[]{getRow()});
+            viewer.setSelection( null, true );
+            viewer.getTable().setSelection( new TableItem[0] );
+
+            ISearchResult result = cursor.getSelectedSearchResult();
+            String property = cursor.getSelectedProperty();
+            if ( property != null && result != null && viewer.getCellModifier().canModify( result, property ) )
             {
-                viewer.setSelection( null, true );
-                viewer.getTable().setSelection( new TableItem[0] );
-                if ( startEditAction.isEnabled() )
-                    startEditAction.run();
+                cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_LIST_SELECTION ) );
             }
-        } );
-
-        cursor.addMouseListener( new MouseAdapter()
-        {
-            public void mouseDoubleClick( MouseEvent e )
+            else
             {
-                viewer.setSelection( null, true );
-                viewer.getTable().setSelection( new TableItem[0] );
-                if ( startEditAction.isEnabled() )
-                    startEditAction.run();
+                cursor.setBackground( Display.getDefault().getSystemColor( SWT.COLOR_TITLE_INACTIVE_FOREGROUND ) );
             }
 
+            // cursor.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
+        }
 
-            public void mouseDown( MouseEvent e )
-            {
-            }
 
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation starts the value editor when pressing enter.
+         */
+        public void widgetDefaultSelected( SelectionEvent e )
+        {
+            viewer.setSelection( null, true );
+            viewer.getTable().setSelection( new TableItem[0] );
+            if ( startEditAction.isEnabled() )
+                startEditAction.run();
+        }
+    };
 
-            public void mouseUp( MouseEvent e )
-            {
-            }
-        } );
+    /** This listener starts the value editor when double-clicking a cell */
+    private MouseListener cursorMouseListener = new MouseAdapter()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation starts the value editor when double-clicking a cell.
+         */
+        public void mouseDoubleClick( MouseEvent e )
+        {
+            viewer.setSelection( null, true );
+            viewer.getTable().setSelection( new TableItem[0] );
+            if ( startEditAction.isEnabled() )
+                startEditAction.run();
+        }
 
-        cursor.addKeyListener( new KeyListener()
+
+        /**
+         * {@inheritDoc}
+         */
+        public void mouseDown( MouseEvent e )
+        {
+        }
+
+
+        /**
+         * {@inheritDoc}
+         */
+        public void mouseUp( MouseEvent e )
+        {
+        }
+    };
+
+    /** This listener starts the value editor when typing */
+    private KeyListener cursorKeyListener = new KeyListener()
+    {
+        /**
+         * {@inheritDoc}
+         * 
+         * This implementation starts the value editor when a non-control key is pressed.
+         */
+        public void keyPressed( KeyEvent e )
         {
-            public void keyPressed( KeyEvent e )
+            if ( e.character != '\0' && e.character != SWT.CR && e.character != SWT.LF && e.character != SWT.BS
+                && e.character != SWT.DEL && e.character != SWT.TAB && e.character != SWT.ESC
+                && ( e.stateMask == 0 || e.stateMask == SWT.SHIFT ) )
             {
-                if ( e.character != '\0' && e.character != SWT.CR && e.character != SWT.LF && e.character != SWT.BS
-                    && e.character != SWT.DEL && e.character != SWT.TAB && e.character != SWT.ESC
-                    && ( e.stateMask == 0 || e.stateMask == SWT.SHIFT ) )
-                {
 
-                    if ( startEditAction.isEnabled()
-                        && startEditAction.getBestValueEditor().getCellEditor() instanceof TextCellEditor )
+                if ( startEditAction.isEnabled()
+                    && startEditAction.getBestValueEditor().getCellEditor() instanceof TextCellEditor )
+                {
+                    startEditAction.run();
+                    CellEditor editor = viewer.getCellEditors()[cursor.getColumn()];
+                    if ( editor instanceof TextCellEditor )
                     {
-                        startEditAction.run();
-                        CellEditor editor = viewer.getCellEditors()[cursor.getColumn()];
-                        if ( editor instanceof TextCellEditor )
-                        {
-                            editor.setValue( String.valueOf( e.character ) );
-                            ( ( Text ) editor.getControl() ).setSelection( 1 );
-                        }
+                        editor.setValue( String.valueOf( e.character ) );
+                        ( ( Text ) editor.getControl() ).setSelection( 1 );
                     }
-
                 }
+
             }
+        }
 
 
-            public void keyReleased( KeyEvent e )
-            {
-            }
-        } );
+        /**
+         * {@inheritDoc}
+         */
+        public void keyReleased( KeyEvent e )
+        {
+        }
+    };
+
+
+    /**
+     * Creates a new instance of SearchResultEditorUniversalListener.
+     *
+     * @param editor the search result editor
+     */
+    public SearchResultEditorUniversalListener( SearchResultEditor editor )
+    {
+        this.editor = editor;
+
+        startEditAction = editor.getActionGroup().getOpenBestEditorAction();
+        viewer = editor.getMainWidget().getViewer();
+        cursor = editor.getConfiguration().getCursor( viewer );
+
+        // create dn link control
+        dnLink = new Hyperlink( viewer.getTable(), SWT.NONE );
+        dnLink.setLayoutData( new GridData( SWT.BOTTOM, SWT.LEFT, true, true ) );
+        dnLink.setText( "" );
+        dnLink.setMenu( viewer.getTable().getMenu() );
+        tableEditor = new TableEditor( viewer.getTable() );
+        tableEditor.horizontalAlignment = SWT.LEFT;
+        tableEditor.verticalAlignment = SWT.BOTTOM;
+        tableEditor.grabHorizontal = true;
+        tableEditor.grabVertical = true;
+
+        // init listeners
+        dnLink.addHyperlinkListener( dnHyperlinkListener );
+        dnLink.addMouseTrackListener( dnMouseTrackListener );
+
+        cursor.addMouseMoveListener( cursorMouseMoveListener );
+        cursor.addSelectionListener( cursorSelectionListener );
+        cursor.addMouseListener( cursorMouseListener );
+        cursor.addKeyListener( cursorKeyListener );
+
+        viewer.getTable().addMouseMoveListener( viewerMouseMoveListener );
+
+        editor.getSite().getPage().addPartListener( partListener );
+        editor.getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener( BrowserView.getId(),
+            searchSelectionListener );
 
-        editor.getSite().getPage().addPartListener( this );
         EventRegistry.addSearchUpdateListener( this );
         EventRegistry.addEntryUpdateListener( this );
     }
 
 
+    /**
+     * Disposes the listener.
+     */
     public void dispose()
     {
-        EventRegistry.removeSearchUpdateListener( this );
-        EventRegistry.removeEntryUpdateListener( this );
-        editor.getSite().getPage().removePartListener( this );
-
-        this.selectedSearch = null;
-        this.startEditAction = null;
-        this.cursor = null;
-        this.viewer = null;
-        this.editor = null;
+        if ( editor != null )
+        {
+            editor.getSite().getPage().removePartListener( partListener );
+            editor.getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(
+                BrowserView.getId(), searchSelectionListener );
+
+            EventRegistry.removeSearchUpdateListener( this );
+            EventRegistry.removeEntryUpdateListener( this );
+
+            selectedSearch = null;
+            startEditAction = null;
+            cursor = null;
+            viewer = null;
+            editor = null;
+        }
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation refreshes the search result editor.
+     */
     public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
     {
-        if ( this.selectedSearch == searchUpdateEvent.getSearch() )
+        if ( selectedSearch == searchUpdateEvent.getSearch() )
         {
-            this.refreshInput();
+            refreshInput();
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation refreshes the search result editor 
+     * or starts the value editor if an empty value was added.
+     */
     public void entryUpdated( EntryModificationEvent event )
     {
 
-        if ( event instanceof EmptyValueAddedEvent && !this.editor.getActionGroup().isEditorActive() )
+        if ( event instanceof EmptyValueAddedEvent && !editor.getActionGroup().isEditorActive() )
         {
             EmptyValueAddedEvent evae = ( EmptyValueAddedEvent ) event;
             IAttribute att = evae.getAddedValue().getAttribute();
@@ -317,60 +561,68 @@
         }
         else
         {
-            this.viewer.refresh( true );
+            viewer.refresh( true );
             cursor.notifyListeners( SWT.Selection, new Event() );
         }
     }
 
 
+    /**
+     * Sets the input.
+     *
+     * @param search the search
+     */
     void setInput( ISearch search )
     {
-        if ( search != this.viewer.getInput() )
+        if ( search != viewer.getInput() )
         {
-            this.selectedSearch = search;
-            this.refreshInput();
-            this.editor.getActionGroup().setInput( search );
+            selectedSearch = search;
+            refreshInput();
+            editor.getActionGroup().setInput( search );
         }
     }
 
 
+    /**
+     * Refreshes the input, makes columns visible or hides columns depending on the number
+     * of returning attributes.
+     */
     void refreshInput()
     {
 
         // create at least on column
-        this.ensureColumnCount( 1 );
+        ensureColumnCount( 1 );
 
         // get all columns
-        TableColumn[] columns = this.viewer.getTable().getColumns();
+        TableColumn[] columns = viewer.getTable().getColumns();
 
-        // number of uses columns
+        // number of used columns
         int usedColumns;
 
-        if ( this.selectedSearch != null )
+        if ( selectedSearch != null )
         {
 
             // get displayed attributes
             boolean showDn = BrowserUIPlugin.getDefault().getPreferenceStore().getBoolean(
                 BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN )
-                || this.selectedSearch.getReturningAttributes().length == 0;
+                || selectedSearch.getReturningAttributes().length == 0;
             String[] attributes;
             if ( showDn )
             {
-                attributes = new String[this.selectedSearch.getReturningAttributes().length + 1];
+                attributes = new String[selectedSearch.getReturningAttributes().length + 1];
                 attributes[0] = "DN";
-                System
-                    .arraycopy( this.selectedSearch.getReturningAttributes(), 0, attributes, 1, attributes.length - 1 );
+                System.arraycopy( selectedSearch.getReturningAttributes(), 0, attributes, 1, attributes.length - 1 );
             }
             else
             {
-                attributes = this.selectedSearch.getReturningAttributes();
+                attributes = selectedSearch.getReturningAttributes();
             }
 
             // create missing columns
             if ( attributes.length > columns.length )
             {
-                this.ensureColumnCount( attributes.length );
-                columns = this.viewer.getTable().getColumns();
+                ensureColumnCount( attributes.length );
+                columns = viewer.getTable().getColumns();
             }
 
             // set column headers
@@ -378,22 +630,21 @@
             {
                 columns[i].setText( attributes[i] );
             }
-            this.viewer.setColumnProperties( attributes );
+            viewer.setColumnProperties( attributes );
 
             // set input
-            ( ( SearchResultEditorLabelProvider ) this.viewer.getLabelProvider() ).inputChanged( this.selectedSearch,
-                showDn );
+            ( ( SearchResultEditorLabelProvider ) viewer.getLabelProvider() ).inputChanged( selectedSearch, showDn );
 
-            this.viewer.setInput( this.selectedSearch );
+            viewer.setInput( selectedSearch );
             // this.viewer.refresh();
 
             // update cell editors
             CellEditor[] editors = new CellEditor[attributes.length];
-            this.viewer.setCellEditors( editors );
+            viewer.setCellEditors( editors );
 
             if ( attributes.length > 0 )
             {
-                int width = this.viewer.getTable().getClientArea().width / attributes.length;
+                int width = viewer.getTable().getClientArea().width / attributes.length;
                 for ( int i = 0; i < attributes.length; i++ )
                 {
                     columns[i].setWidth( width );
@@ -408,7 +659,7 @@
         }
         else
         {
-            this.viewer.setInput( null );
+            viewer.setInput( null );
             columns[0].setText( "DN" );
             columns[0].pack();
             usedColumns = 1;
@@ -422,20 +673,26 @@
         }
 
         // refresh content provider (sorter and filter)
-        this.editor.getConfiguration().getContentProvider( this.editor.getMainWidget() ).refresh();
+        editor.getConfiguration().getContentProvider( editor.getMainWidget() ).refresh();
 
         // this.cursor.setFocus();
     }
 
 
+    /**
+     * Ensures that the table contains at least the number of 
+     * the requested columns.
+     *
+     * @param count the requested number of columns
+     */
     private void ensureColumnCount( int count )
     {
-        TableColumn[] columns = this.viewer.getTable().getColumns();
+        TableColumn[] columns = viewer.getTable().getColumns();
         if ( columns.length < count )
         {
             for ( int i = columns.length; i < count; i++ )
             {
-                TableColumn column = new TableColumn( this.viewer.getTable(), SWT.LEFT );
+                TableColumn column = new TableColumn( viewer.getTable(), SWT.LEFT );
                 column.setText( "" );
                 column.setWidth( 0 );
                 column.setResizable( true );
@@ -445,10 +702,15 @@
     }
 
 
+    /**
+     * Renders the DN link.
+     *
+     * @param item the table item
+     */
     private void checkDnLink( TableItem item )
     {
 
-        if ( dnLink == null || dnLink.isDisposed() || tableEditor == null || this.viewer.getTable().isDisposed()
+        if ( dnLink == null || dnLink.isDisposed() || tableEditor == null || viewer.getTable().isDisposed()
             || cursor.isDisposed() )
         {
             return;
@@ -494,55 +756,6 @@
                 tableEditor.setEditor( null );
             }
         }
-    }
-
-    IContextActivation contextActivation;
-
-
-    public void partActivated( IWorkbenchPart part )
-    {
-        if ( part == this.editor )
-        {
-
-            this.editor.getActionGroup().activateGlobalActionHandlers();
-
-            IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
-                IContextService.class );
-            contextActivation = contextService
-                .activateContext( "org.apache.directory.ldapstudio.browser.action.context" );
-
-        }
-    }
-
-
-    public void partDeactivated( IWorkbenchPart part )
-    {
-        if ( part == this.editor && contextActivation != null )
-        {
-
-            IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
-                IContextService.class );
-            contextService.deactivateContext( contextActivation );
-            contextActivation = null;
-
-            this.editor.getActionGroup().deactivateGlobalActionHandlers();
-
-        }
-    }
-
-
-    public void partOpened( IWorkbenchPart part )
-    {
-    }
-
-
-    public void partClosed( IWorkbenchPart part )
-    {
-    }
-
-
-    public void partBroughtToTop( IWorkbenchPart part )
-    {
     }
 
 }

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserView.java?view=diff&rev=509339&r1=509338&r2=509339
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserView.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserView.java Mon Feb 19 13:37:30 2007
@@ -26,7 +26,6 @@
 
 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;
@@ -39,60 +38,82 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.IShowInTarget;
 import org.eclipse.ui.part.ShowInContext;
 import org.eclipse.ui.part.ViewPart;
 
 
+/**
+ * This class implements the browser view. It displays the DIT, the searches and the bookmarks.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserView extends ViewPart
 {
 
+    /** The configuration */
     private BrowserConfiguration configuration;
 
+    /** The listeners */
     private BrowserViewUniversalListener universalListener;
 
+    /** The actions */
     private BrowserViewActionGroup actionGroup;
 
+    /** The browser's main widget */
     private BrowserWidget mainWidget;
 
 
     // private DragAction dragAction;
     // private DropAction dropAction;
 
+    /**
+     * Returns the browser view ID.
+     * 
+     * @return the browser view ID.
+     */
     public static String getId()
     {
         return BrowserView.class.getName();
     }
 
 
+    /**
+     * Creates a new instance of BrowserView.
+     */
     public BrowserView()
     {
-        super();
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation sets focus to the viewer's control.
+     */
     public void setFocus()
     {
         mainWidget.getViewer().getControl().setFocus();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void dispose()
     {
-        if ( this.configuration != null )
+        if ( configuration != null )
         {
-            this.actionGroup.dispose();
-            this.actionGroup = null;
-            this.universalListener.dispose();
-            this.universalListener = null;
-            this.configuration.dispose();
-            this.configuration = null;
-            this.mainWidget.dispose();
-            this.mainWidget = null;
+            actionGroup.dispose();
+            actionGroup = null;
+            universalListener.dispose();
+            universalListener = null;
+            configuration.dispose();
+            configuration = null;
+            mainWidget.dispose();
+            mainWidget = null;
             getSite().setSelectionProvider( null );
         }
 
@@ -100,6 +121,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void createPartControl( Composite parent )
     {
 
@@ -114,23 +138,23 @@
             BrowserUIPlugin.PLUGIN_ID + "." + "tools_browser_view" );
 
         // create configuration
-        this.configuration = new BrowserConfiguration();
+        configuration = new BrowserConfiguration();
 
         // create main widget
-        this.mainWidget = new BrowserWidget( this.configuration, getViewSite().getActionBars() );
-        this.mainWidget.createWidget( composite );
-        this.mainWidget.setInput( getSite() );
+        mainWidget = new BrowserWidget( configuration, getViewSite().getActionBars() );
+        mainWidget.createWidget( composite );
+        mainWidget.setInput( getSite() );
 
         // create actions and context menu (and register global actions)
-        this.actionGroup = new BrowserViewActionGroup( this );
-        this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
-        this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
-        this.actionGroup.enableGlobalActionHandlers( getViewSite().getActionBars() );
-        this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
+        actionGroup = new BrowserViewActionGroup( this );
+        actionGroup.fillToolBar( mainWidget.getToolBarManager() );
+        actionGroup.fillMenu( mainWidget.getMenuManager() );
+        actionGroup.enableGlobalActionHandlers( getViewSite().getActionBars() );
+        actionGroup.fillContextMenu( mainWidget.getContextMenuManager() );
 
         // create the listener
-        getSite().setSelectionProvider( this.mainWidget.getViewer() );
-        this.universalListener = new BrowserViewUniversalListener( this );
+        getSite().setSelectionProvider( mainWidget.getViewer() );
+        universalListener = new BrowserViewUniversalListener( this );
 
         // DND support
         // int ops = DND.DROP_COPY | DND.DROP_MOVE;
@@ -141,47 +165,54 @@
     }
 
 
+    /**
+     * Selects the given object in the tree. The object
+     * must be an IEntry, ISearch, ISearchResult or IBookmark.
+     * 
+     * @param obj the object to select
+     */
     public void select( Object obj )
     {
+        Object objectToSelect = null;
+
         if ( obj instanceof ISearch )
         {
             ISearch search = ( ISearch ) obj;
 
-            this.mainWidget.getViewer().expandToLevel( search, 0 );
+            universalListener.setInput( search.getConnection() );
+
+            mainWidget.getViewer().expandToLevel( search, 0 );
 
-            this.mainWidget.getViewer().reveal( search );
-            this.mainWidget.getViewer().refresh( search, true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( search ), true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( search ), true );
+            objectToSelect = search;
         }
         if ( obj instanceof ISearchResult )
         {
             ISearchResult searchResult = ( ISearchResult ) obj;
             ISearch search = searchResult.getSearch();
 
-            this.mainWidget.getViewer().expandToLevel( search, 1 );
+            universalListener.setInput( search.getConnection() );
 
-            this.mainWidget.getViewer().reveal( searchResult );
-            this.mainWidget.getViewer().refresh( searchResult, true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( searchResult ), true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( searchResult ), true );
+            mainWidget.getViewer().expandToLevel( search, 1 );
+
+            objectToSelect = searchResult;
         }
         if ( obj instanceof IBookmark )
         {
             IBookmark bookmark = ( IBookmark ) obj;
-            
-            this.mainWidget.getViewer().expandToLevel( bookmark, 0 );
-            
-            this.mainWidget.getViewer().reveal( bookmark );
-            this.mainWidget.getViewer().refresh( bookmark, true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( bookmark ), true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( bookmark ), true );
+
+            universalListener.setInput( bookmark.getConnection() );
+
+            mainWidget.getViewer().expandToLevel( bookmark, 0 );
+
+            objectToSelect = bookmark;
         }
         if ( obj instanceof IEntry )
         {
             IEntry entry = ( IEntry ) obj;
 
-            List entryList = new ArrayList();
+            universalListener.setInput( entry.getConnection() );
+
+            List<IEntry> entryList = new ArrayList<IEntry>();
             IEntry tempEntry = entry;
             while ( tempEntry.getParententry() != null )
             {
@@ -201,58 +232,24 @@
                 }
             }
 
-            this.mainWidget.getViewer().reveal( entry );
-            this.mainWidget.getViewer().refresh( entry, true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
-            this.mainWidget.getViewer().setSelection( new StructuredSelection( entry ), true );
+            objectToSelect = entry;
         }
-    }
-
 
-    public static void setInput( IConnection connection )
-    {
-        try
+        if ( objectToSelect != null )
         {
-            String targetId = BrowserView.getId();
-            IViewPart targetView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(
-                targetId );
+            mainWidget.getViewer().reveal( objectToSelect );
+            mainWidget.getViewer().refresh( objectToSelect, true );
+            mainWidget.getViewer().setSelection( new StructuredSelection( objectToSelect ), true );
 
-            if ( targetView == null && connection != null )
-            {
-                try
-                {
-                    targetView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(
-                        targetId, null, IWorkbenchPage.VIEW_VISIBLE );
-                }
-                catch ( PartInitException e )
-                {
-                }
-            }
-
-            try
-            {
-                targetView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView( targetId,
-                    null, IWorkbenchPage.VIEW_VISIBLE );
-            }
-            catch ( PartInitException e )
-            {
-            }
-
-            // set input
-            if ( targetView != null && targetView instanceof BrowserView )
-            {
-                ( ( BrowserView ) targetView ).universalListener.setInput( connection );
-            }
-        }
-        catch ( NullPointerException npe )
-        {
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getAdapter( Class required )
     {
-
         if ( IShowInTarget.class.equals( required ) )
         {
             return new IShowInTarget()
@@ -280,7 +277,6 @@
                         ISearch search = sr.getSearch();
                         select( search );
                     }
-                    System.out.println( "BrowserView: " + context.getInput() + "," + context.getSelection() );
                     return true;
                 }
             };
@@ -290,24 +286,44 @@
     }
 
 
+    /**
+     * Gets the action group.
+     *
+     * @return the action group
+     */
     public BrowserViewActionGroup getActionGroup()
     {
         return actionGroup;
     }
 
 
+    /**
+     * Gets the configuration.
+     *
+     * @return the configuration
+     */
     public BrowserConfiguration getConfiguration()
     {
         return configuration;
     }
 
 
+    /**
+     * Gets the main widget.
+     * 
+     * @return the main widget
+     */
     public BrowserWidget getMainWidget()
     {
         return mainWidget;
     }
 
 
+    /**
+     * Gets the universal listener.
+     * 
+     * @return the universal listener
+     */
     public BrowserViewUniversalListener getUniversalListener()
     {
         return universalListener;

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java?view=diff&rev=509339&r1=509338&r2=509339
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java Mon Feb 19 13:37:30 2007
@@ -36,8 +36,8 @@
 import org.apache.directory.ldapstudio.browser.ui.actions.NewSearchAction;
 import org.apache.directory.ldapstudio.browser.ui.actions.PasteAction;
 import org.apache.directory.ldapstudio.browser.ui.actions.RenameAction;
-import org.apache.directory.ldapstudio.browser.ui.actions.proxy.BrowserViewActionProxy;
 import org.apache.directory.ldapstudio.browser.ui.actions.proxy.BrowserActionProxy;
+import org.apache.directory.ldapstudio.browser.ui.actions.proxy.BrowserViewActionProxy;
 import org.apache.directory.ldapstudio.browser.ui.widgets.browser.BrowserActionGroup;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
@@ -52,170 +52,220 @@
 import org.eclipse.ui.commands.ICommandService;
 
 
+/**
+ * This class manages all the actions of the browser view.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class BrowserViewActionGroup extends BrowserActionGroup
 {
 
+    /** The action to show/hide the DIT. */
     private ShowDITAction showDITAction;
 
+    /** The action to show/hide searches. */
     private ShowSearchesAction showSearchesAction;
 
+    /** The action to show/hide bookmarks. */
     private ShowBookmarksAction showBookmarksAction;
 
+    /** The action to show/hide metadata. */
     private ShowDirectoryMetadataEntriesAction showDirectoryMetadataEntriesAction;
 
+    /** The action to open the browser's preference page. */
     private OpenBrowserPreferencePageAction openBrowserPreferencePageAction;
 
+    /** The action to link the current editor with the browser view. */
     private LinkWithEditorAction linkWithEditorAction;
 
+    /** The Constant locateEntryInDitAction. */
     private static final String locateEntryInDitAction = "locateEntryInDitAction";
 
+    /** The Constant newEntryAction. */
     private static final String newEntryAction = "newEntryAction";
 
+    /** The Constant newSearchAction. */
     private static final String newSearchAction = "newSearchAction";
 
+    /** The Constant newBookmarkAction. */
     private static final String newBookmarkAction = "newBookmarkAction";
 
+    /** The Constant newBatchOperationAction. */
     private static final String newBatchOperationAction = "newBatchOperationAction";
 
+    /** The Constant copyAction. */
     private static final String copyAction = "copyAction";
 
+    /** The Constant pasteAction. */
     private static final String pasteAction = "pasteAction";
 
+    /** The Constant deleteAction. */
     private static final String deleteAction = "deleteAction";
 
+    /** The Constant moveAction. */
     private static final String moveAction = "moveAction";
 
+    /** The Constant renameAction. */
     private static final String renameAction = "renameAction";
 
+    /** The Constant copyDnAction. */
     private static final String copyDnAction = "copyDnAction";
 
+    /** The Constant copyUrlAction. */
     private static final String copyUrlAction = "copyUrlAction";
 
+    /** The Constant copyEntryAsLdifDnOnlyAction. */
     private static final String copyEntryAsLdifDnOnlyAction = "copyEntryAsLdifDnOnlyAction";
 
+    /** The Constant copyEntryAsLdifReturningAttributesOnlyAction. */
     private static final String copyEntryAsLdifReturningAttributesOnlyAction = "copyEntryAsLdifReturningAttributesOnlyAction";
 
+    /** The Constant copyEntryAsLdifAction. */
     private static final String copyEntryAsLdifAction = "copyEntryAsLdifAction";
 
+    /** The Constant copyEntryAsLdifOperationalAction. */
     private static final String copyEntryAsLdifOperationalAction = "copyEntryAsLdifOperationalAction";
 
+    /** The Constant copyEntryAsCsvDnOnlyAction. */
     private static final String copyEntryAsCsvDnOnlyAction = "copyEntryAsCsvDnOnlyAction";
 
+    /** The Constant copyEntryAsCsvReturningAttributesOnlyAction. */
     private static final String copyEntryAsCsvReturningAttributesOnlyAction = "copyEntryAsCsvReturningAttributesOnlyAction";
 
+    /** The Constant copyEntryAsCsvAction. */
     private static final String copyEntryAsCsvAction = "copyEntryAsCsvAction";
 
+    /** The Constant copyEntryAsCsvOperationalAction. */
     private static final String copyEntryAsCsvOperationalAction = "copyEntryAsCsvOperationalAction";
 
+    /** The Constant importDsmlAction. */
     private static final String importDsmlAction = "importDsmlAction";
 
+    /** The Constant importLdifAction. */
     private static final String importLdifAction = "importLdifAction";
 
+    /** The Constant exportLdifAction. */
     private static final String exportLdifAction = "exportLdifAction";
-    
+
+    /** The Constant exportDsmlAction. */
     private static final String exportDsmlAction = "exportDsmlAction";
 
+    /** The Constant exportCsvAction. */
     private static final String exportCsvAction = "exportCsvAction";
 
+    /** The Constant exportExcelAction. */
     private static final String exportExcelAction = "exportExcelAction";
 
 
+    /**
+     * Creates a new instance of BrowserViewActionGroup and 
+     * creates all the actions.
+     * 
+     * @param view the browser view
+     */
     public BrowserViewActionGroup( BrowserView view )
     {
         super( view.getMainWidget(), view.getConfiguration() );
         TreeViewer viewer = view.getMainWidget().getViewer();
 
-        this.linkWithEditorAction = new LinkWithEditorAction( view );
-        this.showDITAction = new ShowDITAction();
-        this.showSearchesAction = new ShowSearchesAction();
-        this.showBookmarksAction = new ShowBookmarksAction();
-        this.showDirectoryMetadataEntriesAction = new ShowDirectoryMetadataEntriesAction();
-        this.openBrowserPreferencePageAction = new OpenBrowserPreferencePageAction();
-
-        this.browserActionMap.put( newEntryAction, new BrowserViewActionProxy( viewer, new NewEntryAction( view
-            .getSite().getWorkbenchWindow() ) ) );
-        this.browserActionMap.put( newSearchAction, new BrowserViewActionProxy( viewer, new NewSearchAction() ) );
-        this.browserActionMap.put( newBookmarkAction, new BrowserViewActionProxy( viewer, new NewBookmarkAction() ) );
-        this.browserActionMap.put( newBatchOperationAction, new BrowserViewActionProxy( viewer,
+        linkWithEditorAction = new LinkWithEditorAction( view );
+        showDITAction = new ShowDITAction();
+        showSearchesAction = new ShowSearchesAction();
+        showBookmarksAction = new ShowBookmarksAction();
+        showDirectoryMetadataEntriesAction = new ShowDirectoryMetadataEntriesAction();
+        openBrowserPreferencePageAction = new OpenBrowserPreferencePageAction();
+
+        browserActionMap.put( newEntryAction, new BrowserViewActionProxy( viewer, new NewEntryAction( view.getSite()
+            .getWorkbenchWindow() ) ) );
+        browserActionMap.put( newSearchAction, new BrowserViewActionProxy( viewer, new NewSearchAction() ) );
+        browserActionMap.put( newBookmarkAction, new BrowserViewActionProxy( viewer, new NewBookmarkAction() ) );
+        browserActionMap.put( newBatchOperationAction, new BrowserViewActionProxy( viewer,
             new NewBatchOperationAction() ) );
 
-        this.browserActionMap.put( locateEntryInDitAction, new BrowserViewActionProxy( viewer,
-            new LocateEntryInDitAction() ) );
+        browserActionMap
+            .put( locateEntryInDitAction, new BrowserViewActionProxy( viewer, new LocateEntryInDitAction() ) );
+
+        browserActionMap.put( pasteAction, new BrowserViewActionProxy( viewer, new PasteAction() ) );
+        browserActionMap.put( copyAction, new BrowserViewActionProxy( viewer, new CopyAction(
+            ( BrowserActionProxy ) browserActionMap.get( pasteAction ) ) ) );
+        browserActionMap.put( deleteAction, new BrowserViewActionProxy( viewer, new DeleteAction() ) );
+        browserActionMap.put( moveAction, new BrowserViewActionProxy( viewer, new MoveAction() ) );
+        browserActionMap.put( renameAction, new BrowserViewActionProxy( viewer, new RenameAction() ) );
 
-        this.browserActionMap.put( pasteAction, new BrowserViewActionProxy( viewer, new PasteAction() ) );
-        this.browserActionMap.put( copyAction, new BrowserViewActionProxy( viewer, new CopyAction(
-            ( BrowserActionProxy ) this.browserActionMap.get( pasteAction ) ) ) );
-        this.browserActionMap.put( deleteAction, new BrowserViewActionProxy( viewer, new DeleteAction() ) );
-        this.browserActionMap.put( moveAction, new BrowserViewActionProxy( viewer, new MoveAction() ) );
-        this.browserActionMap.put( renameAction, new BrowserViewActionProxy( viewer, new RenameAction() ) );
-
-        this.browserActionMap.put( copyDnAction, new BrowserViewActionProxy( viewer, new CopyDnAction() ) );
-        this.browserActionMap.put( copyUrlAction, new BrowserViewActionProxy( viewer, new CopyUrlAction() ) );
-
-        this.browserActionMap.put( copyEntryAsLdifAction, new BrowserViewActionProxy( viewer,
-            new CopyEntryAsLdifAction( CopyEntryAsLdifAction.MODE_NORMAL ) ) );
-        this.browserActionMap.put( copyEntryAsLdifDnOnlyAction, new BrowserViewActionProxy( viewer,
+        browserActionMap.put( copyDnAction, new BrowserViewActionProxy( viewer, new CopyDnAction() ) );
+        browserActionMap.put( copyUrlAction, new BrowserViewActionProxy( viewer, new CopyUrlAction() ) );
+
+        browserActionMap.put( copyEntryAsLdifAction, new BrowserViewActionProxy( viewer, new CopyEntryAsLdifAction(
+            CopyEntryAsLdifAction.MODE_NORMAL ) ) );
+        browserActionMap.put( copyEntryAsLdifDnOnlyAction, new BrowserViewActionProxy( viewer,
             new CopyEntryAsLdifAction( CopyEntryAsLdifAction.MODE_DN_ONLY ) ) );
-        this.browserActionMap.put( copyEntryAsLdifReturningAttributesOnlyAction, new BrowserViewActionProxy( viewer,
+        browserActionMap.put( copyEntryAsLdifReturningAttributesOnlyAction, new BrowserViewActionProxy( viewer,
             new CopyEntryAsLdifAction( CopyEntryAsLdifAction.MODE_RETURNING_ATTRIBUTES_ONLY ) ) );
-        this.browserActionMap.put( copyEntryAsLdifOperationalAction, new BrowserViewActionProxy( viewer,
+        browserActionMap.put( copyEntryAsLdifOperationalAction, new BrowserViewActionProxy( viewer,
             new CopyEntryAsLdifAction( CopyEntryAsLdifAction.MODE_INCLUDE_OPERATIONAL_ATTRIBUTES ) ) );
-        this.browserActionMap.put( copyEntryAsCsvAction, new BrowserViewActionProxy( viewer, new CopyEntryAsCsvAction(
+        browserActionMap.put( copyEntryAsCsvAction, new BrowserViewActionProxy( viewer, new CopyEntryAsCsvAction(
             CopyEntryAsLdifAction.MODE_NORMAL ) ) );
-        this.browserActionMap.put( copyEntryAsCsvDnOnlyAction, new BrowserViewActionProxy( viewer,
-            new CopyEntryAsCsvAction( CopyEntryAsLdifAction.MODE_DN_ONLY ) ) );
-        this.browserActionMap.put( copyEntryAsCsvReturningAttributesOnlyAction, new BrowserViewActionProxy( viewer,
+        browserActionMap.put( copyEntryAsCsvDnOnlyAction, new BrowserViewActionProxy( viewer, new CopyEntryAsCsvAction(
+            CopyEntryAsLdifAction.MODE_DN_ONLY ) ) );
+        browserActionMap.put( copyEntryAsCsvReturningAttributesOnlyAction, new BrowserViewActionProxy( viewer,
             new CopyEntryAsCsvAction( CopyEntryAsLdifAction.MODE_RETURNING_ATTRIBUTES_ONLY ) ) );
-        this.browserActionMap.put( copyEntryAsCsvOperationalAction, new BrowserViewActionProxy( viewer,
+        browserActionMap.put( copyEntryAsCsvOperationalAction, new BrowserViewActionProxy( viewer,
             new CopyEntryAsCsvAction( CopyEntryAsLdifAction.MODE_INCLUDE_OPERATIONAL_ATTRIBUTES ) ) );
 
-        this.browserActionMap.put( importDsmlAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
-                ImportExportAction.TYPE_IMPORT_DSML ) ) );
-        this.browserActionMap.put( exportDsmlAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+        browserActionMap.put( importDsmlAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+            ImportExportAction.TYPE_IMPORT_DSML ) ) );
+        browserActionMap.put( exportDsmlAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_EXPORT_DSML ) ) );
-        this.browserActionMap.put( importLdifAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+        browserActionMap.put( importLdifAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_IMPORT_LDIF ) ) );
-        this.browserActionMap.put( exportLdifAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+        browserActionMap.put( exportLdifAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_EXPORT_LDIF ) ) );
-        this.browserActionMap.put( exportCsvAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+        browserActionMap.put( exportCsvAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_EXPORT_CSV ) ) );
-        this.browserActionMap.put( exportExcelAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
+        browserActionMap.put( exportExcelAction, new BrowserViewActionProxy( viewer, new ImportExportAction(
             ImportExportAction.TYPE_EXPORT_EXCEL ) ) );
 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void dispose()
     {
-        if ( this.openBrowserPreferencePageAction != null )
+        if ( openBrowserPreferencePageAction != null )
         {
             linkWithEditorAction.dispose();
             linkWithEditorAction = null;
 
-            this.showDITAction.dispose();
-            this.showDITAction = null;
-            this.showSearchesAction.dispose();
-            this.showSearchesAction = null;
-            this.showBookmarksAction.dispose();
-            this.showBookmarksAction = null;
-            this.showDirectoryMetadataEntriesAction.dispose();
-            this.showDirectoryMetadataEntriesAction = null;
-            this.openBrowserPreferencePageAction.dispose();
-            this.openBrowserPreferencePageAction = null;
+            showDITAction.dispose();
+            showDITAction = null;
+            showSearchesAction.dispose();
+            showSearchesAction = null;
+            showBookmarksAction.dispose();
+            showBookmarksAction = null;
+            showDirectoryMetadataEntriesAction.dispose();
+            showDirectoryMetadataEntriesAction = null;
+            openBrowserPreferencePageAction.dispose();
+            openBrowserPreferencePageAction = null;
 
-            this.openBrowserPreferencePageAction = null;
+            openBrowserPreferencePageAction = null;
         }
 
         super.dispose();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void fillToolBar( IToolBarManager toolBarManager )
     {
 
-        toolBarManager.add( ( IAction ) this.browserActionMap.get( upAction ) );
+        toolBarManager.add( ( IAction ) browserActionMap.get( upAction ) );
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) this.browserActionMap.get( refreshAction ) );
+        toolBarManager.add( ( IAction ) browserActionMap.get( refreshAction ) );
         toolBarManager.add( new Separator() );
         toolBarManager.add( collapseAllAction );
         toolBarManager.add( linkWithEditorAction );
@@ -224,112 +274,120 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void fillMenu( IMenuManager menuManager )
     {
 
-        menuManager.add( this.openSortDialogAction );
+        menuManager.add( openSortDialogAction );
         menuManager.add( new Separator() );
-        menuManager.add( this.showDITAction );
-        menuManager.add( this.showSearchesAction );
-        menuManager.add( this.showBookmarksAction );
-        menuManager.add( this.showDirectoryMetadataEntriesAction );
+        menuManager.add( showDITAction );
+        menuManager.add( showSearchesAction );
+        menuManager.add( showBookmarksAction );
+        menuManager.add( showDirectoryMetadataEntriesAction );
         menuManager.add( new Separator() );
-        menuManager.add( this.openBrowserPreferencePageAction );
+        menuManager.add( openBrowserPreferencePageAction );
         menuManager.update( true );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void menuAboutToShow( IMenuManager menuManager )
     {
-
         // new
-        menuManager.add( ( IAction ) this.browserActionMap.get( newEntryAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( newSearchAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( newBookmarkAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( newBatchOperationAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( newEntryAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( newSearchAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( newBookmarkAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( newBatchOperationAction ) );
         menuManager.add( new Separator() );
 
         // navigation
-        BrowserViewActionProxy leid = ( BrowserViewActionProxy ) this.browserActionMap.get( locateEntryInDitAction );
+        BrowserViewActionProxy leid = ( BrowserViewActionProxy ) browserActionMap.get( locateEntryInDitAction );
         leid.setImageDescriptor( leid.getAction().getImageDescriptor() );
         menuManager.add( leid );
-        menuManager.add( ( IAction ) this.browserActionMap.get( upAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( upAction ) );
         menuManager.add( new Separator() );
 
         // copy/paste/...
-        menuManager.add( ( IAction ) this.browserActionMap.get( copyAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( pasteAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( deleteAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( moveAction ) );
-        menuManager.add( ( IAction ) this.browserActionMap.get( renameAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( copyAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( pasteAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( deleteAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( moveAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( renameAction ) );
         MenuManager advancedMenuManager = new MenuManager( "Advanced" );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyDnAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyUrlAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyDnAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyUrlAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsLdifDnOnlyAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsLdifReturningAttributesOnlyAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsLdifAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsLdifOperationalAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsLdifDnOnlyAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsLdifReturningAttributesOnlyAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsLdifAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsLdifOperationalAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsCsvDnOnlyAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsCsvReturningAttributesOnlyAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsCsvAction ) );
-        advancedMenuManager.add( ( IAction ) this.browserActionMap.get( copyEntryAsCsvOperationalAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsCsvDnOnlyAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsCsvReturningAttributesOnlyAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsCsvAction ) );
+        advancedMenuManager.add( ( IAction ) browserActionMap.get( copyEntryAsCsvOperationalAction ) );
         advancedMenuManager.add( new Separator() );
         menuManager.add( advancedMenuManager );
         menuManager.add( new Separator() );
 
         // filter, batch
-        menuManager.add( ( IAction ) this.browserActionMap.get( filterChildrenAction ) );
-        if ( ( ( IAction ) this.browserActionMap.get( unfilterChildrenAction ) ).isEnabled() )
+        menuManager.add( ( IAction ) browserActionMap.get( filterChildrenAction ) );
+        if ( ( ( IAction ) browserActionMap.get( unfilterChildrenAction ) ).isEnabled() )
         {
-            menuManager.add( ( IAction ) this.browserActionMap.get( unfilterChildrenAction ) );
+            menuManager.add( ( IAction ) browserActionMap.get( unfilterChildrenAction ) );
         }
         menuManager.add( new Separator() );
 
         // import/export
         MenuManager importMenuManager = new MenuManager( "Import" );
-        importMenuManager.add( ( IAction ) this.browserActionMap.get( importLdifAction ) );
-        importMenuManager.add( ( IAction ) this.browserActionMap.get( importDsmlAction ) );
+        importMenuManager.add( ( IAction ) browserActionMap.get( importLdifAction ) );
+        importMenuManager.add( ( IAction ) browserActionMap.get( importDsmlAction ) );
         importMenuManager.add( new Separator() );
         menuManager.add( importMenuManager );
 
         MenuManager exportMenuManager = new MenuManager( "Export" );
-        exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportLdifAction ) );
-        exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportDsmlAction ) );
+        exportMenuManager.add( ( IAction ) browserActionMap.get( exportLdifAction ) );
+        exportMenuManager.add( ( IAction ) browserActionMap.get( exportDsmlAction ) );
         exportMenuManager.add( new Separator() );
-        exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportCsvAction ) );
-        exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportExcelAction ) );
+        exportMenuManager.add( ( IAction ) browserActionMap.get( exportCsvAction ) );
+        exportMenuManager.add( ( IAction ) browserActionMap.get( exportExcelAction ) );
         menuManager.add( exportMenuManager );
         menuManager.add( new Separator() );
 
         // refresh
-        menuManager.add( ( IAction ) this.browserActionMap.get( refreshAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( refreshAction ) );
         menuManager.add( new Separator() );
 
         // additions
         menuManager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
 
         // properties
-        menuManager.add( ( IAction ) this.browserActionMap.get( propertyDialogAction ) );
+        menuManager.add( ( IAction ) browserActionMap.get( propertyDialogAction ) );
 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void activateGlobalActionHandlers()
     {
 
-        if ( this.actionBars != null )
+        if ( actionBars != null )
         {
-            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) this.browserActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) browserActionMap
                 .get( copyAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), ( IAction ) this.browserActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), ( IAction ) browserActionMap
                 .get( pasteAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), ( IAction ) this.browserActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), ( IAction ) browserActionMap
                 .get( deleteAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.MOVE.getId(), ( IAction ) this.browserActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.MOVE.getId(), ( IAction ) browserActionMap
                 .get( moveAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.RENAME.getId(), ( IAction ) this.browserActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.RENAME.getId(), ( IAction ) browserActionMap
                 .get( renameAction ) );
         }
 
@@ -339,17 +397,20 @@
             ICommandService.class );
         if ( commandService != null )
         {
-            IAction leid = ( IAction ) this.browserActionMap.get( locateEntryInDitAction );
+            IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
             commandService.getCommand( leid.getActionDefinitionId() ).setHandler( new ActionHandler( leid ) );
         }
 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void deactivateGlobalActionHandlers()
     {
 
-        if ( this.actionBars != null )
+        if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
             actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), null );
@@ -364,7 +425,7 @@
             ICommandService.class );
         if ( commandService != null )
         {
-            IAction leid = ( IAction ) this.browserActionMap.get( locateEntryInDitAction );
+            IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
             commandService.getCommand( leid.getActionDefinitionId() ).setHandler( null );
         }
 



Mime
View raw message