directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r810123 - in /directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio: entryeditors/EntryEditorInput.java ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java ldapbrowser/ui/views/browser/LinkWithEditorAction.java
Date Tue, 01 Sep 2009 17:03:07 GMT
Author: seelmann
Date: Tue Sep  1 17:03:07 2009
New Revision: 810123

URL: http://svn.apache.org/viewvc?rev=810123&view=rev
Log:
DIRSTUDIO-517: Fixed link with editor action

Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java?rev=810123&r1=810122&r2=810123&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java
Tue Sep  1 17:03:07 2009
@@ -260,7 +260,11 @@
      */
     public int hashCode()
     {
-        if ( extension != null && extension.isMultiWindow() )
+        if ( extension == null )
+        {
+            return 0;
+        }
+        else if ( extension.isMultiWindow() )
         {
             return getResolvedEntry() == null ? 0 : getResolvedEntry().getDn().hashCode();
         }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java?rev=810123&r1=810122&r2=810123&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java
Tue Sep  1 17:03:07 2009
@@ -21,11 +21,17 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
 
 
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
 import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IShowEditorInput;
 
 
+
 /**
  * An entry editor the opens all entries in one single editor tab.
  *
@@ -51,10 +57,40 @@
      */
     public void showEditorInput( IEditorInput input )
     {
-        setInput( input );
-
-        getSite().getPage().getNavigationHistory().markLocation( this );
-        //firePropertyChange( IEditorPart.PROP_INPUT );
+        if ( input instanceof EntryEditorInput )
+        {
+            /*
+             * Workaround to make link-with-editor working for the single-tab editor:
+             * The call of firePropertyChange is used to inform the link-with-editor action.
+             * However firePropertyChange also modifies the navigation history.
+             * Thus, a dummy input with the real entry but a null extension is set.
+             * This avoids to modification of the navigation history.
+             * Afterwards the real input is set.
+             */
+            EntryEditorInput eei = ( EntryEditorInput ) input;
+            IEntry entry = eei.getEntryInput();
+            ISearchResult searchResult = eei.getSearchResultInput();
+            IBookmark bookmark = eei.getBookmarkInput();
+            EntryEditorInput dummyInput; 
+            if(entry != null)
+            {
+                dummyInput = new EntryEditorInput( entry, null );
+            }
+            else if(searchResult != null)
+            {
+                dummyInput = new EntryEditorInput( searchResult, null );
+            }
+            else
+            {
+                dummyInput = new EntryEditorInput( bookmark, null );
+            }
+            setInput( dummyInput );
+            firePropertyChange( IEditorPart.PROP_INPUT );
+            
+            // now set the real input and mark history location
+            setInput( input );
+            getSite().getPage().getNavigationHistory().markLocation( this );
+        }
     }
 
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java?rev=810123&r1=810122&r2=810123&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
Tue Sep  1 17:03:07 2009
@@ -94,6 +94,7 @@
          */
         public void partInputChanged( IWorkbenchPartReference partRef )
         {
+            linkViewWithEditor( partRef.getPart( false ) );
         }
 
 



Mime
View raw message