Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-06-21 20:37:43 +0000
committerKai Maetzel2004-06-21 20:37:43 +0000
commitd7d923a12e38970d37f5fca9a314b1195a7ad9d1 (patch)
treeaa98cc1358ec72582b50fd48a9809bbbf0fb5cfe
parent1ef22dafac7aae07178f67654ed1f3976b7db2e0 (diff)
downloadeclipse.platform.text-d7d923a12e38970d37f5fca9a314b1195a7ad9d1.tar.gz
eclipse.platform.text-d7d923a12e38970d37f5fca9a314b1195a7ad9d1.tar.xz
eclipse.platform.text-d7d923a12e38970d37f5fca9a314b1195a7ad9d1.zip
updated Javadoc
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocument.java15
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocumentManager.java10
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/Fragment.java16
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java8
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/IMinimalMapping.java21
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocument.java42
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentEvent.java80
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentManager.java18
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionMapping.java8
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java9
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/Segment.java35
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/SegmentUpdater.java12
-rw-r--r--org.eclipse.text/projection/org/eclipse/jface/text/projection/package.html23
13 files changed, 243 insertions, 54 deletions
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocument.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocument.java
index d07736c08..dfd775d32 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocument.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocument.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,10 +16,11 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
/**
- * Implementation of a child document based on <code>ProjectionDocument</code>.
- * This class exists for compatibility reasons.
+ * Implementation of a child document based on
+ * {@link org.eclipse.jface.text.projection.ProjectionDocument}. This class
+ * exists for compatibility reasons.
* <p>
- * Internal class. Do not use. Public only for testing purposes.
+ * Internal class. This class is not intended to be used by clients.
*
* @since 3.0
*/
@@ -31,6 +32,12 @@ public class ChildDocument extends ProjectionDocument {
*/
static private class VisibleRegion extends Position {
+ /**
+ * Creates a new visible region.
+ *
+ * @param offset the offset of the region
+ * @param length the length of the region
+ */
public VisibleRegion(int offset, int length) {
super(offset, length);
}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocumentManager.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocumentManager.java
index cebc9f696..8109b76e2 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocumentManager.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ChildDocumentManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,14 +10,16 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.IDocument;
+
/**
* Implementation of a child document manager based on
- * <code>ProjectionDocumentManager</code>. This class exists for
- * compatibility reasons.
+ * {@link org.eclipse.jface.text.projection.ProjectionDocumentManager}. This
+ * class exists for compatibility reasons.
* <p>
- * Internal class. Do not use. Only public for testing purposes.
+ * Internal class. This class is not intended to be used by clients.
*
* @since 3.0
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/Fragment.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/Fragment.java
index 674499981..fcdb8c6e8 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/Fragment.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/Fragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,17 +10,31 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.Position;
+
/**
* Internal class. Do not use. Only public for testing purposes.
+ * <p>
+ * A fragment is a range of the master document that has an image, the so called
+ * segment, in a projection document.
*
* @since 3.0
*/
public class Fragment extends Position {
+ /**
+ * The corresponding segment of this fragment.
+ */
public Segment segment;
+ /**
+ * Creates a new fragment covering the given range.
+ *
+ * @param offset the offset of the fragment
+ * @param length the length of the fragment
+ */
public Fragment(int offset, int length) {
super(offset, length);
}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
index 35e37524b..c357f3638 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/FragmentUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,9 +8,9 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
@@ -20,12 +20,10 @@ import org.eclipse.jface.text.Position;
/**
- * The position updater used to adapt the fragments of a document. If an
+ * The position updater used to adapt the fragments of a master document. If an
* insertion happens at a fragment's offset, the fragment is extended rather
* than shifted. Also, the last fragment is extended if an insert operation
* happens at the end of the fragment.
- * <p>
- * Internal class. Do not use. Only public for testing purposes.
*
* @since 3.0
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/IMinimalMapping.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/IMinimalMapping.java
index a07d56644..a0a898319 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/IMinimalMapping.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/IMinimalMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,40 +10,43 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
+
/**
- * Internal interface. Do not use.
+ * Internal interface for defining the exact subset of
+ * {@link org.eclipse.jface.text.projection.ProjectionMapping}that the
+ * {@link org.eclipse.jface.text.projection.ProjectionTextStore}is allowed to
+ * access.
*
* @since 3.0
*/
interface IMinimalMapping {
/**
- * @return
+ * @see org.eclipse.jface.text.IDocumentInformationMapping#getCoverage()
*/
IRegion getCoverage();
/**
- * @param region
- * @return
+ * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginRegion(IRegion)
*/
IRegion toOriginRegion(IRegion region) throws BadLocationException;
/**
- * @param offset
- * @return
+ * @see org.eclipse.jface.text.IDocumentInformationMapping#toOriginOffset(int)
*/
int toOriginOffset(int offset) throws BadLocationException;
/**
- * @return
+ * @see org.eclipse.jface.text.IDocumentInformationMappingExtension#toExactOriginRegions(IRegion)
*/
IRegion[] toExactOriginRegions(IRegion region)throws BadLocationException;
/**
- * @return
+ * @see org.eclipse.jface.text.IDocumentInformationMappingExtension#getImageLength()
*/
int getImageLength();
}
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 c69e66ed5..3f1641c36 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import java.util.ArrayList;
import java.util.List;
@@ -28,7 +29,6 @@ import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
-
/**
* A <code>ProjectionDocument</code> represents a projection of its master
* document. The contents of a projection document is a sequence of fragments of
@@ -36,10 +36,23 @@ import org.eclipse.jface.text.Region;
* constructed from the master document by not copying the whole master document
* but omitting several ranges of the master document.
* <p>
- * The projection document utilizes its master document as
- * <code>ITextStore</code>.
+ * The projection document indirectly utilizes its master document as
+ * <code>ITextStore</code> by means of a <code>ProjectionTextStore</code>.
+ * <p>
+ * The content of a projection document can be changed in two ways. Either by a
+ * text replace applied to the master document or the projection document. Or by
+ * changing the projection between the master document and the projection
+ * document. For the latter the two methods <code>addMasterDocumentRange</code>
+ * and <code>removeMasterDocumentRange</code> are provided. For any
+ * manipulation, the projection document sends out a
+ * {@link org.eclipse.jface.text.projection.ProjectionDocumentEvent} describing
+ * the change.
* <p>
- * API in progress. Do not yet use.
+ * Clients are not supposed to directly instantiate this class. In order to
+ * obtain a projection document, a
+ * {@link org.eclipse.jface.text.projection.ProjectionDocumentManager}should be
+ * used. This class is not intended to be subclassed outside of its origin
+ * package.
*
* @since 3.0
*/
@@ -134,6 +147,11 @@ public class ProjectionDocument extends AbstractDocument {
throw new IllegalStateException();
}
+ /**
+ * Returns the fragments of the master documents.
+ *
+ * @return the fragment of the master document
+ */
protected final Position[] getFragments() {
try {
return fMasterDocument.getPositions(fFragmentsCategory);
@@ -144,6 +162,11 @@ public class ProjectionDocument extends AbstractDocument {
return null;
}
+ /**
+ * Returns the segments of this projection document.
+ *
+ * @return the segments of this projection document
+ */
protected final Position[] getSegments() {
try {
return getPositions(fSegmentsCategory);
@@ -201,6 +224,15 @@ public class ProjectionDocument extends AbstractDocument {
}
}
+ /**
+ * Creates a segment for the given fragment at the given position inside the list of segments.
+ *
+ * @param fragment the corresponding fragment
+ * @param index the index in the list of segments
+ * @return the created segment
+ * @throws BadLocationException in case the fragment is invalid
+ * @throws BadPositionCategoryException in case the segment category is invalid
+ */
private Segment createSegmentFor(Fragment fragment, int index) throws BadLocationException, BadPositionCategoryException {
int offset= 0;
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentEvent.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentEvent.java
index e019a8666..28928b340 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentEvent.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentEvent.java
@@ -10,29 +10,71 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.SlaveDocumentEvent;
+
/**
- * Internal class. Do not use. Only public for testing purposes.
+ * This event is sent out by an
+ * {@link org.eclipse.jface.text.projection.ProjectionDocument}when it is
+ * manipulated. The manipulation is either a content manipulation or a change of
+ * the projection between the master and the slave. Clients can determine the
+ * type of change by asking the projection document event for its change type
+ * (see {@link #getChangeType()}) and comparing it with the predefined types
+ * {@link #PROJECTION_CHANGE}and {@link #CONTENT_CHANGE}.
+ * <p>
+ * Clients are not supposed to create instances of this class. Instances are
+ * created by {@link org.eclipse.jface.text.projection.ProjectionDocument}
+ * instances. This class is not intended to be subclassed.
*
* @since 3.0
*/
public class ProjectionDocumentEvent extends SlaveDocumentEvent {
+ /** The change type indicating a projection change */
public final static Object PROJECTION_CHANGE= new Object();
+ /** The change type indicating a content change */
public final static Object CONTENT_CHANGE= new Object();
-
+
+ /** The change type */
private Object fChangeType;
+ /** The offset of the change in the master document */
private int fMasterOffset= -1;
+ /** The length of the change in the master document */
private int fMasterLength= -1;
+ /**
+ * Creates a new content change event caused by the given master document
+ * change. Instances created using this constructor return <code>-1</code>
+ * when calling <code>getMasterOffset</code> or
+ * <code>getMasterLength</code>. This information can be obtained by
+ * accessing the master event.
+ *
+ * @param doc the changed projection document
+ * @param offset the offset in the projection document
+ * @param length the length in the projection document
+ * @param text the replacement text
+ * @param masterEvent the original master event
+ */
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, DocumentEvent masterEvent) {
super(doc, offset, length, text, masterEvent);
fChangeType= CONTENT_CHANGE;
}
+ /**
+ * Creates a new projection change event for the given properties. Instances
+ * created with this constructor return the given master document offset and
+ * length but do not have an associated master document event.
+ *
+ * @param doc the projection document
+ * @param offset the offset in the projection document
+ * @param length the length in the projection document
+ * @param text the replacement text
+ * @param masterOffset the offset in the master document
+ * @param masterLength the length in the master document
+ */
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength) {
super(doc, offset, length, text, null);
fChangeType= PROJECTION_CHANGE;
@@ -40,6 +82,22 @@ public class ProjectionDocumentEvent extends SlaveDocumentEvent {
fMasterLength= masterLength;
}
+ /**
+ * Creates a new projection document event for the given properties. The
+ * projection change is caused by a manipulation of the master document. In
+ * order to accommodate the master document change, the projection document
+ * had to change the projection. Instances created with this constructor
+ * return the given master document offset and length and also have an
+ * associated master document event.
+ *
+ * @param doc the projection document
+ * @param offset the offset in the projection document
+ * @param length the length in the projection document
+ * @param text the replacement text
+ * @param masterOffset the offset in the master document
+ * @param masterLength the length in the master document
+ * @param masterEvent the master document event
+ */
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength, DocumentEvent masterEvent) {
super(doc, offset, length, text, masterEvent);
fChangeType= PROJECTION_CHANGE;
@@ -47,14 +105,32 @@ public class ProjectionDocumentEvent extends SlaveDocumentEvent {
fMasterLength= masterLength;
}
+ /**
+ * Returns the change type of this event. This is either {@link #PROJECTION_CHANGE} or
+ * {@link #CONTENT_CHANGE}.
+ *
+ * @return the change type of this event
+ */
public Object getChangeType() {
return fChangeType;
}
+ /**
+ * Returns the offset of the master document range that has been added or removed in case this
+ * event describes a projection change, otherwise it returns <code>-1</code>.
+ *
+ * @return the master document offset of the projection change or <code>-1</code>
+ */
public int getMasterOffset() {
return fMasterOffset;
}
+ /**
+ * Returns the length of the master document range that has been added or removed in case this event
+ * describes a projection changed, otherwise <code>-1</code>.
+ *
+ * @return the master document length of the projection change or <code>-1</code>
+ */
public int getMasterLength() {
return fMasterLength;
}
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentManager.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentManager.java
index 9e6bbc8e0..4fe4c6a2c 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentManager.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionDocumentManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,20 +25,22 @@ import org.eclipse.jface.text.ISlaveDocumentManager;
import org.eclipse.jface.text.ISlaveDocumentManagerExtension;
-
/**
- * <code>ProjectionDocumentManager</code> is one particular implementation of
- * <code>ISlaveDocumentManager</code>. This manager creates so called
- * projection documents as slave documents for given master documents.
+ * A <code>ProjectionDocumentManager</code> is one particular implementation
+ * of {@link org.eclipse.jface.text.ISlaveDocumentManager}. This manager
+ * creates so called projection documents (see
+ * {@link org.eclipse.jface.text.projection.ProjectionDocument}as slave
+ * documents for given master documents.
* <p>
* A projection document represents a particular projection of the master
* document and is accordingly adapted to changes of the master document. Vice
* versa, the master document is accordingly adapted to changes of its slave
* documents. The manager does not maintain any particular management structure
- * but utilizes mechanisms given by <code>IDocument</code> such as position
- * categories and position updaters.
+ * but utilizes mechanisms given by {@link org.eclipse.jface.text.IDocument}
+ * such as position categories and position updaters.
* <p>
- * API in progress. Do not yet use.
+ * Clients can instantiate this class. This class is not intended to be
+ * subclassed.
*
* @since 3.0
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionMapping.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionMapping.java
index 8811c0d08..ede2945c6 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionMapping.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
@@ -20,11 +21,12 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
+
/**
* Internal class. Do not use. Only public for testing purposes.
* <p>
- * Implementation of <code>IDocumentInformationMapping</code> for the
- * projection mapping between a master and a slave document.
+ * Implementation of {@link org.eclipse.jface.text.IDocumentInformationMapping}
+ * for the projection mapping between a master and a slave document.
*
* @since 3.0
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
index d2008a709..40219ce4c 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/ProjectionTextStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,18 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextStore;
import org.eclipse.jface.text.Region;
+
/**
- * * Internal class. Do not use. Only public for testing purposes.
- * <p>
* A text store representing the projection defined by the given document
* information mapping.
*
@@ -28,7 +27,7 @@ import org.eclipse.jface.text.Region;
class ProjectionTextStore implements ITextStore {
/**
- * Implementation of <code>IRegion</code> that can be reused
+ * Implementation of {@link IRegion} that can be reused
* by setting the offset and the length.
*/
private static class ReusableRegion implements IRegion {
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/Segment.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/Segment.java
index febbc2725..919c7c488 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/Segment.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/Segment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,39 +10,70 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.Position;
+
/**
* Internal class. Do not use. Only public for testing purposes.
+ * <p>
+ * A segment is the image of a master document fragment in a projection
+ * document.
*
* @since 3.0
*/
public class Segment extends Position {
+ /** The corresponding fragment for this segment. */
public Fragment fragment;
+ /** A flag indicating that the segment updater should stretch this segment when a change happens at its boundaries. */
public boolean isMarkedForStretch;
+ /** A flag indicating that the segment updater should shift this segment when a change happends at its boundaries. */
public boolean isMarkedForShift;
+ /**
+ * Creates a new segment covering the given range.
+ *
+ * @param offset the offset of the segment
+ * @param length the length of the segment
+ */
public Segment(int offset, int length) {
super(offset, length);
}
+ /**
+ * Sets the stretching flag.
+ */
public void markForStretch() {
isMarkedForStretch= true;
}
+ /**
+ * Returns <code>true</code> if the stretching flag is set, <code>false</code> otherwise.
+ * @return <code>true</code> if the stretching flag is set, <code>false</code> otherwise
+ */
public boolean isMarkedForStretch() {
return isMarkedForStretch;
}
+ /**
+ * Sets the shifting flag.
+ */
public void markForShift() {
isMarkedForShift= true;
}
+ /**
+ * Returns <code>true</code> if the shifting flag is set, <code>false</code> otherwise.
+ * @return <code>true</code> if the shifting flag is set, <code>false</code> otherwise
+ */
public boolean isMarkedForShift() {
return isMarkedForShift;
}
-
+
+ /**
+ * Clears the shifting and the streching flag.
+ */
public void clearMark() {
isMarkedForStretch= false;
isMarkedForShift= false;
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/SegmentUpdater.java b/org.eclipse.text/projection/org/eclipse/jface/text/projection/SegmentUpdater.java
index e73f778b7..f4c415b7e 100644
--- a/org.eclipse.text/projection/org/eclipse/jface/text/projection/SegmentUpdater.java
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/SegmentUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jface.text.projection;
+
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultPositionUpdater;
@@ -18,12 +19,11 @@ import org.eclipse.jface.text.Position;
/**
- * Internal class. Do not use. Only public for testing purposes.
- * <p>
* The position updater used to adapt the segments of a projection document to
- * changes of the master document. If an insertion happens at a segment's
- * offset, the segment is extended rather than shifted. Also, the last segment
- * is extended if an insert operation happens at the end of the segment.
+ * changes of the master document. Depending on the flags set on a segment, a
+ * segment is either extended to shifted if an insertion happens at a segment's
+ * offset. The last segment is extended if an insert operation happens at the
+ * end of the segment.
*
* @since 3.0
*/
diff --git a/org.eclipse.text/projection/org/eclipse/jface/text/projection/package.html b/org.eclipse.text/projection/org/eclipse/jface/text/projection/package.html
new file mode 100644
index 000000000..79d33a9df
--- /dev/null
+++ b/org.eclipse.text/projection/org/eclipse/jface/text/projection/package.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html><head>
+ <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
+ <meta content="IBM" name="Author">
+ <meta content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]" name="GENERATOR"><title>projections</title></head>
+
+<body>
+<p>This package provides an implementation of projection documents. Projection
+ is a specific master/slave mapping. Non-overlapping fragments if a master document
+ form the segments of a slave document. The slave document is completely built
+ out of segments, i.e. there are no gaps between two neighboring segments. The
+ segments have exactly the same sequence in which they apprear as fragments in
+ the master document.</p>
+<h3>Package Specification</h3>
+<p><font face="Courier New, Courier, mono">ProjectionDocument</font> is custom
+ <font face="Courier New, Courier, mono">IDocument</font> implementation that
+ uses a <font face="Courier New, Courier, mono">ProjectionTextStore. </font>The
+ content of the <font face="Courier New, Courier, mono">ProjectionDocument</font>
+ is defined by the <font face="Courier New, Courier, mono">ProjectionMapping.
+ </font>The<font face="Courier New, Courier, mono"> ProjectionDocumentManager</font>
+ manages the life cycle of <font face="Courier New, Courier, mono">ProjectionDocuments</font>
+ and their relation to their master documents.</p>
+</body></html> \ No newline at end of file

Back to the top