Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-06-11 09:50:52 +0000
committerKai Maetzel2004-06-11 09:50:52 +0000
commit8eb7caf29a36507ee3a3685e6fc306224f732fd9 (patch)
tree8ecce3cba5d6294819b4b7e726302f099977b8ca /org.eclipse.text/projection
parented855734643d4975e1762ff7a0160e76b7976a54 (diff)
downloadeclipse.platform.text-8eb7caf29a36507ee3a3685e6fc306224f732fd9.tar.gz
eclipse.platform.text-8eb7caf29a36507ee3a3685e6fc306224f732fd9.tar.xz
eclipse.platform.text-8eb7caf29a36507ee3a3685e6fc306224f732fd9.zip
#66578
Diffstat (limited to 'org.eclipse.text/projection')
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java35
1 files changed, 28 insertions, 7 deletions
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
index 004df814037..2a38c4d17a4 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java
@@ -384,7 +384,16 @@ public class ProjectionDocument extends AbstractDocument {
}
}
- private IRegion[] computeUnprojectedMasterRegions(int offsetInMaster, int lengthInMaster) throws BadLocationException {
+ /**
+ * Returns the sequence of all master document regions with are contained in the given master document
+ * range and which are not yet part of this projection document.
+ *
+ * @param offsetInMaster the range offset in the master document
+ * @param lengthInMaster the range length in the master document
+ * @return the sequence of regions which are not yet part of the projection document
+ * @throws BadLocationException in case the given range is invalid in the master document
+ */
+ public final IRegion[] computeUnprojectedMasterRegions(int offsetInMaster, int lengthInMaster) throws BadLocationException {
IRegion[] fragments= null;
IRegion imageRegion= fMapping.toImageRegion(new Region(offsetInMaster, lengthInMaster));
@@ -462,12 +471,7 @@ public class ProjectionDocument extends AbstractDocument {
* @throws BadLocationException in case the master event is not valid
*/
public void removeMasterDocumentRange(int offsetInMaster, int lengthInMaster) throws BadLocationException {
-
- IRegion[] fragments= null;
- IRegion imageRegion= fMapping.toImageRegion(new Region(offsetInMaster, lengthInMaster));
- if (imageRegion != null)
- fragments= fMapping.toExactOriginRegions(imageRegion);
-
+ IRegion[] fragments= computeProjectedMasterRegions(offsetInMaster, lengthInMaster);
if (fragments == null || fragments.length == 0)
return;
@@ -478,6 +482,23 @@ public class ProjectionDocument extends AbstractDocument {
}
/**
+ * Returns the sequence of all master document regions with are contained in the given master document
+ * range and which are part of this projection document. May return <code>null</code> if no such
+ * regions exist.
+ *
+ * @param offsetInMaster the range offset in the master document
+ * @param lengthInMaster the range length in the master document
+ * @return the sequence of regions which are part of the projection document or <code>null</code>
+ * @throws BadLocationException in case the given range is invalid in the master document
+ */
+ final public IRegion[] computeProjectedMasterRegions(int offsetInMaster, int lengthInMaster) throws BadLocationException {
+ IRegion imageRegion= fMapping.toImageRegion(new Region(offsetInMaster, lengthInMaster));
+ if (imageRegion != null)
+ return fMapping.toExactOriginRegions(imageRegion);
+ return null;
+ }
+
+ /**
* Returns whether this project is being updated.
*
* @return <code>true</code> if the document is updating

Back to the top