You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2009/10/07 14:18:02 UTC
svn commit: r822690 - in
/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio:
entryeditors/ ldapbrowser/ui/editors/entry/ ldapbrowser/ui/views/browser/
Author: pamarcelot
Date: Wed Oct 7 12:18:00 2009
New Revision: 822690
URL: http://svn.apache.org/viewvc?rev=822690&view=rev
Log:
DIRSTUDIO-515 (Add extensibility to Entry Editor).
o Fixed the way the entry editors are displaying a node that is not an entry.
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/entryeditors/EntryEditorManager.java
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/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/LdifEntryEditor.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java
directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.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=822690&r1=822689&r2=822690&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 Wed Oct 7 12:18:00 2009
@@ -145,7 +145,7 @@
}
}
- return ""; //$NON-NLS-1$
+ return Messages.getString( "EntryEditorInput.NoEntrySelected" ); //$NON-NLS-1$
}
@@ -168,7 +168,7 @@
}
}
- return ""; //$NON-NLS-1$
+ return Messages.getString( "EntryEditorInput.NoEntrySelected" ); //$NON-NLS-1$
}
@@ -239,9 +239,13 @@
*/
public IEntry getSharedWorkingCopy( IEntryEditor editor )
{
- IEntry workingCopy = BrowserUIPlugin.getDefault().getEntryEditorManager().getSharedWorkingCopy(
- getResolvedEntry(), editor );
- return workingCopy;
+ IEntry resolvedEntry = getResolvedEntry();
+ if ( resolvedEntry != null )
+ {
+ return BrowserUIPlugin.getDefault().getEntryEditorManager().getSharedWorkingCopy( resolvedEntry, editor );
+ }
+
+ return null;
}
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=822690&r1=822689&r2=822690&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 Wed Oct 7 12:18:00 2009
@@ -471,7 +471,7 @@
}
catch ( CoreException e )
{
- // Will never happen
+ // Will never happen
}
entryEditorExtensions.put( bean.getId(), bean );
@@ -704,6 +704,10 @@
{
input = new EntryEditorInput( bookmarks[0], extension );
}
+ else
+ {
+ input = new EntryEditorInput( ( IEntry ) null, extension );
+ }
String editorId = extension.getEditorId();
@@ -747,19 +751,15 @@
entry = bookmarks[0].getEntry();
}
- // Checking if we've found the entry
- if ( entry != null )
+ // Looking for the correct entry editor
+ for ( EntryEditorExtension entryEditor : getSortedEntryEditorExtensions() )
{
- // Looking for the correct entry editor
- for ( EntryEditorExtension entryEditor : getSortedEntryEditorExtensions() )
+ // Verifying that the editor can handle the entry
+ if ( entryEditor.getEditorInstance().canHandle( entry ) )
{
- // Verifying that the editor can handle the entry
- if ( entryEditor.getEditorInstance().canHandle( entry ) )
- {
- // The correct editor has been found, let's open the entry in the editor
- openEntryEditor( entryEditor, entries, searchResults, bookmarks );
- return;
- }
+ // The correct editor has been found, let's open the entry in the editor
+ openEntryEditor( entryEditor, entries, searchResults, bookmarks );
+ return;
}
}
}
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=822690&r1=822689&r2=822690&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 Wed Oct 7 12:18:00 2009
@@ -119,6 +119,10 @@
+ " - " + input.getBookmarkInput().getBrowserConnection().getConnection().getName(); //$NON-NLS-1$
}
}
+ else
+ {
+ return Messages.getString( "EntryEditorUtils.NoEntrySelected" ); //$NON-NLS-1$
+ }
}
return null;
Modified: 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=822690&r1=822689&r2=822690&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages.properties Wed Oct 7 12:18:00 2009
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
+EntryEditorInput.NoEntrySelected=No entry selected
EntryEditorManager.EntryChanged=Entry Changed
EntryEditorManager.EntryChangedDescription=The entry has been changed in the directory server. Do you want to replace the editor contents with these changes?
EntryEditorManager.SaveChanges=Save Changes
@@ -23,3 +24,4 @@
EntryEditorNavigationLocation.Entry=Entry {0}
EntryEditorNavigationLocation.RootDSE=Root DSE
EntryEditorNavigationLocation.SearchResult=Search Result {0}
+EntryEditorUtils.NoEntrySelected=No entry selected
Modified: 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=822690&r1=822689&r2=822690&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_de.properties Wed Oct 7 12:18:00 2009
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
+EntryEditorInput.NoEntrySelected=Kein Eintrag ausgew\u00E4hlt
EntryEditorManager.EntryChanged=Eintrag Ge\u00e4ndert
EntryEditorManager.EntryChangedDescription=Der Eintrag wurde im Verzeichnisserver ge\u00e4ndert. Wollen Sie den Inhalt des Editors mit dem ge\u00e4nderten Eintrag ersetzen?
EntryEditorManager.SaveChanges=\u00c4nderungen Speichern
@@ -22,3 +23,4 @@
EntryEditorNavigationLocation.Bookmark=Lesezeichen {0}
EntryEditorNavigationLocation.Entry=Eintrag {0}
EntryEditorNavigationLocation.SearchResult=Suchergebnis {0}
+EntryEditorUtils.NoEntrySelected=Kein Eintrag ausgew\u00E4hlt
Modified: 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=822690&r1=822689&r2=822690&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/messages_fr.properties Wed Oct 7 12:18:00 2009
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
+EntryEditorInput.NoEntrySelected=Aucune entr\u00E9e s\u00E9lectionn\u00E9e
EntryEditorManager.EntryChanged=TODO:Entry Changed
EntryEditorManager.EntryChangedDescription=TODO:The entry has been changed in the directory server. Do you want to replace the editor contents with these changes?
EntryEditorManager.SaveChanges=TODO:Save Changes
@@ -23,3 +24,4 @@
EntryEditorNavigationLocation.Entry=Entr\u00E9e {0}
EntryEditorNavigationLocation.RootDSE=Root DSE
EntryEditorNavigationLocation.SearchResult=R\u00E9sultat de recherche {0}
+EntryEditorUtils.NoEntrySelected=Aucune entr\u00E9e s\u00E9lectionn\u00E9e
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java?rev=822690&r1=822689&r2=822690&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditor.java Wed Oct 7 12:18:00 2009
@@ -81,6 +81,13 @@
@Override
+ public boolean isEnabled()
+ {
+ return ( getEntryEditorInput().getResolvedEntry() != null );
+ }
+
+
+ @Override
public String getActionDefinitionId()
{
return "org.eclipse.ui.file.refresh"; //$NON-NLS-1$
@@ -116,9 +123,14 @@
public boolean isEnabled()
{
IEntry entry = getEntryEditorInput().getResolvedEntry();
- entry = entry.getBrowserConnection().getEntryFromCache( entry.getDn() );
+ if ( entry != null )
+ {
+ entry = entry.getBrowserConnection().getEntryFromCache( entry.getDn() );
+
+ return !entry.getBrowserConnection().isFetchOperationalAttributes();
+ }
- return !entry.getBrowserConnection().isFetchOperationalAttributes();
+ return false;
}
@@ -156,8 +168,11 @@
{
super.doSetInput( input );
- EntryEditorInput eei = getEntryEditorInput();
- setConnection( eei.getResolvedEntry().getBrowserConnection() );
+ IEntry entry = getEntryEditorInput().getResolvedEntry();
+ if ( entry != null )
+ {
+ setConnection( entry.getBrowserConnection() );
+ }
}
@@ -202,8 +217,9 @@
{
super.editorContextMenuAboutToShow( menu );
- fetchOperationalAttributesAction.setChecked( getEntryEditorInput().getResolvedEntry()
- .isInitOperationalAttributes() );
+ IEntry entry = getEntryEditorInput().getResolvedEntry();
+ fetchOperationalAttributesAction.setChecked( ( entry != null ) ? entry.isInitOperationalAttributes() : false );
+
addAction( menu, ITextEditorActionConstants.GROUP_REST, REFRESH_ACTION );
addAction( menu, ITextEditorActionConstants.GROUP_REST, FETCH_OPERATIONAL_ATTRIBUTES_ACTION );
}
Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.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?rev=822690&r1=822689&r2=822690&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/LdifEntryEditorDocumentProvider.java Wed Oct 7 12:18:00 2009
@@ -249,7 +249,10 @@
input = getEntryEditorInput( element );
IEntry entry = getEntryEditorInput( element ).getSharedWorkingCopy( editor );
IDocument document = new Document();
- setDocumentInput( document, entry );
+ if ( entry != null )
+ {
+ setDocumentInput( document, entry );
+ }
setupDocument( document );
return document;
}
@@ -273,7 +276,13 @@
@Override
public boolean isModifiable( Object element )
{
- return element instanceof EntryEditorInput;
- }
+ if ( element instanceof EntryEditorInput )
+ {
+ EntryEditorInput editorInput = ( EntryEditorInput ) element;
+ IEntry entry = editorInput.getSharedWorkingCopy( editor );
+ return ( entry != null );
+ }
+ return false;
+ }
}
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=822690&r1=822689&r2=822690&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 Wed Oct 7 12:18:00 2009
@@ -329,12 +329,12 @@
ISearchResult[] searchResults = BrowserSelectionUtils.getSearchResults( selection );
IBookmark[] bookmarks = BrowserSelectionUtils.getBookmarks( selection );
ISearch[] searches = BrowserSelectionUtils.getSearches( selection );
+ EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
if ( entries.length + searchResults.length + bookmarks.length + searches.length == 1 )
{
if ( ( entries.length == 1 ) || ( searchResults.length == 1 ) || ( bookmarks.length == 1 ) )
{
- EntryEditorManager entryEditorManager = BrowserUIPlugin.getDefault().getEntryEditorManager();
entryEditorManager.openEntryEditor( entries, searchResults, bookmarks );
}
else if ( searches.length == 1 )
@@ -349,6 +349,10 @@
}
}
}
+ else
+ {
+ entryEditorManager.openEntryEditor( new IEntry[0], new ISearchResult[0], new IBookmark[0] );
+ }
}
}