Search in sources :

Example 51 with IStructuredDocument

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument in project webtools.sourceediting by eclipse.

the class TestAboutToBeChangedEvent method testGetStructuredDocument.

public void testGetStructuredDocument() {
    AboutToBeChangedEvent event = getBasicEvent();
    IStructuredDocument d = event.getStructuredDocument();
    assertNotNull(d);
}
Also used : AboutToBeChangedEvent(org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)

Example 52 with IStructuredDocument

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument in project webtools.sourceediting by eclipse.

the class TestAboutToBeChangedEvent method getBasicEvent.

private AboutToBeChangedEvent getBasicEvent() {
    IStructuredDocument document = StructuredDocumentFactory.getNewStructuredDocumentInstance(new NullParser());
    AboutToBeChangedEvent event = new AboutToBeChangedEvent(document, this, "test", 0, 0);
    return event;
}
Also used : AboutToBeChangedEvent(org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)

Example 53 with IStructuredDocument

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument in project webtools.sourceediting by eclipse.

the class TestNewDocumentEvent method getBasicEvent.

private NewDocumentEvent getBasicEvent() {
    IStructuredDocument document = StructuredDocumentFactory.getNewStructuredDocumentInstance(new NullParser());
    document.setText(this, testString);
    NewDocumentEvent event = new NewDocumentEvent(document, this);
    return event;
}
Also used : NewDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.NewDocumentEvent) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)

Example 54 with IStructuredDocument

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument in project webtools.sourceediting by eclipse.

the class TestRegionChangedEvent method getBasicEvent.

private RegionChangedEvent getBasicEvent() {
    IStructuredDocument document = StructuredDocumentFactory.getNewStructuredDocumentInstance(new NullParser());
    document.setText(this, testString);
    RegionChangedEvent event = new RegionChangedEvent(document, this, null, null, "", 0, 0);
    return event;
}
Also used : RegionChangedEvent(org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent) IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)

Example 55 with IStructuredDocument

use of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument in project webtools.sourceediting by eclipse.

the class JSONDocumentTest method addSpaceBeforeStartObject.

@Test
public void addSpaceBeforeStartObject() throws Exception {
    IJSONModel model = (IJSONModel) TestUtil.createModel();
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    IJSONDocument document = model.getDocument();
    assertNull(document.getFirstChild());
    // Add a JSON Object
    structuredDocument.set("{}");
    assertNotNull(document.getFirstChild());
    Assert.assertTrue(document.getFirstChild() instanceof IJSONObject);
    IJSONObject object1 = (IJSONObject) document.getFirstChild();
    // object is closed
    Assert.assertNotNull(object1.getEndStructuredDocumentRegion());
    // Add space
    structuredDocument.replaceText(structuredDocument, 0, 0, " ");
    assertNotNull(document.getFirstChild());
    IJSONObject object2 = (IJSONObject) document.getFirstChild();
    Assert.assertNotNull(object2.getEndStructuredDocumentRegion());
}
Also used : IStructuredDocument(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument) Test(org.junit.Test)

Aggregations

IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)432 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)96 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)79 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)68 CSSCleanupStrategy (org.eclipse.wst.css.core.internal.cleanup.CSSCleanupStrategy)44 Node (org.w3c.dom.Node)42 ICSSModel (org.eclipse.wst.css.core.internal.provisional.document.ICSSModel)41 Document (org.w3c.dom.Document)36 BadLocationException (org.eclipse.jface.text.BadLocationException)35 IndexedRegion (org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)34 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)34 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)33 Element (org.w3c.dom.Element)30 IDocument (org.eclipse.jface.text.IDocument)29 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)28 IModelManager (org.eclipse.wst.sse.core.internal.provisional.IModelManager)26 StructuredDocumentEvent (org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)23 Test (org.junit.Test)22 INodeAdapter (org.eclipse.wst.sse.core.internal.provisional.INodeAdapter)20 RegionChangedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent)20