Fixed: 1774625 - duplicate one function block down into a folded php-doc
authortoshihiro <toshihiro>
Tue, 28 Aug 2007 06:31:40 +0000 (06:31 +0000)
committertoshihiro <toshihiro>
Tue, 28 Aug 2007 06:31:40 +0000 (06:31 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDeltaBuilder.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/folding/DefaultJavaFoldingStructureProvider.java

index 226e795..709cfef 100644 (file)
@@ -359,7 +359,8 @@ public class JavaElementDeltaBuilder {
                if (depth >= this.maxDepth) {
                        return;
                }
-               JavaElementInfo info = null;// (JavaElementInfo)JavaModelManager.getJavaModelManager().getInfo(element);
+               JavaElementInfo info = (JavaElementInfo) JavaModelManager
+                               .getJavaModelManager().getInfo(element);
                if (info == null) // no longer in the java model.
                        return;
                this.putElementInfo(element, info);
index 5356891..409c229 100644 (file)
@@ -113,20 +113,19 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation {
                }
 
                CompilationUnit workingCopy = getWorkingCopy();
-               // boolean wasConsistent = workingCopy.isConsistent();
-               // JavaElementDeltaBuilder deltaBuilder = null;
+               boolean wasConsistent = workingCopy.isConsistent();
+               JavaElementDeltaBuilder deltaBuilder = null;
 
                try {
                        // create the delta builder (this remembers the current content of
                        // the cu)
-                       // if (!wasConsistent){
-                       // deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
-                       //                              
-                       // // update the element infos with the content of the working copy
-                       // workingCopy.makeConsistent(fMonitor);
-                       // deltaBuilder.buildDeltas();
-                       //              
-                       // }
+                       if (!wasConsistent) {
+                               deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
+
+                               // update the element infos with the content of the working copy
+                               workingCopy.makeConsistent(progressMonitor);
+                               deltaBuilder.buildDeltas();
+                       }
 
                        if (progressMonitor != null)
                                progressMonitor.worked(2);
@@ -168,12 +167,12 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation {
                        }
 
                        // register the deltas
-                       // if (deltaBuilder != null){
-                       // if ((deltaBuilder.delta != null) &&
-                       // (deltaBuilder.delta.getAffectedChildren().length > 0)) {
-                       // addReconcileDelta(workingCopy, deltaBuilder.delta);
-                       // }
-                       // }
+                       if (deltaBuilder != null) {
+                               if ((deltaBuilder.delta != null)
+                                               && (deltaBuilder.delta.getAffectedChildren().length > 0)) {
+                                       addReconcileDelta(workingCopy, deltaBuilder.delta);
+                               }
+                       }
                } finally {
                        if (progressMonitor != null)
                                progressMonitor.done();
index 2b8c0ee..0739690 100644 (file)
@@ -860,42 +860,47 @@ public class DefaultJavaFoldingStructureProvider implements
                        while (e.hasNext()) {
                                JavaProjectionAnnotation newAnnotation = (JavaProjectionAnnotation) e
                                                .next();
-                               IJavaElement element = newAnnotation.getElement();
+//+
                                Position newPosition = (Position) updated.get(newAnnotation);
-
-                               List annotations = (List) previous.get(element);
-                               if (annotations == null) {
-
-                                       additions.put(newAnnotation, newPosition);
-
-                               } else {
-                                       Iterator x = annotations.iterator();
-                                       boolean matched = false;
-                                       while (x.hasNext()) {
-                                               Tuple tuple = (Tuple) x.next();
-                                               JavaProjectionAnnotation existingAnnotation = tuple.annotation;
-                                               Position existingPosition = tuple.position;
-                                               if (newAnnotation.isComment() == existingAnnotation
-                                                               .isComment()) {
-                                                       if (existingPosition != null
-                                                                       && (!newPosition.equals(existingPosition))) {
-                                                               existingPosition.setOffset(newPosition
-                                                                               .getOffset());
-                                                               existingPosition.setLength(newPosition
-                                                                               .getLength());
-                                                               updates.add(existingAnnotation);
-                                                       }
-                                                       matched = true;
-                                                       x.remove();
-                                                       break;
-                                               }
-                                       }
-                                       if (!matched)
-                                               additions.put(newAnnotation, newPosition);
-
-                                       if (annotations.isEmpty())
-                                               previous.remove(element);
-                               }
+                               additions.put(newAnnotation, newPosition);
+//-
+//                             IJavaElement element = newAnnotation.getElement();
+//                             Position newPosition = (Position) updated.get(newAnnotation);
+//
+//                             List annotations = (List) previous.get(element);
+//                             if (annotations == null) {
+//
+//                                     additions.put(newAnnotation, newPosition);
+//
+//                             } else {
+//                                     Iterator x = annotations.iterator();
+//                                     boolean matched = false;
+//                                     while (x.hasNext()) {
+//                                             Tuple tuple = (Tuple) x.next();
+//                                             JavaProjectionAnnotation existingAnnotation = tuple.annotation;
+//                                             Position existingPosition = tuple.position;
+//                                             if (newAnnotation.isComment() == existingAnnotation
+//                                                             .isComment()) {
+//                                                     if (existingPosition != null
+//                                                                     && (!newPosition.equals(existingPosition))) {
+//                                                             existingPosition.setOffset(newPosition
+//                                                                             .getOffset());
+//                                                             existingPosition.setLength(newPosition
+//                                                                             .getLength());
+//                                                             updates.add(existingAnnotation);
+//                                                     }
+//                                                     matched = true;
+//                                                     x.remove();
+//                                                     break;
+//                                             }
+//                                     }
+//                                     if (!matched)
+//                                             additions.put(newAnnotation, newPosition);
+//
+//                                     if (annotations.isEmpty())
+//                                             previous.remove(element);
+//                             }
+//-
                        }
 
                        e = previous.values().iterator();