* 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;
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);
}
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);
}
}
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) {