From: jsurfer Date: Thu, 21 Oct 2004 16:21:11 +0000 (+0000) Subject: avoid Assert.isTrue() X-Git-Url: http://secure.phpeclipse.com?hp=8ad5c1a9fe94a1cd557e1ad7beee4f60e5d7859b avoid Assert.isTrue() --- 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 cc10e0d..7f1ea61 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.2 2004-09-22 18:51:51 jsurfer Exp $ + * $Id: MultiViewPartitioner.java,v 1.3 2004-10-21 16:21:11 jsurfer Exp $ */ package net.sourceforge.phpeclipse.ui.text.rules; @@ -144,11 +144,14 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { try { if (outerDocument != null) { DocumentEvent event = null; - if (position.offset >= 0) { - event = new DocumentEvent(outerDocument, outerDocument.getLocalOffset(position.offset), 0, document.get(position.offset, - position.length)); + 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)); - outerDocument.fireDocumentAboutToBeChanged(event); + outerDocument.fireDocumentAboutToBeChanged(event); + } } super.removeInnerRegion(position); if (position.offset >= 0) { @@ -320,7 +323,7 @@ public abstract class MultiViewPartitioner extends AbstractPartitioner { if (p instanceof ViewNode) { // TODO: revisit condition InnerDocumentView innerDocument = ((ViewNode) p).view; - if (innerDocument != null) { + if (innerDocument != null) { int start = innerDocument.getLocalOffset(offset); innerDocument.fireDocumentChanged(new DocumentEvent(innerDocument, start, length, text)); }