Search in sources :

Example 1 with AboutToBeChangedEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent 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 2 with AboutToBeChangedEvent

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

the class TestAboutToBeChangedEvent method testGetDeletedText.

public void testGetDeletedText() {
    AboutToBeChangedEvent event = getBasicEvent();
    String d = event.getDeletedText();
    assertEquals(d, null);
}
Also used : AboutToBeChangedEvent(org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent)

Example 3 with AboutToBeChangedEvent

use of org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent 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 4 with AboutToBeChangedEvent

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

the class BasicStructuredDocument method _fireStructuredDocumentAboutToChange.

private void _fireStructuredDocumentAboutToChange(Object[] listeners) {
    // another thread
    if (listeners != null) {
        Object[] holdListeners = listeners;
        // fire
        for (int i = 0; i < holdListeners.length; i++) {
            if (Debug.perfTest || Debug.perfTestStructuredDocumentEventOnly) {
                startTime = System.currentTimeMillis();
            }
            // safeguard from listeners that throw exceptions
            try {
                // originalRequester?
                if (fDocumentEvent == null) {
                    fDocumentEvent = new NullDocumentEvent();
                }
                AboutToBeChangedEvent aboutToBeChangedEvent = new AboutToBeChangedEvent(this, null, fDocumentEvent.getText(), fDocumentEvent.getOffset(), fDocumentEvent.getLength());
                // this is a safe cast, since addListners requires a
                // IStructuredDocumentListener
                ((IModelAboutToBeChangedListener) holdListeners[i]).modelAboutToBeChanged(aboutToBeChangedEvent);
            } catch (Exception exception) {
                Logger.logException(exception);
            }
            if (Debug.perfTest || Debug.perfTestStructuredDocumentEventOnly) {
                long stopTime = System.currentTimeMillis();
                // $NON-NLS-2$//$NON-NLS-1$
                System.out.println("\n\t\t\t\t IStructuredDocument::fireStructuredDocumentEvent. Time was " + (stopTime - startTime) + " msecs to fire NewModelEvent to instance of " + holdListeners[i].getClass());
            }
        }
    }
}
Also used : IModelAboutToBeChangedListener(org.eclipse.wst.sse.core.internal.provisional.events.IModelAboutToBeChangedListener) AboutToBeChangedEvent(org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent) BadPositionCategoryException(org.eclipse.jface.text.BadPositionCategoryException) BadLocationException(org.eclipse.jface.text.BadLocationException) BadPartitioningException(org.eclipse.jface.text.BadPartitioningException)

Example 5 with AboutToBeChangedEvent

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

the class TestAboutToBeChangedEvent method testAboutToBeChangedEvent.

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

Aggregations

AboutToBeChangedEvent (org.eclipse.wst.sse.core.internal.provisional.events.AboutToBeChangedEvent)7 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)2 BadLocationException (org.eclipse.jface.text.BadLocationException)1 BadPartitioningException (org.eclipse.jface.text.BadPartitioningException)1 BadPositionCategoryException (org.eclipse.jface.text.BadPositionCategoryException)1 IModelAboutToBeChangedListener (org.eclipse.wst.sse.core.internal.provisional.events.IModelAboutToBeChangedListener)1