Search in sources :

Example 46 with StructuredDocumentEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.

the class StructuredDocumentReParser method checkForPI.

/**
 * A change to a PI tag can result in all being reparsed.
 */
private StructuredDocumentEvent checkForPI() {
    StructuredDocumentEvent result = null;
    // $NON-NLS-1$
    result = checkForCriticalKey("<?");
    if (result == null)
        // $NON-NLS-1$
        result = checkForCriticalKey("?>");
    return result;
}
Also used : StructuredDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)

Example 47 with StructuredDocumentEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.

the class StructuredDocumentReParser method _core_reparse_update_model.

/**
 * Part 2 of 2 steps to do a core_reparse
 *
 * Integrates a list of StructuredDocumentRegions based on the current
 * text contents of the IStructuredDocument into the IStructuredDocument
 * data structure
 */
private StructuredDocumentEvent _core_reparse_update_model(IStructuredDocumentRegion newNodesHead, int rescanStart, int rescanEnd, CoreNodeList oldNodes, boolean firstTime) {
    StructuredDocumentEvent result = null;
    CoreNodeList newNodes = null;
    // rescan
    newNodes = new CoreNodeList(newNodesHead);
    // adjust our newNode chain so the offset positions match
    // our text store (not the simple string of text reparsed)
    StructuredDocumentRegionIterator.adjustStart(newNodesHead, rescanStart);
    // initialize the parentDocument variable of each instance in the new
    // chain
    StructuredDocumentRegionIterator.setParentDocument(newNodesHead, fStructuredDocument);
    // 
    if (firstTime) {
        fStructuredDocument.setCachedDocumentRegion(newNodesHead);
        fStructuredDocument.initializeFirstAndLastDocumentRegion();
        // note: since we are inserting nodes, for the first time, there
        // is
        // no adjustments
        // to downstream stuff necessary.
        result = new StructuredDocumentRegionsReplacedEvent(fStructuredDocument, fRequester, oldNodes, newNodes, fChanges, fStart, fLengthToReplace, fIsEntireDocument);
    } else {
        // note: integrates changes into model as a side effect
        result = minimumEvent(oldNodes, newNodes);
    }
    result.setDeletedText(fDeletedText);
    return result;
}
Also used : StructuredDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent) StructuredDocumentRegionsReplacedEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentRegionsReplacedEvent)

Example 48 with StructuredDocumentEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.

the class StructuredDocumentReParser method reparse.

/**
 * An entry point for reparsing. It calculates the dirty start and dirty
 * end flatnodes based on the start point and length of the changes.
 */
public StructuredDocumentEvent reparse() {
    StructuredDocumentEvent result = null;
    // otherwise, find them.
    if (fStructuredDocument.getCachedDocumentRegion() != null) {
        findDirtyStart(fStart);
        int end = fStart + fLengthToReplace;
        findDirtyEnd(end);
    }
    if (fStructuredDocument.getCachedDocumentRegion() != null) {
        result = checkHeuristics();
    }
    if (result == null) {
        result = reparse(dirtyStart, dirtyEnd);
    }
    endReParse();
    return result;
}
Also used : StructuredDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)

Example 49 with StructuredDocumentEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.

the class StructuredDocumentReParser method core_reparse.

/**
 * The core reparsing method ... after the dirty start and dirty end have
 * been calculated elsewhere, and the text updated.
 */
protected StructuredDocumentEvent core_reparse(int rescanStart, int rescanEnd, CoreNodeList oldNodes, boolean firstTime) {
    IStructuredDocumentRegion newNodesHead = null;
    StructuredDocumentEvent result = null;
    newNodesHead = _core_reparse_text(rescanStart, rescanEnd);
    result = _core_reparse_update_model(newNodesHead, rescanStart, rescanEnd, oldNodes, firstTime);
    return result;
}
Also used : StructuredDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent) IStructuredDocumentRegion(org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)

Example 50 with StructuredDocumentEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.

the class StructuredDocumentReParser method reparse.

/**
 * An entry point for reparsing. It calculates the dirty start and dirty
 * end flatnodes based on suggested positions to begin and end. This is
 * needed for cases where parsing must go beyond the immediate node and
 * its direct neighbors.
 */
protected StructuredDocumentEvent reparse(int reScanStartHint, int reScanEndHint) {
    StructuredDocumentEvent result = null;
    // must be empty, so simply use 'null' as the dirtyStart and dirtyEnd
    if (fStructuredDocument.getCachedDocumentRegion() != null) {
        findDirtyStart(reScanStartHint);
        findDirtyEnd(reScanEndHint);
    }
    result = reparse(dirtyStart, dirtyEnd);
    isParsing = false;
    // verifyStructured(result);
    return result;
}
Also used : StructuredDocumentEvent(org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)

Aggregations

StructuredDocumentEvent (org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent)59 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)23 RegionChangedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent)22 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)20 Document (org.w3c.dom.Document)20 Node (org.w3c.dom.Node)20 NullInputStream (org.eclipse.wst.sse.core.internal.encoding.util.NullInputStream)18 INodeAdapter (org.eclipse.wst.sse.core.internal.provisional.INodeAdapter)18 INodeNotifier (org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)18 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)8 NoChangeEvent (org.eclipse.wst.sse.core.internal.provisional.events.NoChangeEvent)6 IExecutionDelegate (org.eclipse.wst.sse.core.internal.IExecutionDelegate)3 StructuredDocumentRegionsReplacedEvent (org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentRegionsReplacedEvent)3 RegionsReplacedEvent (org.eclipse.wst.sse.core.internal.provisional.events.RegionsReplacedEvent)2 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)2 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)2 List (java.util.List)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 DocumentEvent (org.eclipse.jface.text.DocumentEvent)1 IRegion (org.eclipse.jface.text.IRegion)1