You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2009/09/05 12:19:17 UTC
svn commit: r811615 - in /directory/studio/trunk/ldapbrowser-ui: ./
src/main/java/org/apache/directory/studio/entryeditors/
src/main/java/org/apache/directory/studio/ldapbrowser/ui/
src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/
Author: seelmann
Date: Sat Sep 5 10:19:16 2009
New Revision: 811615
URL: http://svn.apache.org/viewvc?rev=811615&view=rev
Log:
Partial fix for DIRSTUDIO-519
o Added single-tab LDIF editor
o Some refactorings
Added:
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/Messages.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/SingleTabEntryEditorMatchingStrategy.java
- copied, changed from r811609, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
- copied, changed from r811609, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditorDocumentProvider.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorNavigationLocation.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabLdifEntryEditor.java
Removed:
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditorDocumentProvider.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java
Modified:
directory/studio/trunk/ldapbrowser-ui/plugin.properties
directory/studio/trunk/ldapbrowser-ui/plugin.xml
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.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/editors/entry/EntryEditorNavigationLocation.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditor.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
Modified: directory/studio/trunk/ldapbrowser-ui/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin.properties?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin.properties Sat Sep 5 10:19:16 2009
@@ -31,6 +31,10 @@
Editor_MultiTabEntryEditor_shortname=Entry Editor
Editor_MultiTabEntryEditor_fullname=Entry Editor (multi-tab)
Editor_MultiTabEntryEditor_description=Opens each entry in a separate editor tab.
+Editor_SingleTabLdifEntryEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabLdifEntryEditor
+Editor_SingleTabLdifEntryEditor_shortname=LDIF Entry Editor
+Editor_SingleTabLdifEntryEditor_fullname=LDIF Entry Editor (single-tab)
+Editor_SingleTabLdifEntryEditor_description=Opens each entry in a single editor tab.
Editor_MultiTabLdifEntryEditor_id=org.apache.directory.studio.ldapbrowser.ui.editors.entry.MultiTabLdifEntryEditor
Editor_MultiTabLdifEntryEditor_shortname=LDIF Entry Editor
Editor_MultiTabLdifEntryEditor_fullname=LDIF Entry Editor (multi-tab)
Modified: directory/studio/trunk/ldapbrowser-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/plugin.xml?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/plugin.xml (original)
+++ directory/studio/trunk/ldapbrowser-ui/plugin.xml Sat Sep 5 10:19:16 2009
@@ -43,7 +43,7 @@
default="true"
icon="resources/icons/browser_entryeditor.gif"
id="%Editor_SingleTabEntryEditor_id"
- matchingStrategy="org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabEntryEditorMatchingStrategy"
+ matchingStrategy="org.apache.directory.studio.entryeditors.SingleTabEntryEditorMatchingStrategy"
name="%Editor_SingleTabEntryEditor_shortname"/>
<editor
class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.MultiTabEntryEditor"
@@ -53,9 +53,17 @@
name="%Editor_MultiTabEntryEditor_shortname">
</editor>
<editor
+ class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabLdifEntryEditor"
+ default="false"
+ icon="resources/icons/ldifeditor_new.gif"
+ id="%Editor_SingleTabLdifEntryEditor_id"
+ matchingStrategy="org.apache.directory.studio.entryeditors.SingleTabEntryEditorMatchingStrategy"
+ name="%Editor_SingleTabLdifEntryEditor_shortname">
+ </editor>
+ <editor
class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.MultiTabLdifEntryEditor"
default="true"
- icon="resources/icons/browser_entryeditor.gif"
+ icon="resources/icons/ldifeditor_new.gif"
id="%Editor_MultiTabLdifEntryEditor_id"
name="%Editor_MultiTabLdifEntryEditor_shortname">
</editor>
@@ -464,18 +472,28 @@
icon="resources/icons/browser_entryeditor.gif"
id="%Editor_MultiTabEntryEditor_id"
name="%Editor_MultiTabEntryEditor_fullname"
- priority="1"
+ priority="3"
multiWindow="true">
</entryEditor>
<entryEditor
+ class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.SingleTabLdifEntryEditor"
+ description="%Editor_SingleTabLdifEntryEditor_description"
+ editorId="%Editor_SingleTabLdifEntryEditor_id"
+ icon="resources/icons/ldifeditor_new.gif"
+ id="%Editor_SingleTabLdifEntryEditor_id"
+ multiWindow="false"
+ name="%Editor_SingleTabLdifEntryEditor_fullname"
+ priority="1">
+ </entryEditor>
+ <entryEditor
class="org.apache.directory.studio.ldapbrowser.ui.editors.entry.MultiTabLdifEntryEditor"
description="%Editor_MultiTabLdifEntryEditor_description"
editorId="%Editor_MultiTabLdifEntryEditor_id"
- icon="resources/icons/browser_entryeditor.gif"
+ icon="resources/icons/ldifeditor_new.gif"
id="%Editor_MultiTabLdifEntryEditor_id"
multiWindow="true"
name="%Editor_MultiTabLdifEntryEditor_fullname"
- priority="1">
+ priority="2">
</entryEditor>
</extension>
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorUtils.java Sat Sep 5 10:19:16 2009
@@ -23,6 +23,8 @@
import org.apache.directory.studio.connection.ui.RunnableContextRunner;
import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
+import org.eclipse.osgi.util.NLS;
public class EntryEditorUtils
{
@@ -44,4 +46,55 @@
}
}
+ /**
+ * Gets the text used in the history navigation list.
+ *
+ * @param input the input
+ *
+ * @return the text
+ */
+ public static String getHistoryNavigationText( EntryEditorInput input )
+ {
+ if ( input != null )
+ {
+ if ( input.getEntryInput() != null )
+ {
+ if ( input.getEntryInput() instanceof IRootDSE )
+ {
+ return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
+ }
+ else
+ {
+ return NLS.bind( Messages.getString( "EntryEditorNavigationLocation.Entry" ), //$NON-NLS-1$
+ input.getEntryInput().getDn().getUpName() );
+ }
+ }
+ else if ( input.getSearchResultInput() != null )
+ {
+ if ( input.getSearchResultInput() instanceof IRootDSE )
+ {
+ return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
+ }
+ else
+ {
+ return NLS.bind( Messages.getString( "EntryEditorNavigationLocation.SearchResult" ), //$NON-NLS-1$
+ input.getSearchResultInput().getDn().getUpName() );
+ }
+ }
+ else if ( input.getBookmarkInput() != null )
+ {
+ if ( input.getBookmarkInput() instanceof IRootDSE )
+ {
+ return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
+ }
+ else
+ {
+ return NLS.bind( Messages.getString( "EntryEditorNavigationLocation.Bookmark" ), //$NON-NLS-1$
+ input.getBookmarkInput().getDn().getUpName() );
+ }
+ }
+ }
+
+ return null;
+ }
}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/Messages.java?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/Messages.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/Messages.java Sat Sep 5 10:19:16 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.entryeditors;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.apache.directory.studio.entryeditors.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+ private Messages()
+ {
+ }
+
+
+ public static String getString( String key )
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch ( MissingResourceException e )
+ {
+ return '!' + key + '!';
+ }
+ }
+}
Copied: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/SingleTabEntryEditorMatchingStrategy.java (from r811609, 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/entryeditors/SingleTabEntryEditorMatchingStrategy.java?p2=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/SingleTabEntryEditorMatchingStrategy.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java&r1=811609&r2=811615&rev=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabEntryEditorMatchingStrategy.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/SingleTabEntryEditorMatchingStrategy.java Sat Sep 5 10:19:16 2009
@@ -18,17 +18,16 @@
*
*/
-package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+package org.apache.directory.studio.entryeditors;
-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.
+ * Matching strategy for a single tab entry editor.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -37,20 +36,15 @@
{
/**
- * Returns true if the given editor is the {@link SingleTabEntryEditor} and
- * the input is not multi-window.
+ * Returns true if the given editor is single-tab and the input refers
+ * the same editor.
*/
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 )
@@ -61,6 +55,10 @@
{
return false;
}
+ if ( !editorRef.getId().equals( entryEditorInput.getExtension().getEditorId() ) )
+ {
+ return false;
+ }
return true;
}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties Sat Sep 5 10:19:16 2009
@@ -0,0 +1,21 @@
+# 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.
+
+EntryEditorNavigationLocation.Bookmark=Bookmark {0}
+EntryEditorNavigationLocation.Entry=Entry {0}
+EntryEditorNavigationLocation.RootDSE=Root DSE
+EntryEditorNavigationLocation.SearchResult=Search Result {0}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties Sat Sep 5 10:19:16 2009
@@ -0,0 +1,20 @@
+# 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.
+
+EntryEditorNavigationLocation.Bookmark=Lesezeichen {0}
+EntryEditorNavigationLocation.Entry=Eintrag {0}
+EntryEditorNavigationLocation.SearchResult=Suchergebnis {0}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties Sat Sep 5 10:19:16 2009
@@ -0,0 +1,21 @@
+# 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.
+
+EntryEditorNavigationLocation.Bookmark=Signet {0}
+EntryEditorNavigationLocation.Entry=Entr\u00E9e {0}
+EntryEditorNavigationLocation.RootDSE=Root DSE
+EntryEditorNavigationLocation.SearchResult=R\u00E9sultat de recherche {0}
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=811615&r1=811614&r2=811615&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 Sat Sep 5 10:19:16 2009
@@ -181,6 +181,10 @@
.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_SINGLE_TAB_LDIF_ENTRY_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties()
+ .getString( "Editor_SingleTabLdifEntryEditor_id" ); //$NON-NLS-1$
+ public static final String EDITOR_MULTI_TAB_LDIF_ENTRY_EDITOR = BrowserUIPlugin.getDefault().getPluginProperties()
+ .getString( "Editor_MultiTabLdifEntryEditor_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/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=811615&r1=811614&r2=811615&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 Sat Sep 5 10:19:16 2009
@@ -27,15 +27,14 @@
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.entryeditors.EntryEditorUtils;
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;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-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.IMemento;
import org.eclipse.ui.INavigationLocation;
import org.eclipse.ui.NavigationLocation;
@@ -66,50 +65,8 @@
*/
public String getText()
{
- EntryEditorInput eei = getEntryEditorInput();
- if ( eei != null )
- {
- if ( eei.getEntryInput() != null )
- {
- if ( eei.getEntryInput() instanceof IRootDSE )
- {
- return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
- }
- else
- {
- return NLS
- .bind(
- Messages.getString( "EntryEditorNavigationLocation.Entry" ), new String[] { eei.getEntryInput().getDn().getUpName() } ); //$NON-NLS-1$
- }
- }
- else if ( eei.getSearchResultInput() != null )
- {
- if ( eei.getSearchResultInput() instanceof IRootDSE )
- {
- return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
- }
- else
- {
- return NLS
- .bind(
- Messages.getString( "EntryEditorNavigationLocation.SearchResult" ), new String[] { eei.getSearchResultInput().getDn().getUpName() } ); //$NON-NLS-1$
- }
- }
- else if ( eei.getBookmarkInput() != null )
- {
- if ( eei.getBookmarkInput() instanceof IRootDSE )
- {
- return Messages.getString( "EntryEditorNavigationLocation.RootDSE" ); //$NON-NLS-1$
- }
- else
- {
- return NLS
- .bind(
- Messages.getString( "EntryEditorNavigationLocation.Bookmark" ), new String[] { eei.getBookmarkInput().getDn().getUpName() } ); //$NON-NLS-1$
- }
- }
- }
- return super.getText();
+ String text = EntryEditorUtils.getHistoryNavigationText( getEntryEditorInput() );
+ return text != null ? text : super.getText();
}
Copied: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java (from r811609, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditorDocumentProvider.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java?p2=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditorDocumentProvider.java&r1=811609&r2=811615&rev=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditorDocumentProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java Sat Sep 5 10:19:16 2009
@@ -52,7 +52,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class MultiTabLdifEntryEditorDocumentProvider extends LdifDocumentProvider
+public class LdifEntryEditorDocumentProvider extends LdifDocumentProvider
{
@Override
@@ -83,6 +83,22 @@
}
+ public IDocument getDocument( Object element )
+ {
+ if ( element instanceof EntryEditorInput )
+ {
+ EntryEditorInput input = ( EntryEditorInput ) element;
+ if ( input.getExtension() == null )
+ {
+ // this is a performance optimization
+ return null;
+ }
+ }
+
+ return super.getDocument( element );
+ }
+
+
/**
* Gets the difference between the original entry and the modified entry.
*
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorNavigationLocation.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorNavigationLocation.java?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorNavigationLocation.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorNavigationLocation.java Sat Sep 5 10:19:16 2009
@@ -0,0 +1,96 @@
+/*
+ * 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.entryeditors.EntryEditorUtils;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextSelectionNavigationLocation;
+
+/**
+ * Represents the text selection context marked for the user in the navigation history.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdifEntryEditorNavigationLocation extends TextSelectionNavigationLocation
+{
+
+ public LdifEntryEditorNavigationLocation(ITextEditor part, boolean initialize)
+ {
+ super(part, initialize);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText()
+ {
+ String text = EntryEditorUtils.getHistoryNavigationText( getEntryEditorInput() );
+ return text != null ? text : super.getText();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean mergeInto( INavigationLocation currentLocation )
+ {
+ if ( currentLocation == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != currentLocation.getClass() )
+ {
+ return false;
+ }
+
+ LdifEntryEditorNavigationLocation location = ( LdifEntryEditorNavigationLocation ) currentLocation;
+ Object other = location.getEntryEditorInput().getInput();
+ Object entry = getEntryEditorInput().getInput();
+
+ if ( other == null && entry == null )
+ {
+ return true;
+ }
+ else if ( other == null || entry == null )
+ {
+ return false;
+ }
+ else
+ {
+ return entry.equals( other );
+ }
+ }
+
+ private EntryEditorInput getEntryEditorInput()
+ {
+ Object editorInput = getInput();
+ if ( editorInput != null && editorInput instanceof EntryEditorInput )
+ {
+ EntryEditorInput entryEditorInput = ( EntryEditorInput ) editorInput;
+ return entryEditorInput;
+ }
+
+ return null;
+ }
+}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditor.java?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/MultiTabLdifEntryEditor.java Sat Sep 5 10:19:16 2009
@@ -21,8 +21,10 @@
package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.ldifeditor.editor.LdifEditor;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INavigationLocation;
/**
@@ -39,7 +41,18 @@
super();
// use our own document provider that saves changes to the directory
- setDocumentProvider( new MultiTabLdifEntryEditorDocumentProvider() );
+ setDocumentProvider( new LdifEntryEditorDocumentProvider() );
+ }
+
+
+ /**
+ * Gets the ID of the MultiTabLdifEntryEditor.
+ *
+ * @return the id of the MultiTabLdifEntryEditor
+ */
+ public static String getId()
+ {
+ return BrowserUIConstants.EDITOR_MULTI_TAB_LDIF_ENTRY_EDITOR;
}
@@ -61,4 +74,18 @@
return false;
}
+
+ @Override
+ public INavigationLocation createNavigationLocation()
+ {
+ return new LdifEntryEditorNavigationLocation( this, true );
+ }
+
+
+ @Override
+ public INavigationLocation createEmptyNavigationLocation()
+ {
+ return new LdifEntryEditorNavigationLocation( this, false );
+ }
+
}
Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabLdifEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabLdifEntryEditor.java?rev=811615&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabLdifEntryEditor.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/SingleTabLdifEntryEditor.java Sat Sep 5 10:19:16 2009
@@ -0,0 +1,122 @@
+/*
+ * 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.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.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IShowEditorInput;
+
+
+/**
+ * An single-tab entry editor that uses LDIF format.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SingleTabLdifEntryEditor extends MultiTabLdifEntryEditor implements IShowEditorInput
+{
+
+ private boolean inShowEditorInput = false;
+
+
+ /**
+ * Gets the ID of the SingleTabLdifEntryEditor.
+ *
+ * @return the id of the SingleTabLdifEntryEditor
+ */
+ public static String getId()
+ {
+ return BrowserUIConstants.EDITOR_SINGLE_TAB_LDIF_ENTRY_EDITOR;
+ }
+
+
+ public void showEditorInput( IEditorInput input )
+ {
+ if ( inShowEditorInput )
+ {
+ /*
+ * This is to avoid recursion when using history navigation:
+ * - when selecting an entry this method is called
+ * - this method fires an input changed event
+ * - the LinkWithEditorAction gets the event and selects the entry in the browser tree
+ * - this selection fires an selection event
+ * - the selection event causes an openEditor() that calls this method again
+ */
+ return;
+ }
+
+ try
+ {
+ inShowEditorInput = true;
+
+ 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 );
+ }
+ doSetInput( dummyInput );
+ firePropertyChange( IEditorPart.PROP_INPUT );
+
+ // now set the real input and mark history location
+ doSetInput( input );
+ getSite().getPage().getNavigationHistory().markLocation( this );
+ }
+ }
+ catch ( CoreException e )
+ {
+ throw new RuntimeException( e );
+ }
+ finally
+ {
+ inShowEditorInput = false;
+ }
+ }
+
+}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages.properties Sat Sep 5 10:19:16 2009
@@ -19,10 +19,6 @@
EntryEditorActionGroup.OpenSchemaBrowser=Open Schema Browser
EntryEditorActionGroup.ShowIn=Show In
EntryEditorInput.EntryEditor=Entry Editor
-EntryEditorNavigationLocation.Bookmark=Bookmark {0}
-EntryEditorNavigationLocation.Entry=Entry {0}
-EntryEditorNavigationLocation.RootDSE=Root DSE
-EntryEditorNavigationLocation.SearchResult=Search Result {0}
OpenEntryEditorAction.EditEntry=Edit Entry...
OpenEntryEditorPreferencePageAction.Preferences=Preferences...
OpenEntryEditorPreferencePageAction.PreferencesToolTip=Preferences...
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_de.properties Sat Sep 5 10:19:16 2009
@@ -19,9 +19,6 @@
EntryEditorActionGroup.OpenSchemaBrowser=\u00D6ffne Schema Browser
EntryEditorActionGroup.ShowIn=Anzeigen in
EntryEditorInput.EntryEditor=Eintrag Editor
-EntryEditorNavigationLocation.Bookmark=Lesezeichen {0}
-EntryEditorNavigationLocation.Entry=Eintrag {0}
-EntryEditorNavigationLocation.SearchResult=Such Resultat {0}
OpenEntryEditorAction.EditEntry=Eintrag editieren...
OpenEntryEditorPreferencePageAction.Preferences=Pr\u00E4ferenzen...
OpenEntryEditorPreferencePageAction.PreferencesToolTip=Pr\u00E4ferenzen...
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties?rev=811615&r1=811614&r2=811615&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/messages_fr.properties Sat Sep 5 10:19:16 2009
@@ -19,10 +19,6 @@
EntryEditorActionGroup.OpenSchemaBrowser=Ouvrir le navigateur de sch\u00E9ma
EntryEditorActionGroup.ShowIn=Afficher dans
EntryEditorInput.EntryEditor=Editeur d'entr\u00E9e
-EntryEditorNavigationLocation.Bookmark=Signet {0}
-EntryEditorNavigationLocation.Entry=Entr\u00E9e {0}
-EntryEditorNavigationLocation.RootDSE=Root DSE
-EntryEditorNavigationLocation.SearchResult=R\u00E9sultat de recherche {0}
OpenEntryEditorAction.EditEntry=Editer l'entr\u00E9e...
OpenEntryEditorPreferencePageAction.Preferences=Pr\u00E9f\u00E9rences...
OpenEntryEditorPreferencePageAction.PreferencesToolTip=Pr\u00E9f\u00E9rences...