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());
}
}
}
}
Aggregations