Tag: editor_api User: vstejskal Date: 2006/11/20 01:39:49 Modified: editor/lib2/src/org/netbeans/modules/editor/lib2/view/HighlightingSpiPackageAccessor.java editor/lib2/src/org/netbeans/modules/editor/lib2/view/HighlightingManager.java editor/lib2/src/org/netbeans/spi/editor/highlighting/package.html editor/lib2/src/org/netbeans/spi/editor/highlighting/PositionsBag.java editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsSequence.java editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsContainer.java editor/lib2/src/org/netbeans/spi/editor/highlighting/ZOrder.java editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsLayerFactory.java editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsLayer.java editor/lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/performance/PositionsBagMemoryTest.java editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/performance/PositionsBagFindHighlightTest.java editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/PositionsBagRandomTest.java editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/PositionsBagTest.java editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/MergingPositionsBagTest.java editor/lib2/test/cfg-unit.xml editor/lib2/test/unit/src/org/netbeans/modules/editor/lib2/view/CompoundHighlightsContainerTest.java editor/lib2/test/unit/src/org/netbeans/modules/editor/lib2/view/ProxyHighlightsContainerTest.java Log: updated with feedback from the review File Changes: Directory: /editor/lib2/src/org/netbeans/modules/editor/lib2/view/ ================================================================== File [changed]: HighlightingSpiPackageAccessor.java Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/modules/editor/lib2/view/HighlightingSpiPackageAccessor.java?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +5 -0 ------------------- --- HighlightingSpiPackageAccessor.java 7 Sep 2006 21:14:11 -0000 1.1.2.2 +++ HighlightingSpiPackageAccessor.java 20 Nov 2006 09:39:42 -0000 1.1.2.3 @@ -19,10 +19,13 @@ package org.netbeans.modules.editor.lib2.view; +import java.util.Collection; +import java.util.List; import javax.swing.text.Document; import javax.swing.text.JTextComponent; import org.netbeans.spi.editor.highlighting.HighlightsLayer; import org.netbeans.spi.editor.highlighting.HighlightsLayerFactory; +import org.openide.util.TopologicalSortException; /** * @@ -54,4 +57,6 @@ } public abstract HighlightsLayerFactory.Context createFactoryContext(Document document, JTextComponent component); + + public abstract List extends HighlightsLayer> sort(Collection extends HighlightsLayer> layers) throws TopologicalSortException; } File [changed]: HighlightingManager.java Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/modules/editor/lib2/view/HighlightingManager.java?r1=1.1.2.6&r2=1.1.2.7 Delta lines: +1 -1 ------------------- --- HighlightingManager.java 27 Oct 2006 07:52:25 -0000 1.1.2.6 +++ HighlightingManager.java 20 Nov 2006 09:39:42 -0000 1.1.2.7 @@ -209,7 +209,7 @@ List extends HighlightsLayer> sortedLayers; try { - sortedLayers = ZOrder.sort(layers.values()); + sortedLayers = HighlightingSpiPackageAccessor.get().sort(layers.values()); } catch (TopologicalSortException tse) { ErrorManager.getDefault().notify(tse); @SuppressWarnings("unchecked") Directory: /editor/lib2/src/org/netbeans/spi/editor/highlighting/ ================================================================= File [changed]: package.html Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/spi/editor/highlighting/package.html?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +53 -2 -------------------- --- package.html 31 Oct 2006 06:30:54 -0000 1.1.2.3 +++ package.html 20 Nov 2006 09:39:43 -0000 1.1.2.4 @@ -202,9 +202,60 @@ readers that can run concurrently.
+ +
+ Since there can be multiple layers suplying highlights for one document and the
+ highlights can generally overlap it is important to sort the layers according
+ to their Z-order. For this purpose each layer has to supply appropriate
+ ZOrder
and its unique identification when it is cunstructed.
+
The layers are identified by their layer type id, which is simply
+ a String
uniquely identifying layers of the same type.
+ An example of a layer type can be a 'syntax highlighting' layer.
+ Since this layer can
+ be implemented using the new Lexer framework the same implementation can be used
+ for many types of a document (e.g. java files, properties, manifests, etc.). This
+ means that there is likely to be many instances of the 'syntax highlighting'
+ layer - one for each opened document - and each of those instances will have
+ the same layer type id and ZOrder
positioning it among
+ the other layers created for a particular document.
+
+ ZOrder
maintains a position of a layer
+ relatively to other layers by keeping a list of ids of layers laying above
+ the ZOrder
's layer and a list of layer ids laying below the
+ layer. Instances of the ZOrder
class are immutable making it
+ impossible to dynamically change a position of a layer in the z-order stack
+ created for a document. There is a couple of static methods allowing creation
+ of an instance of ZOrder
and also methods for creating
+ an instance of ZOrder
based on another instance.
+
+ The ZOrder
class contains several predefined z-order constants,
+ which can be used as well-known positions. These constants are called z-order
+ racks and are meant to be used as a starting point for positioning a layer. The
+ racks are listed below in their respective z-order.
+
TOP_RACK
- the top most rackCARET_RACK
- layers highlighting a caret position,
+ text selection, etc.
+ DEFAULT_RACK
- the rack for general layersSYNTAX_RACK
- layers providing syntax or semantic
+ highlighting of textBOTOM_RACK
- the bottom rackPositionsBag
, which trims highlights
* as they are added. It calls the {@link #PositionsBag(boolean)} constructore
* passing false
as a parameter.
+ *
+ * @param document The document that should be highlighted.
*/
- public PositionsBag() {
- this(false);
+ public PositionsBag(Document document) {
+ this(document, false);
}
/**
* Creates a new instance of PositionsBag
.
*
+ * @param document The document that should be highlighted.
* @param mergeHighlights Determines whether highlights should be merged
* or trimmed.
*/
- public PositionsBag(boolean mergeHighlights) {
+ public PositionsBag(Document document, boolean mergeHighlights) {
+ this.document = document;
this.mergeHighlights = mergeHighlights;
}
File [changed]: HighlightsSequence.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsSequence.java?r1=1.1.2.5&r2=1.1.2.6
Delta lines: +4 -4
-------------------
--- HighlightsSequence.java 27 Oct 2006 07:52:25 -0000 1.1.2.5
+++ HighlightsSequence.java 20 Nov 2006 09:39:43 -0000 1.1.2.6
@@ -66,7 +66,7 @@
*
* @return true
if there is a highlight available and it is safe
* to call the getters.
- * @throws ConcurrentModificationExceptoin If the highlights this sequence is
+ * @throws ConcurrentModificationException If the highlights this sequence is
* iterating through have been changed since the creation of the sequence.
*/
boolean moveNext();
@@ -75,7 +75,7 @@
* Gets the start offset of a current highlight.
*
* @return The offset in a document where the current highlight starts.
- * @throws ConcurrentModificationExceptoin If the highlights this sequence is
+ * @throws ConcurrentModificationException If the highlights this sequence is
* iterating through have been changed since the creation of the sequence.
*/
int getStartOffset();
@@ -84,7 +84,7 @@
* Gets the end offset of a current highlight.
*
* @return The offset in a document where the current highlight ends.
- * @throws ConcurrentModificationExceptoin If the highlights this sequence is
+ * @throws ConcurrentModificationException If the highlights this sequence is
* iterating through have been changed since the creation of the sequence.
*/
int getEndOffset();
@@ -107,7 +107,7 @@
* {@link javax.swing.text.StyleConstants#Italic}.
*
* @return The set of text rendering attributes. Must not return null
.
- * @throws ConcurrentModificationExceptoin If the highlights this sequence is
+ * @throws ConcurrentModificationException If the highlights this sequence is
* iterating through have been changed since the creation of the sequence.
*/
AttributeSet getAttributes();
File [changed]: HighlightsContainer.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsContainer.java?r1=1.1.2.2&r2=1.1.2.3
Delta lines: +11 -4
--------------------
--- HighlightsContainer.java 3 Oct 2006 17:14:18 -0000 1.1.2.2
+++ HighlightsContainer.java 20 Nov 2006 09:39:43 -0000 1.1.2.3
@@ -32,16 +32,23 @@
* Provides the list of highlighted areas that should be used for rendering
* a document.
*
- * The returned highlighted areas (highlights) should obey the following rules: + *
The returned highlighted areas (highlights) must obey the following rules: *
startOffset
and endOffset
- * parameters. Any highlights outside of this range will be clipped.
- * The editor infrastructure will log any problems it may encounter with
+ * provided implementations of this interface. Although the infrastructure
+ * will try to do its best to render all highlights supplied by the implementors,
+ * if the above rules are broken the results can't be garanteed.
+ *
* @param startOffset The starting offset of the area which the caller
* attempts to repaint (or create views for). The staring offset is always >=0.
* @param endOffset The ending offset of the rendered area. The Integer.MAX_VALUE
File [changed]: ZOrder.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/spi/editor/highlighting/ZOrder.java?r1=1.1.2.3&r2=1.1.2.4
Delta lines: +2 -2
-------------------
--- ZOrder.java 30 Oct 2006 12:17:09 -0000 1.1.2.3
+++ ZOrder.java 20 Nov 2006 09:39:43 -0000 1.1.2.4
@@ -149,7 +149,7 @@
* with the lowest z-order and going to the highest one.
* @throws TopologicalSortException If the array contains cycles.
*/
- public static HighlightsLayer[] sort(HighlightsLayer[] layers) throws TopologicalSortException {
+ /* package */ static HighlightsLayer[] sort(HighlightsLayer[] layers) throws TopologicalSortException {
List extends HighlightsLayer> list = sort(Arrays.asList(layers));
return list.toArray(new HighlightsLayer [list.size()]);
}
@@ -167,7 +167,7 @@
* with the lowest z-order and going to the highest one.
* @throws TopologicalSortException If the collection contains cycles.
*/
- public static List extends HighlightsLayer> sort(Collection extends HighlightsLayer> layers) throws TopologicalSortException {
+ /* package */ static List extends HighlightsLayer> sort(Collection extends HighlightsLayer> layers) throws TopologicalSortException {
HashMapHighlightsLayer
s,
* which will participate in rendering a document. All factories that the infrastructure
* considers relelvant for rendering a document will be asked to create
- * HighlightsLayer
s for that document. The created layers are then
- * positioned according to their z-order and asked for their highlights
- * when the document is rendered on a screen. Layers with higher z-order take
- * precedence over the layers with lower z-order.
+ * HighlightsLayer
s for that document.
*
* @author Miloslav Metelka
* @author Vita Stejskal
File [changed]: HighlightsLayer.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/spi/editor/highlighting/HighlightsLayer.java?r1=1.1.2.3&r2=1.1.2.4
Delta lines: +20 -2
--------------------
--- HighlightsLayer.java 11 Oct 2006 05:25:40 -0000 1.1.2.3
+++ HighlightsLayer.java 20 Nov 2006 09:39:44 -0000 1.1.2.4
@@ -21,12 +21,14 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.NoSuchElementException;
import javax.swing.text.AttributeSet;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import org.netbeans.modules.editor.lib2.view.HighlightingSpiPackageAccessor;
+import org.openide.util.TopologicalSortException;
import org.openide.util.Utilities;
/**
@@ -79,7 +81,14 @@
private ListHighlightsLayer
with given ID and z-order.
+ * Creates a new HighlightsLayer
with given ID and z-order. The
+ * following values will be used by default for the other parameters.
+ *
+ *
+ *
+ *
* @see #HighlightsLayer(String,ZOrder,boolean, boolean)
*/
protected HighlightsLayer(String layerTypeId, ZOrder zOrder) {
@@ -105,7 +114,10 @@
* Creates a new fizedSize = false
+ * lineHighlighting = false
+ * HighlightsLayer
as a proxy to another
* HighlightsContainer
.
*
- * @param layerTypeId The unique identifier of the new layer.
+ * @param layerTypeId The unique identifier of the new layer. This id is
+ * used for identifying this layer among other layers that may be created
+ * for the same Document
and it is used for example for
+ * the purpose of z-order.
* @param zOrder The layer's z-order.
* @param fixedSize Whether this layer defines any attributes
* affecting text rendering including attributes that affect the size
@@ -114,6 +126,8 @@
* should span across the full width of the line in an editor pane.
* @param container HighlightsContainer
that should be used
* as a contents of this layer. Can be null
.
+ *
+ * @see org.netbeans.spi.editor.highlighting.ZOrder
*/
protected HighlightsLayer(String layerTypeId, ZOrder zOrder, boolean fixedSize, boolean lineHighlighting, HighlightsContainer container) {
assert layerTypeId != null : "The layerId parameter must not be null.";
@@ -133,6 +147,7 @@
* Gets the unique identifier of this layer.
*
* @return The layer id.
+ * @see org.netbeans.spi.editor.highlighting.ZOrder
*/
public final String getLayerTypeId() {
return layerTypeId;
@@ -322,5 +337,8 @@
return new HighlightsLayerFactory.Context(document, component);
}
+ public List extends HighlightsLayer> sort(Collection extends HighlightsLayer> layers) throws TopologicalSortException {
+ return ZOrder.sort(layers);
+ }
} // End of PackageAccessor class
}
Directory: /editor/lib2/src/org/netbeans/modules/editor/lib2/highlighting/
==========================================================================
File [changed]: BlockHighlighting.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/src/org/netbeans/modules/editor/lib2/highlighting/BlockHighlighting.java?r1=1.1.2.9&r2=1.1.2.10
Delta lines: +2 -2
-------------------
--- BlockHighlighting.java 30 Oct 2006 05:00:05 -0000 1.1.2.9
+++ BlockHighlighting.java 20 Nov 2006 09:39:44 -0000 1.1.2.10
@@ -52,7 +52,7 @@
/** Creates a new instance of BlockSearchHighlighting */
public BlockHighlighting(String layerId, ZOrder zOrder, JTextComponent component) {
- this(layerId, zOrder, component, new PositionsBag());
+ this(layerId, zOrder, component, new PositionsBag(component.getDocument()));
}
private BlockHighlighting(String layerId, ZOrder zOrder, JTextComponent component, PositionsBag bag) {
@@ -74,7 +74,7 @@
}
try {
- PositionsBag newBag = new PositionsBag();
+ PositionsBag newBag = new PositionsBag(document);
newBag.addHighlight(
document.createPosition(startOffset),
document.createPosition(endOffset),
Directory: /editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/performance/
=======================================================================================
File [changed]: PositionsBagMemoryTest.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/performance/PositionsBagMemoryTest.java?r1=1.1.2.2&r2=1.1.2.3
Delta lines: +6 -3
-------------------
--- PositionsBagMemoryTest.java 6 Nov 2006 01:03:41 -0000 1.1.2.2
+++ PositionsBagMemoryTest.java 20 Nov 2006 09:39:44 -0000 1.1.2.3
@@ -22,6 +22,8 @@
import java.lang.reflect.Method;
import java.util.Collections;
import javax.swing.text.AttributeSet;
+import javax.swing.text.Document;
+import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.SimpleAttributeSet;
import org.netbeans.junit.MemoryFilter;
@@ -75,7 +77,7 @@
}
private void checkMemoryConsumption(boolean merging, boolean bestCase) {
- PositionsBag bag = new PositionsBag(merging);
+ PositionsBag bag = new PositionsBag(new PlainDocument(), merging);
for(int i = 0; i < CNT; i++) {
if (bestCase) {
@@ -92,7 +94,7 @@
}
private void checkIteratorMemoryConsumption(boolean merging, boolean bestCase) {
- PositionsBag bag = new PositionsBag(merging);
+ PositionsBag bag = new PositionsBag(new PlainDocument(), merging);
for(int i = 0; i < CNT; i++) {
if (bestCase) {
@@ -144,7 +146,8 @@
private static final class MF implements MemoryFilter {
public boolean reject(Object obj) {
if (Position.class.isAssignableFrom(obj.getClass()) ||
- AttributeSet.class.isAssignableFrom(obj.getClass()))
+ AttributeSet.class.isAssignableFrom(obj.getClass()) ||
+ Document.class.isAssignableFrom(obj.getClass()))
{
return true;
} else {
File [changed]: PositionsBagFindHighlightTest.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/performance/PositionsBagFindHighlightTest.java?r1=1.1.2.1&r2=1.1.2.2
Delta lines: +2 -1
-------------------
--- PositionsBagFindHighlightTest.java 30 Oct 2006 05:00:07 -0000 1.1.2.1
+++ PositionsBagFindHighlightTest.java 20 Nov 2006 09:39:45 -0000 1.1.2.2
@@ -19,6 +19,7 @@
package org.netbeans.spi.editor.highlighting.performance;
+import javax.swing.text.PlainDocument;
import javax.swing.text.SimpleAttributeSet;
import junit.framework.TestSuite;
import org.netbeans.junit.NbTestCase;
@@ -48,7 +49,7 @@
protected void setUp() {
cnt = this.getTestNumber();
- bag = new PositionsBag(false);
+ bag = new PositionsBag(new PlainDocument(), false);
for(int i = 0; i < cnt; i++) {
bag.addHighlight(new SimplePosition(i * 10), new SimplePosition(i * 10 + 5), SimpleAttributeSet.EMPTY);
Directory: /editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/
===========================================================================
File [changed]: PositionsBagRandomTest.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/PositionsBagRandomTest.java?r1=1.1.2.1&r2=1.1.2.2
Delta lines: +3 -2
-------------------
--- PositionsBagRandomTest.java 30 Oct 2006 05:00:09 -0000 1.1.2.1
+++ PositionsBagRandomTest.java 20 Nov 2006 09:39:45 -0000 1.1.2.2
@@ -23,6 +23,7 @@
import java.util.Enumeration;
import java.util.Random;
import javax.swing.text.AttributeSet;
+import javax.swing.text.PlainDocument;
import javax.swing.text.Position;
import javax.swing.text.SimpleAttributeSet;
import org.netbeans.junit.NbTestCase;
@@ -262,7 +263,7 @@
private PositionsBag createRandomBag(String bagId) {
- PositionsBag bag = new PositionsBag(false);
+ PositionsBag bag = new PositionsBag(new PlainDocument(), false);
int attrIdx = 0;
int startOffset = START;
@@ -293,7 +294,7 @@
}
private PositionsBag mergeContainers(boolean merge, String [] layerNames, HighlightsContainer [] containers) {
- PositionsBag bag = new PositionsBag(merge);
+ PositionsBag bag = new PositionsBag(new PlainDocument(), merge);
for (int i = 0; i < containers.length; i++) {
HighlightsSequence layerHighlights =
File [changed]: PositionsBagTest.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/PositionsBagTest.java?r1=1.1.2.1&r2=1.1.2.2
Delta lines: +31 -31
---------------------
--- PositionsBagTest.java 30 Oct 2006 05:00:11 -0000 1.1.2.1
+++ PositionsBagTest.java 20 Nov 2006 09:39:45 -0000 1.1.2.2
@@ -47,7 +47,7 @@
}
public void testSimple() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
assertEquals("Sequence should be empty", 0, hs.getMarks().size());
hs.addHighlight(pos(10), pos(20), EMPTY);
@@ -61,7 +61,7 @@
}
public void testAddLeftOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -85,7 +85,7 @@
}
public void testAddRightOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -109,7 +109,7 @@
}
public void testAddCompleteOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -129,7 +129,7 @@
}
public void testAddSplit() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -157,7 +157,7 @@
}
public void testAddAligned() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -196,7 +196,7 @@
}
public void testAddAligned2() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -231,7 +231,7 @@
}
private void addMiddle(int middleMarks) {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
SimpleAttributeSet attribsC = new SimpleAttributeSet();
@@ -275,7 +275,7 @@
}
public void testRemoveLeftOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -288,7 +288,7 @@
}
public void testRemoveLeftOverlapClip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -306,7 +306,7 @@
}
public void testRemoveRightOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -319,7 +319,7 @@
}
public void testRemoveRightOverlapClip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -337,7 +337,7 @@
}
public void testRemoveCompleteOverlap() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -350,7 +350,7 @@
}
public void testRemoveCompleteOverlapClip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -363,7 +363,7 @@
}
public void testRemoveSplit() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -376,7 +376,7 @@
}
public void testRemoveSplitClip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -399,7 +399,7 @@
}
public void testRemoveAlignedClip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -424,7 +424,7 @@
}
public void testRemoveAligned2Clip() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
attribsA.addAttribute("set-name", "attribsA");
@@ -450,7 +450,7 @@
}
public void testRemoveMiddle() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -472,7 +472,7 @@
}
private void removeMiddleClip(int middleMarks) {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -509,8 +509,8 @@
}
public void testAddAll() {
- PositionsBag hsA = new PositionsBag();
- PositionsBag hsB = new PositionsBag();
+ PositionsBag hsA = new PositionsBag(doc);
+ PositionsBag hsB = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -547,8 +547,8 @@
}
public void testSet() {
- PositionsBag hsA = new PositionsBag();
- PositionsBag hsB = new PositionsBag();
+ PositionsBag hsA = new PositionsBag(doc);
+ PositionsBag hsB = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -589,7 +589,7 @@
}
public void testGetHighlights() {
- PositionsBag hs = new PositionsBag();
+ PositionsBag hs = new PositionsBag(doc);
assertFalse("Sequence should be empty", hs.getHighlights(
Integer.MIN_VALUE, Integer.MAX_VALUE).moveNext());
@@ -610,7 +610,7 @@
}
public void testGetHighlights2() {
- PositionsBag hb = new PositionsBag();
+ PositionsBag hb = new PositionsBag(doc);
hb.addHighlight(pos(10), pos(20), SimpleAttributeSet.EMPTY);
HighlightsSequence hs = hb.getHighlights(0, 5);
@@ -634,7 +634,7 @@
public void testConcurrentModification() {
{
- PositionsBag hb = new PositionsBag();
+ PositionsBag hb = new PositionsBag(doc);
HighlightsSequence hs = hb.getHighlights(Integer.MIN_VALUE, Integer.MAX_VALUE);
// Modify the bag
@@ -649,7 +649,7 @@
}
{
- PositionsBag hb = new PositionsBag();
+ PositionsBag hb = new PositionsBag(doc);
hb.addHighlight(pos(5), pos(10), EMPTY);
HighlightsSequence hs = hb.getHighlights(Integer.MIN_VALUE, Integer.MAX_VALUE);
@@ -667,7 +667,7 @@
}
{
- PositionsBag hb = new PositionsBag();
+ PositionsBag hb = new PositionsBag(doc);
hb.addHighlight(pos(5), pos(10), EMPTY);
HighlightsSequence hs = hb.getHighlights(Integer.MIN_VALUE, Integer.MAX_VALUE);
@@ -685,7 +685,7 @@
}
{
- PositionsBag hb = new PositionsBag();
+ PositionsBag hb = new PositionsBag(doc);
hb.addHighlight(pos(5), pos(10), EMPTY);
HighlightsSequence hs = hb.getHighlights(Integer.MIN_VALUE, Integer.MAX_VALUE);
@@ -707,7 +707,7 @@
Document doc = new PlainDocument();
doc.insertString(0, "01234567890123456789012345678901234567890123456789", SimpleAttributeSet.EMPTY);
- PositionsBag bag = new PositionsBag();
+ PositionsBag bag = new PositionsBag(doc);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
File [changed]: MergingPositionsBagTest.java
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/unit/src/org/netbeans/spi/editor/highlighting/MergingPositionsBagTest.java?r1=1.1.2.1&r2=1.1.2.2
Delta lines: +12 -12
---------------------
--- MergingPositionsBagTest.java 30 Oct 2006 05:00:11 -0000 1.1.2.1
+++ MergingPositionsBagTest.java 20 Nov 2006 09:39:45 -0000 1.1.2.2
@@ -46,7 +46,7 @@
}
public void testSimple() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
assertEquals("Sequence should be empty", 0, hs.getMarks().size());
hs.addHighlight(pos(10), pos(20), EMPTY);
@@ -62,7 +62,7 @@
}
public void testAddLeftOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -90,7 +90,7 @@
}
public void testAddRightOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -118,7 +118,7 @@
}
public void testAddLeftMatchBiggerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -142,7 +142,7 @@
}
public void testAddRightMatchBiggerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -166,7 +166,7 @@
}
public void testAddCompleteMatchOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -186,7 +186,7 @@
}
public void testAddBiggerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -214,7 +214,7 @@
}
public void testAddLeftMatchSmallerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -238,7 +238,7 @@
}
public void testAddRightMatchSmallerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -262,7 +262,7 @@
}
public void testAddSmallerOverlap() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -290,7 +290,7 @@
}
public void testOrdering() {
- PositionsBag hs = new PositionsBag(true);
+ PositionsBag hs = new PositionsBag(doc, true);
SimpleAttributeSet attribsA = new SimpleAttributeSet();
SimpleAttributeSet attribsB = new SimpleAttributeSet();
@@ -419,7 +419,7 @@
}
public void checkMerging(Object [] src, Object [] trg, boolean merge) {
- PositionsBag hs = new PositionsBag(merge);
+ PositionsBag hs = new PositionsBag(doc, merge);
for (int i = 0; i < src.length / 3; i++) {
SimpleAttributeSet as = new SimpleAttributeSet();
Directory: /editor/lib2/test/
=============================
File [changed]: cfg-unit.xml
Url: http://editor.netbeans.org/source/browse/editor/lib2/test/cfg-unit.xml?r1=1.1.2.3&r2=1.1.2.4
Delta lines: +1 -1
-------------------
--- cfg-unit.xml 22 Sep 2006 12:43:51 -0000 1.1.2.3
+++ cfg-unit.xml 20 Nov 2006 09:39:46 -0000 1.1.2.4
@@ -46,7 +46,7 @@