directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r898447 - in /directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui: actions/EntryEditorPropertiesAction.java editors/entry/EntryEditorActionGroup.java
Date Tue, 12 Jan 2010 18:10:30 GMT
Author: pamarcelot
Date: Tue Jan 12 18:10:30 2010
New Revision: 898447

URL: http://svn.apache.org/viewvc?rev=898447&view=rev
Log:
Fix for DIRSTUDIO-612 (The 'Properties' item in the context menu of the default Entry Editor
should be enabled and linked to the entry properties when no particular attribute is selected
in the table).

Added:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorPropertiesAction.java
Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorPropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorPropertiesAction.java?rev=898447&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorPropertiesAction.java
(added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/EntryEditorPropertiesAction.java
Tue Jan 12 18:10:30 2010
@@ -0,0 +1,80 @@
+/*
+ *  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.studio.entryeditors.EntryEditorInput;
+import org.apache.directory.studio.ldapbrowser.common.actions.PropertiesAction;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
+import org.eclipse.ui.IEditorInput;
+
+
+/**
+ * This Action opens the Property Dialog for a given object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorPropertiesAction extends PropertiesAction
+{
+    private EntryEditor entryEditor;
+
+
+    /**
+     * Creates a new instance of EntryEditorPropertiesAction.
+     *
+     * @param entryEditor
+     *      the associated Entry Editor
+     */
+    public EntryEditorPropertiesAction( EntryEditor entryEditor )
+    {
+        super();
+        this.entryEditor = entryEditor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry[] getSelectedEntries()
+    {
+        // We're only returning the entry when no value is selected
+        if ( getSelectedValues().length == 0 )
+        {
+            if ( entryEditor != null )
+            {
+                IEditorInput input = entryEditor.getEditorInput();
+                if ( input instanceof EntryEditorInput )
+                {
+                    IEntry entry = ( ( EntryEditorInput ) input ).getResolvedEntry();
+                    if ( entry != null )
+                    {
+                        return new IEntry[]
+                            { entry };
+                    }
+                }
+            }
+        }
+
+        return new IEntry[0];
+    }
+}

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java?rev=898447&r1=898446&r2=898447&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
Tue Jan 12 18:10:30 2010
@@ -38,6 +38,7 @@
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopySearchFilterAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopyUrlAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopyValueAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.EntryEditorPropertiesAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.LocateDnInDitAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewBatchOperationAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewSearchAction;
@@ -240,6 +241,10 @@
             new DeleteAllValuesAction() ) );
         entryEditorActionMap.put( fetchOperationalAttributesAction, new EntryEditorActionProxy(
viewer,
             new FetchOperationalAttributesAction() ) );
+
+        entryEditorActionMap.put( propertyDialogAction, new EntryEditorActionProxy( viewer,
+            new EntryEditorPropertiesAction( entryEditor ) ) );
+
     }
 
 



Mime
View raw message