From 8c8f89b5be59299beddb6b0c24fbbef8a4be6f54 Mon Sep 17 00:00:00 2001 From: axelcl Date: Sat, 13 Nov 2004 12:36:32 +0000 Subject: [PATCH] inserted nodes.clear() for every Partitioner initializing --- .../ui/text/rules/AbstractPartitioner.java | 6 +- .../ui/text/rules/MultiViewPartitioner.java | 69 ++++++++++++++++++-- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java index 981b803..d104237 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/AbstractPartitioner.java @@ -8,7 +8,7 @@ * Contributors: * Igor Malinin - initial contribution * - * $Id: AbstractPartitioner.java,v 1.1 2004-09-02 18:26:29 jsurfer Exp $ + * $Id: AbstractPartitioner.java,v 1.2 2004-11-13 12:36:32 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -35,7 +35,7 @@ import org.eclipse.jface.text.rules.IToken; * @author Igor Malinin */ public abstract class AbstractPartitioner implements IDocumentPartitioner, IDocumentPartitionerExtension { - public final static boolean DEBUG = true; + public final static boolean DEBUG = false; /** Partition scanner */ protected IPartitionTokenScanner scanner; @@ -103,7 +103,7 @@ public abstract class AbstractPartitioner implements IDocumentPartitioner, IDocu */ protected void initialize() { scanner.setRange(document, 0, document.getLength()); - + nodes.clear(); IToken token = scanner.nextToken(); while (!token.isEOF()) { String contentType = getTokenContentType(token); diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java index ea7cdda..4bd1a6c 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/text/rules/MultiViewPartitioner.java @@ -8,7 +8,7 @@ * Contributors: * Igor Malinin - initial contribution * - * $Id: MultiViewPartitioner.java,v 1.6 2004-11-12 20:15:58 axelcl Exp $ + * $Id: MultiViewPartitioner.java,v 1.7 2004-11-13 12:36:32 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -436,7 +436,13 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { */ public ITypedRegion[] computePartitioning(int offset, int length) { List list = new ArrayList(); - +// if (DEBUG) { +// System.out.print("MultiViewPartitioner::computePartitioning - Offset: "); +// System.out.print(offset); +// System.out.print(", Length: "); +// System.out.print(length); +// System.out.println(""); +// } int end = offset + length; int index = computeFlatNodeIndex(offset); @@ -465,10 +471,33 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { ++index; } - +// if (DEBUG) { +// showList(list); +// } + return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]); } + private void showList(List list) { + try { + throw new NullPointerException(); + } catch (Exception e){ + e.printStackTrace(); + } + System.out.println(">>>>>List start"); + TypedRegion temp; + for (int i = 0; i < list.size(); i++) { + temp = (TypedRegion)list.get(i); + System.out.print("Offset: "); + System.out.print(temp.getOffset()); + System.out.print(", Length: "); + System.out.print(temp.getLength()); + System.out.print(", Type: "); + System.out.print(temp.getType()); + System.out.println(""); + } + System.out.println("<<<<