directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r882581 - in /directory/studio/trunk: ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ ldapbrowser-ui/src/main/java/org/ap...
Date Fri, 20 Nov 2009 14:41:42 GMT
Author: seelmann
Date: Fri Nov 20 14:41:41 2009
New Revision: 882581

URL: http://svn.apache.org/viewvc?rev=882581&view=rev
Log:
Fix for DIRSTUDIO-597 (Modification sent to the server while browsing through the DIT and
refreshing entries)

Added:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueMultiModificationEvent.java
Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/CompoundModification.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java

Added: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueMultiModificationEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueMultiModificationEvent.java?rev=882581&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueMultiModificationEvent.java
(added)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueMultiModificationEvent.java
Fri Nov 20 14:41:41 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.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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.IValue;
+
+
+/**
+ * An ValueMultiModificationEvent indicates that multiple {@link IValue}s of an
+ * {@link IEntry} were added, modified, deleted and/or renamed.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueMultiModificationEvent extends EntryModificationEvent
+{
+
+    /**
+     * Creates a new instance of ValueMultiModificationEvent.
+     *
+     * @param connection the connection
+     * @param modifiedEntry the modified entry
+     */
+    public ValueMultiModificationEvent( IBrowserConnection connection, IEntry modifiedEntry
)
+    {
+        super( connection, modifiedEntry );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return BrowserCoreMessages.event__bulk_modification;
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/CompoundModification.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/CompoundModification.java?rev=882581&r1=882580&r2=882581&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/CompoundModification.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/CompoundModification.java
Fri Nov 20 14:41:41 2009
@@ -28,12 +28,11 @@
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.studio.ldapbrowser.core.events.AttributesInitializedEvent;
-import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueAddedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueDeletedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueModifiedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueMultiModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueRenamedEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -309,7 +308,7 @@
     /**
      * Copies all attributes and values from the 1st entry to the second entry.
      * Clears all existing attributes from the 2nd entry.
-     * Only one event (an {@link AttributesInitializedEvent}) is fired.
+     * Only one event (an {@link ValueMultiModificationEvent}) is fired.
      *
      * @param fromEntry
      * @param toEntry
@@ -335,7 +334,7 @@
         }
         EventRegistry.resumeEventFiringInCurrentThread();
 
-        EntryModificationEvent event = new AttributesInitializedEvent( toEntry );
+        ValueMultiModificationEvent event = new ValueMultiModificationEvent( toEntry.getBrowserConnection(),
toEntry );
         EventRegistry.fireEntryUpdated( event, source );
     }
 

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=882581&r1=882580&r2=882581&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
Fri Nov 20 14:41:41 2009
@@ -42,6 +42,11 @@
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueModifiedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueMultiModificationEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueRenamedEvent;
 import org.apache.directory.studio.ldapbrowser.core.jobs.UpdateEntryRunnable;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
@@ -381,9 +386,15 @@
                 IEntry autoSaveSharedReferenceCopy = autoSaveSharedReferenceCopies.get( originalEntry
);
                 IEntry autoSaveSharedWorkingCopy = autoSaveSharedWorkingCopies.get( originalEntry
);
 
-                // only auto-save if the source of the modification event is an entry
-                // i.e. the modification was done on the entry itself
-                if ( !( event.getSource() instanceof IEntry ) )
+                // sanity check: never save if event source is the EntryEditorManager
+                if ( event.getSource() instanceof EntryEditorManager )
+                {
+                    return;
+                }
+
+                // only save if we receive a real value modification event
+                if ( !( event instanceof ValueAddedEvent || event instanceof ValueDeletedEvent
+                    || event instanceof ValueModifiedEvent || event instanceof ValueRenamedEvent
|| event instanceof ValueMultiModificationEvent ) )
                 {
                     return;
                 }
@@ -400,6 +411,8 @@
                     }
                 }
 
+                System.out.println( event + " - " + event.getSource() );
+
                 LdifFile diff = Utils.computeDiff( autoSaveSharedReferenceCopy, autoSaveSharedWorkingCopy
);
                 if ( diff != null )
                 {



Mime
View raw message