Search in sources :

Example 1 with IModelAboutToBeChangedListener

use of org.eclipse.wst.sse.core.internal.provisional.events.IModelAboutToBeChangedListener 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)

Aggregations

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