Author: seelmann
Date: Tue Sep 1 13:12:18 2009
New Revision: 810018
URL: http://svn.apache.org/viewvc?rev=810018&view=rev
Log:
Partial fix of DIRSTUDIO-517 and DIRSTUDIO-518:
o Implemented single-tab and multi-tab entry editor
o Moved EntryEditorInput class to generic package
o Commented code that opens the Entry Editor when an entry is selected, using open actions in EntryEditorMenuManager and OpenEntryEditorAction instead
o Removed the oneInstanceHack, using an IEditorMatchingStrategy instead
Added:
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java
- copied, changed from r809464, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorInput.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.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/editors/entry/SingleTabEntryEditorMatchingStrategy.java
Removed:
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorInput.java
Modified:
directory/studio/trunk/ldapbrowser-ui/plugin.properties
directory/studio/trunk/ldapbrowser-ui/plugin.xml
directory/studio/trunk/ldapbrowser-ui/plugin_de.properties
directory/studio/trunk/ldapbrowser-ui/plugin_fr.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorMenuManager.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenEntryEditorAction.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorNavigationLocation.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/LinkWithEditorAction.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java
Modified: directory/studio/trunk/ldapbrowser-ui/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin.properties?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin.properties Tue Sep 1 13:12:18 2009
@@ -23,8 +23,14 @@
ActionSet_LdapMenuActionSet_id=org.apache.directory.studio.ldapbrowser.ldapMenuActionSet
ActionSet_LdapMenuActionSet_label=LDAP Menu
-Editor_EntryEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor
-Editor_EntryEditor_name=Entry Editor
+Editor_SingleTabEntryEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabEntryEditor
+Editor_SingleTabEntryEditor_shortname=Entry Editor
+Editor_SingleTabEntryEditor_fullname=Entry Editor (single-tab)
+Editor_SingleTabEntryEditor_description=Opens each entry in a single editor tab.
+Editor_MultiTabEntryEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.entry.MultiTabEntryEditor
+Editor_MultiTabEntryEditor_shortname=Entry Editor
+Editor_MultiTabEntryEditor_fullname=Entry Editor (multi-tab)
+Editor_MultiTabEntryEditor_description=Opens each entry in a separate editor tab.
Editor_SearchResultEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditor
Editor_SearchResultEditor_name=Search Result Editor
Modified: directory/studio/trunk/ldapbrowser-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin.xml?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin.xml (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin.xml Tue Sep 1 13:12:18 2009
@@ -39,11 +39,19 @@
+ class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabEntryEditor"
+ default="true"
+ icon="resources/icons/browser_entryeditor.gif"
+ id="%Editor_SingleTabEntryEditor_id"
+ matchingStrategy="org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabEntryEditorMatchingStrategy"
+ name="%Editor_SingleTabEntryEditor_shortname"/>
+
+
+ multiWindow="true">
Modified: directory/studio/trunk/ldapbrowser-ui/plugin_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin_de.properties?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin_de.properties Tue Sep 1 13:12:18 2009
@@ -17,7 +17,12 @@
ActionSet_LdapMenuActionSet_label=LDAP Men\u00FC
-Editor_EntryEditor_name=Eintrags-Editor
+Editor_SingleTabEntryEditor_shortname=Eintrags-Editor
+Editor_SingleTabEntryEditor_fullname=Eintrags-Editor (ein Tab)
+Editor_SingleTabEntryEditor_description=\u00D6ffnet jeden Eintrag im selben Editor Tab
+Editor_MultiTabEntryEditor_shortname=Eintrags-Editor
+Editor_MultiTabEntryEditor_fullname=Eintrags-Editor (mehrere Tabs)
+Editor_MultiTabEntryEditor_description=\u00D6ffnet jeden Eintrag in einem separaten Editor Tab
Editor_SearchResultEditor_name=Suchresultat Editor
Modified: directory/studio/trunk/ldapbrowser-ui/plugin_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin_fr.properties?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin_fr.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin_fr.properties Tue Sep 1 13:12:18 2009
@@ -17,7 +17,13 @@
ActionSet_LdapMenuActionSet_label=Menu LDAP
-Editor_EntryEditor_name=Editeur d'entr\u00E9e
+Editor_SingleTabEntryEditor_shortname=Editeur d'entr\u00E9e
+Editor_SingleTabEntryEditor_fullname=Editeur d'entr\u00E9e TODO:(single-tab)
+Editor_SingleTabEntryEditor_description=TODO:Opens each entry in a single editor tab.
+Editor_MultiTabEntryEditor_shortname=Editeur d'entr\u00E9e
+Editor_MultiTabEntryEditor_fullname=Editeur d'entr\u00E9e TODO:(multi-tab)
+Editor_MultiTabEntryEditor_description=TODO:Opens each entry in a separate editor tab.
+
Editor_SearchResultEditor_name=Editeur de recherche
Editor_SchemaBrowser_name=Explorateur de sch\u00E9ma
Copied: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java (from r809464, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorInput.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java?p2=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorInput.java&r1=809464&r2=810018&rev=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorInput.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorInput.java Tue Sep 1 13:12:18 2009
@@ -18,14 +18,12 @@
*
*/
-package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+package org.apache.directory.studio.entryeditors;
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.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
@@ -33,19 +31,6 @@
/**
* The input for the entry editor.
- *
- * There is a trick to provide a single instance of the entry editor:
- *
- * - If oneInstanceHackEnabled is true the equals method returns always
- * true as long as the compared object is also of type EntryEditorInput.
- * With this trick only one instance of the entry editor is opened
- * by the eclipse editor framework.
- *
- If oneInstanceHackEnabled is false the equals method returns
- * true only if the wrapped objects (IEntry, ISearchResult or
- * IBookmark) are equal. This is necessary for the history navigation
- * because it must be able to distinguish the different
- * input objects.
- *
*
* @author Apache Directory Project
* @version $Rev$, $Date$
@@ -62,8 +47,8 @@
/** The bookmark input */
private IBookmark bookmark;
- /** One instance hack flag */
- private static boolean oneInstanceHackEnabled = true;
+ /** The entry editor extension. */
+ private EntryEditorExtension extension;
/**
@@ -72,11 +57,9 @@
*
* @param entry the entry input
*/
- public EntryEditorInput( IEntry entry )
+ public EntryEditorInput( IEntry entry, EntryEditorExtension extension )
{
- this.entry = entry;
- this.searchResult = null;
- this.bookmark = null;
+ this( entry, null, null, extension );
}
@@ -86,11 +69,9 @@
*
* @param searchResult the search result input
*/
- public EntryEditorInput( ISearchResult searchResult )
+ public EntryEditorInput( ISearchResult searchResult, EntryEditorExtension extension )
{
- this.entry = null;
- this.searchResult = searchResult;
- this.bookmark = null;
+ this( null, searchResult, null, extension );
}
@@ -100,11 +81,19 @@
*
* @param bookmark the bookmark input
*/
- public EntryEditorInput( IBookmark bookmark )
+ public EntryEditorInput( IBookmark bookmark, EntryEditorExtension extension )
+ {
+ this( null, null, bookmark, extension );
+ }
+
+
+ private EntryEditorInput( IEntry entry, ISearchResult searchResult, IBookmark bookmark,
+ EntryEditorExtension extension )
{
- this.entry = null;
- this.searchResult = null;
+ this.entry = entry;
+ this.searchResult = searchResult;
this.bookmark = bookmark;
+ this.extension = extension;
}
@@ -126,7 +115,7 @@
*/
public ImageDescriptor getImageDescriptor()
{
- return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ATTRIBUTE );
+ return extension.getIcon();
}
@@ -135,7 +124,7 @@
*/
public String getName()
{
- return Messages.getString( "EntryEditorInput.EntryEditor" ); //$NON-NLS-1$
+ return getResolvedEntry() != null ? getResolvedEntry().getDn().getUpName() : ""; //$NON-NLS-1$
}
@@ -144,7 +133,7 @@
*/
public String getToolTipText()
{
- return ""; //$NON-NLS-1$
+ return getResolvedEntry() != null ? getResolvedEntry().getDn().getUpName() : ""; //$NON-NLS-1$
}
@@ -169,6 +158,17 @@
/**
+ * Gets the entry editor extension.
+ *
+ * @return the entry editor extension
+ */
+ public EntryEditorExtension getExtension()
+ {
+ return extension;
+ }
+
+
+ /**
* Gets the resolved entry, either the entry input itself
* or the entry behind the search result intput or the entry behind
* the bookmark input.
@@ -260,7 +260,14 @@
*/
public int hashCode()
{
- return getToolTipText().hashCode();
+ if ( extension != null && extension.isMultiWindow() )
+ {
+ return getResolvedEntry() == null ? 0 : getResolvedEntry().getDn().hashCode();
+ }
+ else
+ {
+ return 0;
+ }
}
@@ -271,50 +278,35 @@
*/
public boolean equals( Object obj )
{
- boolean equal;
-
- if ( oneInstanceHackEnabled )
+ if ( !( obj instanceof EntryEditorInput ) )
{
- equal = ( obj instanceof EntryEditorInput );
+ return false;
}
- else
+
+ EntryEditorInput other = ( EntryEditorInput ) obj;
+
+ if ( extension == null && other.extension == null )
{
- if ( obj instanceof EntryEditorInput )
- {
- EntryEditorInput other = ( EntryEditorInput ) obj;
- if ( this.getInput() == null && other.getInput() == null )
- {
- return true;
- }
- else if ( this.getInput() == null || other.getInput() == null )
- {
- return false;
- }
- else
- {
- equal = other.getInput().equals( this.getInput() );
- }
- }
- else
- {
- equal = false;
- }
+ return true;
}
- return equal;
- }
-
+ if ( this.getExtension() != other.getExtension() )
+ {
+ return false;
+ }
- /**
- * Enables or disabled the one instance hack.
- *
- * @param b
- * true to enable the one instance hack,
- * false to disable the one instance hack
- */
- public static void enableOneInstanceHack( boolean b )
- {
- oneInstanceHackEnabled = b;
+ if ( this.getInput() == null && other.getInput() == null )
+ {
+ return true;
+ }
+ else if ( this.getInput() == null || other.getInput() == null )
+ {
+ return false;
+ }
+ else
+ {
+ return other.getInput().equals( this.getInput() );
+ }
}
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java Tue Sep 1 13:12:18 2009
@@ -28,6 +28,9 @@
import java.util.List;
import java.util.Map;
+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.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -36,6 +39,9 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -64,7 +70,7 @@
public static final String PRIORITIES_SEPARATOR = ",";
/** The list of entry editors */
- private Collection entryEditorExtensions = new ArrayList();
+ private Map entryEditorExtensions = new HashMap();
/** The comparator for entry editors */
private Comparator entryEditorComparator = new Comparator()
@@ -123,7 +129,7 @@
*/
private void initEntryEditorExtensions()
{
- entryEditorExtensions = new ArrayList();
+ entryEditorExtensions = new HashMap();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint( BrowserUIConstants.ENTRY_EDITOR_EXTENSION_POINT );
@@ -133,7 +139,6 @@
for ( int m = 0; m < members.length; m++ )
{
EntryEditorExtension bean = new EntryEditorExtension();
- entryEditorExtensions.add( bean );
IConfigurationElement member = members[m];
IExtension extension = member.getDeclaringExtension();
@@ -153,6 +158,8 @@
bean.setEditorId( member.getAttribute( EDITOR_ID_ATTR ) );
bean.setMultiWindow( "true".equalsIgnoreCase( member.getAttribute( MULTI_WINDOW_ATTR ) ) );
bean.setPriority( Integer.parseInt( member.getAttribute( PRIORITY_ATTR ) ) );
+
+ entryEditorExtensions.put( bean.getId(), bean );
}
}
@@ -164,7 +171,20 @@
*/
public Collection getEntryEditorExtensions()
{
- return entryEditorExtensions;
+ return entryEditorExtensions.values();
+ }
+
+
+ /**
+ * Gets the entry editor extension.
+ *
+ * @param id the entry editor extension id
+ *
+ * @return the entry editor extension, null if none found
+ */
+ public EntryEditorExtension getEntryEditorExtension( String id )
+ {
+ return entryEditorExtensions.get( id );
}
@@ -292,4 +312,35 @@
return sortedEntryEditorsList;
}
+
+
+ public void openEntryEditor( EntryEditorExtension extension, IEntry[] entries, ISearchResult[] searchResults,
+ IBookmark[] bookmarks )
+ {
+ IEditorInput input = null;
+ if ( entries.length == 1 )
+ {
+ input = new EntryEditorInput( entries[0], extension );
+ }
+ else if ( searchResults.length == 1 )
+ {
+ input = new EntryEditorInput( searchResults[0], extension );
+ }
+ else if ( bookmarks.length == 1 )
+ {
+ input = new EntryEditorInput( bookmarks[0], extension );
+ }
+
+ String editorId = extension.getEditorId();
+
+ try
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor( input, editorId, false );
+ }
+ catch ( PartInitException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java Tue Sep 1 13:12:18 2009
@@ -177,8 +177,10 @@
public static final String PERSPECTIVE_SCHEMA_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties()
.getString( "Perspective_SchemaEditor_id" ); //$NON-NLS-1$
- public static final String EDITOR_ENTRY_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties().getString(
- "Editor_EntryEditor_id" ); //$NON-NLS-1$
+ public static final String EDITOR_SINGLE_TAB_ENTRY_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties()
+ .getString( "Editor_SingleTabEntryEditor_id" ); //$NON-NLS-1$
+ public static final String EDITOR_MULTI_TAB_ENTRY_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties()
+ .getString( "Editor_MultiTabEntryEditor_id" ); //$NON-NLS-1$
public static final String EDITOR_SCHEMA_BROWSER = BrowserUIPlugin.getDefault().getPluginProperties().getString(
"Editor_SchemaBrowser_id" ); //$NON-NLS-1$
public static final String EDITOR_SEARCH_RESULT = BrowserUIPlugin.getDefault().getPluginProperties().getString(
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorMenuManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorMenuManager.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorMenuManager.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorMenuManager.java Tue Sep 1 13:12:18 2009
@@ -23,6 +23,7 @@
import java.util.Collection;
import org.apache.directory.studio.entryeditors.EntryEditorExtension;
+import org.apache.directory.studio.entryeditors.EntryEditorManager;
import org.apache.directory.studio.ldapbrowser.common.actions.BrowserSelectionUtils;
import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
@@ -34,10 +35,8 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.PlatformUI;
public class EntryEditorMenuManager extends MenuManager implements IMenuListener
@@ -95,16 +94,19 @@
* @return
* an action associated with the entry editor
*/
- private IAction createAction( EntryEditorExtension entryEditorExtension )
+ private IAction createAction( final EntryEditorExtension entryEditorExtension )
{
- final EntryEditorExtension entryEditorExtension2 = entryEditorExtension;
Action action = new Action( entryEditorExtension.getName() )
{
public void run()
{
- MessageDialog.openInformation( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- entryEditorExtension2.getName(), "Instead of this window, the \"" + entryEditorExtension2.getName()
- + "\" entry editor should be opened." );
+ EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
+ ISelection selection = selectionProvider.getSelection();
+ IEntry[] selectedEntries = BrowserSelectionUtils.getEntries( selection );
+ ISearchResult[] selectedSearchResults = BrowserSelectionUtils.getSearchResults( selection );
+ IBookmark[] selectedBookMarks = BrowserSelectionUtils.getBookmarks( selection );
+ entryEditorManager.openEntryEditor( entryEditorExtension, selectedEntries, selectedSearchResults,
+ selectedBookMarks );
}
};
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenEntryEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenEntryEditorAction.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenEntryEditorAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/OpenEntryEditorAction.java Tue Sep 1 13:12:18 2009
@@ -21,10 +21,13 @@
package org.apache.directory.studio.ldapbrowser.ui.actions;
+import java.util.Collection;
+
+import org.apache.directory.studio.entryeditors.EntryEditorExtension;
+import org.apache.directory.studio.entryeditors.EntryEditorManager;
import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.PlatformUI;
/**
@@ -49,8 +52,12 @@
*/
public void run()
{
- MessageDialog.openInformation( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Open Entry Editor", "Instead of this window, the entry editor should be opened." );
+ EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
+ Collection entryEditors = entryEditorManager.getSortedEntryEditorExtensions();
+ // TODO: check if the entry editor can "handle" the entry
+ EntryEditorExtension next = entryEditors.iterator().next();
+ entryEditorManager.openEntryEditor( next, getSelectedEntries(), getSelectedSearchResults(),
+ getSelectedBookmarks() );
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditor.java Tue Sep 1 13:12:18 2009
@@ -21,6 +21,7 @@
package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
@@ -33,7 +34,6 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.INavigationHistory;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.INavigationLocationProvider;
import org.eclipse.ui.IReusableEditor;
@@ -52,33 +52,32 @@
* @author Apache Directory Project
* @version $Rev$, $Date$
*/
-public class EntryEditor extends EditorPart implements INavigationLocationProvider, IReusableEditor
+public abstract class EntryEditor extends EditorPart implements INavigationLocationProvider, IReusableEditor
{
/** The editor configuration. */
- private EntryEditorConfiguration configuration;
+ protected EntryEditorConfiguration configuration;
/** The action group. */
- private EntryEditorActionGroup actionGroup;
+ protected EntryEditorActionGroup actionGroup;
/** The main widget. */
- private EntryEditorWidget mainWidget;
+ protected EntryEditorWidget mainWidget;
/** The universal listener. */
- private EntryEditorUniversalListener universalListener;
+ protected EntryEditorUniversalListener universalListener;
/** The outline page. */
- private EntryEditorOutlinePage outlinePage;
+ protected EntryEditorOutlinePage outlinePage;
/**
- * Gets the ID of the EntryEditor.
- *
- * @return the id of the EntryEditor
+ * {@inheritDoc}
*/
- public static String getId()
+ public void init( IEditorSite site, IEditorInput input ) throws PartInitException
{
- return BrowserUIConstants.EDITOR_ENTRY_EDITOR;
+ setSite( site );
+ setInput( input );
}
@@ -97,29 +96,11 @@
// inform listener
universalListener.setInput( entry );
- // mark location for back/forward history navigation
- if ( entry != null )
- {
- // disable one instance hack before fireing the input change event
- // otherwise the navigation history is cleared.
- // Note: seems this behavior has been changed with Eclipse 3.3
- EntryEditorInput.enableOneInstanceHack( false );
- firePropertyChange( IEditorPart.PROP_INPUT );
-
- // enable one instance hack for marking the location
- // Note: seems this behavior has been changed with Eclipse 3.3
- EntryEditorInput.enableOneInstanceHack( true );
- getSite().getPage().getNavigationHistory().markLocation( this );
- }
-
// refresh outline
if ( outlinePage != null )
{
outlinePage.refresh();
}
-
- // finally enable the one instance hack
- EntryEditorInput.enableOneInstanceHack( true );
}
}
@@ -127,22 +108,6 @@
/**
* {@inheritDoc}
*/
- public void init( IEditorSite site, IEditorInput input ) throws PartInitException
- {
- super.setSite( site );
-
- // mark dummy location, necessary because the first marked
- // location doesn't appear in history
- setInput( new EntryEditorInput( ( IEntry ) null ) );
- getSite().getPage().getNavigationHistory().markLocation( this );
-
- setInput( input );
- }
-
-
- /**
- * {@inheritDoc}
- */
public void createPartControl( Composite parent )
{
Composite composite = new Composite( parent, SWT.NONE );
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorNavigationLocation.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorNavigationLocation.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorNavigationLocation.java Tue Sep 1 13:12:18 2009
@@ -24,6 +24,9 @@
import javax.naming.InvalidNameException;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.entryeditors.EntryEditorExtension;
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.entryeditors.EntryEditorManager;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -31,8 +34,8 @@
import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.NavigationLocation;
@@ -118,6 +121,7 @@
EntryEditorInput eei = getEntryEditorInput();
if ( eei != null )
{
+ memento.putString( "EXTENSION", eei.getExtension().getId() ); //$NON-NLS-1$
if ( eei.getEntryInput() != null )
{
IEntry entry = eei.getEntryInput();
@@ -142,7 +146,6 @@
memento.putString( "CONNECTION", bookmark.getBrowserConnection().getConnection().getId() ); //$NON-NLS-1$
}
}
-
}
@@ -154,13 +157,16 @@
try
{
String type = memento.getString( "TYPE" ); //$NON-NLS-1$
+ String extensionId = memento.getString( "EXTENSION" ); //$NON-NLS-1$
+ EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
+ EntryEditorExtension entryEditorExtension = entryEditorManager.getEntryEditorExtension( extensionId );
if ( "IEntry".equals( type ) ) //$NON-NLS-1$
{
IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnectionById( memento.getString( "CONNECTION" ) ); //$NON-NLS-1$
LdapDN dn = new LdapDN( memento.getString( "DN" ) ); //$NON-NLS-1$
IEntry entry = connection.getEntryFromCache( dn );
- super.setInput( new EntryEditorInput( entry ) );
+ super.setInput( new EntryEditorInput( entry, entryEditorExtension ) );
}
else if ( "ISearchResult".equals( type ) ) //$NON-NLS-1$
{
@@ -173,7 +179,7 @@
{
if ( dn.equals( searchResults[i].getDn() ) )
{
- super.setInput( new EntryEditorInput( searchResults[i] ) );
+ super.setInput( new EntryEditorInput( searchResults[i], entryEditorExtension ) );
break;
}
}
@@ -183,14 +189,13 @@
IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnectionById( memento.getString( "CONNECTION" ) ); //$NON-NLS-1$
IBookmark bookmark = connection.getBookmarkManager().getBookmark( memento.getString( "BOOKMARK" ) ); //$NON-NLS-1$
- super.setInput( new EntryEditorInput( bookmark ) );
+ super.setInput( new EntryEditorInput( bookmark, entryEditorExtension ) );
}
}
catch ( InvalidNameException e )
{
e.printStackTrace();
}
-
}
@@ -199,12 +204,6 @@
*/
public void restoreLocation()
{
- IEditorPart editorPart = getEditorPart();
- if ( editorPart != null && editorPart instanceof EntryEditor )
- {
- EntryEditor entryEditor = ( EntryEditor ) editorPart;
- entryEditor.setInput( ( EntryEditorInput ) getInput() );
- }
}
@@ -257,7 +256,6 @@
*/
private EntryEditorInput getEntryEditorInput()
{
-
Object editorInput = getInput();
if ( editorInput != null && editorInput instanceof EntryEditorInput )
{
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java Tue Sep 1 13:12:18 2009
@@ -67,32 +67,33 @@
{
if ( entryEditor != null && part != null )
{
- if ( entryEditor.getSite().getWorkbenchWindow() == part.getSite().getWorkbenchWindow() )
- {
- IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
- ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
- IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
- Object[] objects = BrowserSelectionUtils.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 ) );
- }
- }
+ // TODO: should be removed, opening the editor and changing input will be completely managed by the browser view
+// if ( entryEditor.getSite().getWorkbenchWindow() == part.getSite().getWorkbenchWindow() )
+// {
+// IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
+// ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
+// IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
+// Object[] objects = BrowserSelectionUtils.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 ) );
+// }
+// }
}
}
};
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java?rev=810018&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabEntryEditor.java Tue Sep 1 13:12:18 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+
+
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.eclipse.ui.IEditorInput;
+
+
+/**
+ * An entry editor the opens a new editor tab for each entry.
+ *
+ * @author Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class MultiTabEntryEditor extends EntryEditor
+{
+
+ /**
+ * Gets the ID of the MultiTabEntryEditor.
+ *
+ * @return the id of the MultiTabEntryEditor
+ */
+ public static String getId()
+ {
+ return BrowserUIConstants.EDITOR_MULTI_TAB_ENTRY_EDITOR;
+ }
+
+ @Override
+ public void setInput( IEditorInput input )
+ {
+ super.setInput( input );
+
+ if(input instanceof EntryEditorInput)
+ {
+ EntryEditorInput entryEditorInput = (EntryEditorInput)input;
+ setPartName( entryEditorInput.getName() );
+ //setContentDescription( entryEditorInput.getName() );
+ }
+ }
+}
Added: 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=810018&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditor.java Tue Sep 1 13:12:18 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+
+
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IShowEditorInput;
+
+
+/**
+ * An entry editor the opens all entries in one single editor tab.
+ *
+ * @author Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class SingleTabEntryEditor extends EntryEditor implements IShowEditorInput
+{
+
+ /**
+ * Gets the ID of the SingleTabEntryEditor.
+ *
+ * @return the id of the SingleTabEntryEditor
+ */
+ public static String getId()
+ {
+ return BrowserUIConstants.EDITOR_SINGLE_TAB_ENTRY_EDITOR;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void showEditorInput( IEditorInput input )
+ {
+ setInput( input );
+
+ getSite().getPage().getNavigationHistory().markLocation( this );
+ //firePropertyChange( IEditorPart.PROP_INPUT );
+ }
+
+}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java?rev=810018&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java Tue Sep 1 13:12:18 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+
+
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+
+
+/**
+ * Matching strategy for the single tab entry editor.
+ *
+ * @author Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public class SingleTabEntryEditorMatchingStrategy implements IEditorMatchingStrategy
+{
+
+ /**
+ * Returns true if the given editor is the {@link SingleTabEntryEditor} and
+ * the input is not multi-window.
+ */
+ public boolean matches( IEditorReference editorRef, IEditorInput input )
+ {
+ if ( !editorRef.getId().equals( SingleTabEntryEditor.getId() ) )
+ {
+ return false;
+ }
+ if ( !( input instanceof EntryEditorInput ) )
+ {
+ return false;
+ }
+
+ EntryEditorInput entryEditorInput = ( EntryEditorInput ) input;
+
+ if ( entryEditorInput.getExtension() == null )
+ {
+ return false;
+ }
+ if ( entryEditorInput.getExtension().isMultiWindow() )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java Tue Sep 1 13:12:18 2009
@@ -52,7 +52,6 @@
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
-import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditor;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorInput;
import org.apache.directory.studio.ldapbrowser.ui.views.connection.ConnectionView;
@@ -226,7 +225,7 @@
*/
public void selectionChanged( SelectionChangedEvent event )
{
- ensureEditorsVisible( event.getSelection() );
+ //ensureEditorsVisible( event.getSelection() );
}
};
@@ -259,70 +258,71 @@
}
- /**
- * Ensures that the entry editor or the search result editor are
- * opended and ready to show the given selection.
- *
- * @param selection the browser's selection.
- */
- private void ensureEditorsVisible( ISelection selection )
- {
- if ( view != null )
- {
- IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
- ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
- IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
- ISearch[] searches = BrowserSelectionUtils.getSearches( selection );
-
- if ( entries.length + searchResults.length + bookmarks.length + searches.length == 1 )
- {
- if ( entries.length == 1 )
- {
- try
- {
- EntryEditorInput input = new EntryEditorInput( entries[0] );
- view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
- }
- catch ( PartInitException e )
- {
- }
- }
- else if ( searchResults.length == 1 )
- {
- try
- {
- EntryEditorInput input = new EntryEditorInput( searchResults[0] );
- view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
- }
- catch ( PartInitException e )
- {
- }
- }
- else if ( bookmarks.length == 1 )
- {
- try
- {
- EntryEditorInput input = new EntryEditorInput( bookmarks[0] );
- view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
- }
- catch ( PartInitException e )
- {
- }
- }
- else if ( searches.length == 1 )
- {
- try
- {
- SearchResultEditorInput input = new SearchResultEditorInput( searches[0] );
- view.getSite().getPage().openEditor( input, SearchResultEditor.getId(), false );
- }
- catch ( PartInitException e )
- {
- }
- }
- }
- }
- }
+ // TODO: remove this, use "open mode" instead
+// /**
+// * Ensures that the entry editor or the search result editor are
+// * opended and ready to show the given selection.
+// *
+// * @param selection the browser's selection.
+// */
+// private void ensureEditorsVisible( ISelection selection )
+// {
+// if ( view != null )
+// {
+// IEntry[] entries = BrowserSelectionUtils.getEntries( selection );
+// ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
+// IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
+// ISearch[] searches = BrowserSelectionUtils.getSearches( selection );
+//
+// if ( entries.length + searchResults.length + bookmarks.length + searches.length == 1 )
+// {
+// if ( entries.length == 1 )
+// {
+// try
+// {
+// EntryEditorInput input = new EntryEditorInput( entries[0] );
+// view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
+// }
+// catch ( PartInitException e )
+// {
+// }
+// }
+// else if ( searchResults.length == 1 )
+// {
+// try
+// {
+// EntryEditorInput input = new EntryEditorInput( searchResults[0] );
+// view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
+// }
+// catch ( PartInitException e )
+// {
+// }
+// }
+// else if ( bookmarks.length == 1 )
+// {
+// try
+// {
+// EntryEditorInput input = new EntryEditorInput( bookmarks[0] );
+// view.getSite().getPage().openEditor( input, EntryEditor.getId(), false );
+// }
+// catch ( PartInitException e )
+// {
+// }
+// }
+// else if ( searches.length == 1 )
+// {
+// try
+// {
+// SearchResultEditorInput input = new SearchResultEditorInput( searches[0] );
+// view.getSite().getPage().openEditor( input, SearchResultEditor.getId(), false );
+// }
+// catch ( PartInitException e )
+// {
+// }
+// }
+// }
+// }
+// }
/**
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=810018&r1=810017&r2=810018&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 13:12:18 2009
@@ -20,10 +20,10 @@
package org.apache.directory.studio.ldapbrowser.ui.views.browser;
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
-import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditor;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorInput;
import org.eclipse.jface.action.Action;
@@ -94,7 +94,6 @@
*/
public void partInputChanged( IWorkbenchPartReference partRef )
{
- linkViewWithEditor( partRef.getPart( false ) );
}
@@ -111,6 +110,7 @@
*/
public void partVisible( IWorkbenchPartReference partRef )
{
+ linkViewWithEditor( partRef.getPart( false ) );
}
};
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java?rev=810018&r1=810017&r2=810018&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/LinkWithEditorAction.java Tue Sep 1 13:12:18 2009
@@ -21,12 +21,12 @@
package org.apache.directory.studio.ldapbrowser.ui.views.connection;
+import org.apache.directory.studio.entryeditors.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
-import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditorInput;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditor;
import org.apache.directory.studio.ldapbrowser.ui.editors.searchresult.SearchResultEditorInput;
import org.eclipse.jface.action.Action;
@@ -102,7 +102,6 @@
*/
public void partInputChanged( IWorkbenchPartReference partRef )
{
- linkViewWithEditor( partRef.getPart( false ) );
}
@@ -119,6 +118,7 @@
*/
public void partVisible( IWorkbenchPartReference partRef )
{
+ linkViewWithEditor( partRef.getPart( false ) );
}
};