Skip to main content
summaryrefslogtreecommitdiffstats
blob: 95c935d981ec3700f2a63caadd811be95b9cecfd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*******************************************************************************
 * Copyright (c) 2001, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Jens Lukowski/Innoopract - initial renaming/restructuring
 *     
 *******************************************************************************/
package org.eclipse.wst.sse.core.internal.provisional.events;

import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;

/**
 * This event is used when a document region changes in a non-structural way.
 * Non-structural, that is, as far as the IStructuredDocument is concerned.
 * The whole region, along with the new text is sent, just in case a listener
 * (e.g. a tree model) might make its own determination of what to do, and
 * needs the whole region to act appropriately.
 * 
 * Note: users should not make assumptions about whether the region is
 * literally the same instance or not -- it is currently a different instance
 * that is identical to the old except for the changed region, but this
 * implementation may change.
 * 
 * @plannedfor 1.0
 */
public class RegionChangedEvent extends StructuredDocumentEvent {
	private ITextRegion fChangedRegion;
	private IStructuredDocumentRegion fStructuredDocumentRegion;

	/**
	 * Creates instance of a RegionChangedEvent.
	 * 
	 * @param document
	 *            the document being changed.
	 * @param originalRequester
	 *            the object making the request for the change.
	 * @param structuredDocumentRegion
	 *            the containing region
	 * @param changedRegion
	 *            the region that has changed.
	 * @param changes
	 *            the string representing the change.
	 * @param offset
	 *            the offset of the change.
	 * @param lengthToReplace
	 *            the length specified to be replaced.
	 */
	public RegionChangedEvent(IStructuredDocument document, Object originalRequester, IStructuredDocumentRegion structuredDocumentRegion, ITextRegion changedRegion, String changes, int offset, int lengthToReplace) {
		super(document, originalRequester, changes, offset, lengthToReplace);
		fStructuredDocumentRegion = structuredDocumentRegion;
		fChangedRegion = changedRegion;
	}


	/**
	 * Returns the text region changed.
	 * 
	 * @return the text region changed
	 */
	public ITextRegion getRegion() {
		return fChangedRegion;
	}


	/**
	 * Returns the document region changed.
	 * 
	 * @return the document region changed
	 */
	public IStructuredDocumentRegion getStructuredDocumentRegion() {
		return fStructuredDocumentRegion;
	}
}

Back to the top