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 2011/12/09 15:36:10 UTC
svn commit: r1212445 - in /directory/studio/trunk/plugins/ldapbrowser.ui:
plugin.properties plugin.xml plugin_de.properties plugin_fr.properties
src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java
Author: pamarcelot
Date: Fri Dec 9 14:36:10 2011
New Revision: 1212445
URL: http://svn.apache.org/viewvc?rev=1212445&view=rev
Log:
Fix for DIRSTUDIO-712 (Add a 'Go to DN...' action to the Navigate menu in Eclipse).
Added:
directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java
Modified:
directory/studio/trunk/plugins/ldapbrowser.ui/plugin.properties
directory/studio/trunk/plugins/ldapbrowser.ui/plugin.xml
directory/studio/trunk/plugins/ldapbrowser.ui/plugin_de.properties
directory/studio/trunk/plugins/ldapbrowser.ui/plugin_fr.properties
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/plugin.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/plugin.properties?rev=1212445&r1=1212444&r2=1212445&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/plugin.properties (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/plugin.properties Fri Dec 9 14:36:10 2011
@@ -216,6 +216,10 @@ Action_NewLdifFileAction_id=org.apache.d
Action_NewLdifFileAction_label=New LDIF File
Action_NewLdifFileAction_menubarpath=org.apache.directory.studio.ldapbrowser.ldapMenu/newLdifFile
+Action_GotoDnAction_id=org.apache.directory.studio.ldapbrowser.ui.actions.GotoDnAction
+Action_GotoDnAction_label=Go to DN...
+Action_GotoDnAction_menubarpath=navigate/navEnd
+
Decorator_BrowserViewLabelDecorator_id=org.apache.directory.studio.ldapbrowser.decorator
Decorator_BrowserViewLabelDecorator_label=LDAP Decorator
Decorator_BrowserViewLabelDecorator_description=Decorates LDAP icons
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/plugin.xml?rev=1212445&r1=1212444&r2=1212445&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/plugin.xml (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/plugin.xml Fri Dec 9 14:36:10 2011
@@ -441,6 +441,13 @@
label="%Action_NewLdifFileAction_label"
menubarPath="%Action_NewLdifFileAction_menubarpath"
style="push"/>
+ <action
+ class="org.apache.directory.studio.ldapbrowser.ui.actions.GotoDnNavigateMenuAction"
+ icon="resources/icons/locate_dn_in_dit.gif"
+ id="%Action_GotoDnAction_id"
+ label="%Action_GotoDnAction_label"
+ menubarPath="%Action_GotoDnAction_menubarpath"
+ style="push"/>
</actionSet>
</extension>
<extension
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/plugin_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/plugin_de.properties?rev=1212445&r1=1212444&r2=1212445&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/plugin_de.properties (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/plugin_de.properties Fri Dec 9 14:36:10 2011
@@ -33,19 +33,13 @@ Editor_MultiTabLdifEntryEditor_descripti
Editor_SearchResultEditor_name=Suchresultat Editor
View_ConnectionView_name=Verbindungen
-
View_ModificationLogsView_name=\u00C4nderungs-Logs
-
View_SearchLogsView_name=Such-Logs
NewWizard_NewEntryWizard_name=LDAP Entry
-
NewWizard_NewContextEntryWizard_name=LDAP Kontext Eintrag
-
NewWizard_NewSearchWizard_name=LDAP Suche
-
NewWizard_NewBookmarkWizard_name=LDAP Lesezeichen
-
NewWizard_BatchOperationWizard_name=LDAP Batch Operation
ImportWizard_ImportLdifWizard_name=LDIF in LDAP
@@ -72,40 +66,26 @@ ExportWizard_ExportOdfWizard_description
SearchPage_LdapSearch_label=LDAP Suche
PrefPage_SearchResultEditorPreferencePage_name=Suchresultat Editor
-
PrefPage_ModificationLogsPreferencePage_name=\u00C4nderungs-Logs Ansicht
-
PrefPage_SearchLogsPreferencePage_name=Such-Logs Ansicht
-
PrefPage_EntryEditorsPreferencePage_name=Eintrags-Editoren
PropPage_Search_name=Suche
-
PropPage_Entry_name=Eintrag
-
PropPage_Value_name=Wert
-
PropPage_Bookmark_name=Lesezeichen
Action_OpenSchemaBrowserAction_label=Schema Browser \u00F6ffnen
-
Action_NewConnectionAction_label=Neue Verbindung...
-
Action_NewEntryAction_label=Neuer Eintrag...
-
Action_NewAttributeAction_label=Neues Attribut...
-
Action_NewValueAction_label=Neuer Wert
-
Action_NewSearchAction_label=Neue Suche...
-
Action_NewBookmarkAction_label=Neues Lesezeichen...
-
Action_NewBatchOperationAction_label=Neue Batch Operation...
-
Action_OpenEncoderDecoderDialogAction_label=Encoder/Decoder \u00F6ffnen
-
Action_NewLdifFileAction_label=Neue LDIF Datei
+Action_GotoDnAction_label=Gehe zu DN...
Decorator_BrowserViewLabelDecorator_label=LDAP Decorator
Decorator_BrowserViewLabelDecorator_description=Decorates LDAP icons
Modified: directory/studio/trunk/plugins/ldapbrowser.ui/plugin_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/plugin_fr.properties?rev=1212445&r1=1212444&r2=1212445&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/plugin_fr.properties (original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/plugin_fr.properties Fri Dec 9 14:36:10 2011
@@ -78,7 +78,6 @@ PropPage_Attribute_name=Attribut
PropPage_Value_name=Valeur
PropPage_Bookmark_name=Signet
-
Action_OpenSchemaBrowserAction_label=Ouvrir l'explorateur de sch\u00E9ma
Action_NewConnectionAction_label=Nouvelle Connexion...
Action_NewEntryAction_label=Nouvelle entr\u00E9e...
@@ -89,6 +88,7 @@ Action_NewBookmarkAction_label=Nouveau s
Action_NewBatchOperationAction_label=Nouveau groupe d'op\u00E9rations...
Action_OpenEncoderDecoderDialogAction_label=Ouvre un encodeur/d\u00E9codeur
Action_NewLdifFileAction_label=Nouveau fichier LDIF
+Action_GotoDnAction_label=Aller au DN...
Decorator_BrowserViewLabelDecorator_label=D\u00E9corateur LDAP
Decorator_BrowserViewLabelDecorator_description=D\u00E9core les icones LDAP
Added: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java?rev=1212445&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java (added)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/GotoDnNavigateMenuAction.java Fri Dec 9 14:36:10 2011
@@ -0,0 +1,167 @@
+/*
+ * 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.actions;
+
+
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.Utils;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.DnDialog;
+import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.views.connection.ConnectionView;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This action locates a Dn that the user entered into a dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class GotoDnNavigateMenuAction extends LocateInDitAction
+{
+ /**
+ * {@inheritDoc}
+ */
+ public String getText()
+ {
+ return Messages.getString( "GotoDnAction.GotoDN" ); //$NON-NLS-1$
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public ImageDescriptor getImageDescriptor()
+ {
+ return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LOCATE_DN_IN_DIT );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled()
+ {
+ return ( getSelectedConnection() != null );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ConnectionAndDn getConnectionAndDn()
+ {
+ Connection selectedConnection = getSelectedConnection();
+
+ if ( selectedConnection != null )
+ {
+ // Getting the browser connection associated with the connection
+ IBrowserConnection connection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnection( selectedConnection );
+
+ // Getting the DN from the clipboard (if any)
+ Dn dn = Utils.getLdapDn( getStringFromClipboard() );
+
+ // Displaying the DN dialog
+ DnDialog dialog = new DnDialog(
+ getShell(),
+ Messages.getString( "GotoDnAction.GotoDNAction" ), Messages.getString( "GotoDnAction.EnterDNAction" ), connection, dn ); //$NON-NLS-1$ //$NON-NLS-2$
+ if ( dialog.open() == TextDialog.OK && dialog.getDn() != null )
+ {
+ dn = dialog.getDn();
+ return new ConnectionAndDn( connection, dn );
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Gets the currently selected connection.
+ *
+ * @return the currently selected connection
+ */
+ private Connection getSelectedConnection()
+ {
+ // Getting the connections view
+ ConnectionView connectionView = ( ConnectionView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().findView( ConnectionView.getId() );
+
+ if ( connectionView != null )
+ {
+ // Getting the selection of the connections view
+ StructuredSelection selection = ( StructuredSelection ) connectionView.getMainWidget().getViewer()
+ .getSelection();
+
+ // Checking if only one object is selected
+ if ( selection.size() == 1 )
+ {
+ Object selectedObject = selection.getFirstElement();
+
+ // Checking if the selected object is a connection
+ if ( selectedObject instanceof Connection )
+ {
+ return ( Connection ) selectedObject;
+ }
+ }
+ }
+
+ return null;
+ }
+
+
+ /**
+ * Gets the string from the clipboard.
+ *
+ * @return the string from the clipboard
+ */
+ private String getStringFromClipboard()
+ {
+ Clipboard clipboard = null;
+ try
+ {
+ clipboard = new Clipboard( Display.getCurrent() );
+ Object contents = clipboard.getContents( TextTransfer.getInstance() );
+ if ( contents != null && contents instanceof String )
+ {
+ return ( String ) contents;
+ }
+ }
+ finally
+ {
+ if ( clipboard != null )
+ {
+ clipboard.dispose();
+ }
+ }
+ return null;
+ }
+}