From df028a46c3b1261f860b7b6130b3409c1bfc3fac Mon Sep 17 00:00:00 2001 From: axelcl Date: Thu, 5 May 2005 19:08:50 +0000 Subject: [PATCH 1/1] *** empty log message *** --- .../ui/text/rules/MultiViewPartitioner.java | 111 ++++++++++---------- 1 files changed, 57 insertions(+), 54 deletions(-) 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 4bd1a6c..17d5156 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.7 2004-11-13 12:36:32 axelcl Exp $ + * $Id: MultiViewPartitioner.java,v 1.8 2005-05-05 19:08:50 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -119,16 +119,16 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { int outerOffset = outerDocument.getLocalOffset(position.offset); // axelcl start DocumentEvent event = null; - if (outerOffset>=0) { - // axelcl end + if (outerOffset >= 0) { + // axelcl end event = new DocumentEvent(outerDocument, outerOffset, position.length, null); outerDocument.fireDocumentAboutToBeChanged(event); } super.addInnerRegion(position); -// axelcl start + // axelcl start if (event != null) { - // axelcl end + // axelcl end outerDocument.fireDocumentChanged(event); } } else { @@ -301,10 +301,12 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { String text = event.getText(); - if (left != right || text != null && text.length() > 0) { - outerDocumentEvent = new DocumentEvent(outerDocument, left, right - left, text); + if (left >= 0 && (right - left >= 0)) { + if (left != right || text != null && text.length() > 0) { + outerDocumentEvent = new DocumentEvent(outerDocument, left, right - left, text); - outerDocument.fireDocumentAboutToBeChanged(outerDocumentEvent); + outerDocument.fireDocumentAboutToBeChanged(outerDocumentEvent); + } } } } @@ -436,13 +438,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(""); -// } + // 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); @@ -471,23 +473,23 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { ++index; } -// if (DEBUG) { -// showList(list); -// } - + // if (DEBUG) { + // showList(list); + // } + return (TypedRegion[]) list.toArray(new TypedRegion[list.size()]); } private void showList(List list) { - try { + try { throw new NullPointerException(); - } catch (Exception e){ + } 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); + temp = (TypedRegion) list.get(i); System.out.print("Offset: "); System.out.print(temp.getOffset()); System.out.print(", Length: "); @@ -498,6 +500,7 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { } System.out.println("<<<<