From: axelcl Date: Wed, 10 Nov 2004 20:39:32 +0000 (+0000) Subject: misc X-Git-Url: http://secure.phpeclipse.com misc --- 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 204c16c..d04d657 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.4 2004-10-25 17:03:28 axelcl Exp $ + * $Id: MultiViewPartitioner.java,v 1.5 2004-11-10 20:39:32 axelcl Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -116,11 +116,21 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { if (DEBUG) { Assert.isTrue(position.offset >= 0, Integer.toString(position.offset)); } - DocumentEvent event = new DocumentEvent(outerDocument, outerDocument.getLocalOffset(position.offset), position.length, null); - - outerDocument.fireDocumentAboutToBeChanged(event); + int outerOffset = outerDocument.getLocalOffset(position.offset); + // axelcl start + DocumentEvent event = null; + if (outerOffset>=0) { + // axelcl end + event = new DocumentEvent(outerDocument, outerOffset, position.length, null); + + outerDocument.fireDocumentAboutToBeChanged(event); + } super.addInnerRegion(position); - outerDocument.fireDocumentChanged(event); +// axelcl start + if (event != null) { + // axelcl end + outerDocument.fireDocumentChanged(event); + } } else { super.addInnerRegion(position); } @@ -147,15 +157,14 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { if (position.offset >= 0 && position.length >= 0) { int outerOffset = outerDocument.getLocalOffset(position.offset); if (outerOffset > 0) { - event = new DocumentEvent(outerDocument, outerOffset, 0, document.get( - position.offset, position.length)); + event = new DocumentEvent(outerDocument, outerOffset, 0, document.get(position.offset, position.length)); outerDocument.fireDocumentAboutToBeChanged(event); } } super.removeInnerRegion(position); if (position.offset >= 0) { - if (event!=null) { + if (event != null) { outerDocument.fireDocumentChanged(event); } } @@ -603,16 +612,25 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { end = document.getLength(); type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE); } else { - ITypedRegion region = outerDocument.getPartition(outerDocument.getLocalOffset(offset)); + int outerOffset = outerDocument.getLocalOffset(offset); + //axelcl start + if (outerOffset < 0) { + start = 0; + end = document.getLength(); + type = getContentType(null, IDocument.DEFAULT_CONTENT_TYPE); + } else { +// axelcl end + ITypedRegion region = outerDocument.getPartition(outerOffset); - start = region.getOffset(); - end = start + region.getLength(); + start = region.getOffset(); + end = start + region.getLength(); - // convert to parent offset - start = outerDocument.getParentOffset(start); - end = outerDocument.getParentOffset(end); + // convert to parent offset + start = outerDocument.getParentOffset(start); + end = outerDocument.getParentOffset(end); - type = getContentType(null, region.getType()); + type = getContentType(null, region.getType()); + } } if (prev != null) {