use of org.eclipse.jface.text.DocumentRewriteSessionEvent in project webtools.sourceediting by eclipse.
the class BasicStructuredDocument method internalStartRewriteSession.
/**
* NOT-API. Final protected so clients may call this method if needed, but
* cannot override.
*
* @param sessionType
* @return
* @throws IllegalStateException
*/
protected final DocumentRewriteSession internalStartRewriteSession(DocumentRewriteSessionType sessionType) throws IllegalStateException {
if (getActiveRewriteSession() != null)
throw new IllegalStateException("already in a rewrite session");
DocumentRewriteSession session = new StructuredDocumentRewriteSession(sessionType);
DocumentRewriteSessionEvent event = new DocumentRewriteSessionEvent(this, session, DocumentRewriteSessionEvent.SESSION_START);
fireDocumentRewriteSessionEvent(event);
ILineTracker tracker = getTracker();
if (tracker instanceof ILineTrackerExtension) {
ILineTrackerExtension extension = (ILineTrackerExtension) tracker;
extension.startRewriteSession(session);
}
startRewriteSessionOnPartitioners(session);
if (DocumentRewriteSessionType.SEQUENTIAL == sessionType)
startSequentialRewrite(false);
else if (DocumentRewriteSessionType.STRICTLY_SEQUENTIAL == sessionType)
startSequentialRewrite(true);
fActiveRewriteSession = session;
return session;
}
use of org.eclipse.jface.text.DocumentRewriteSessionEvent in project webtools.sourceediting by eclipse.
the class BasicStructuredDocument method internalStopRewriteSession.
/**
* NOT-API. Final protected so clients may call this method if needed, but
* cannot override.
*
* @param session
*/
protected final void internalStopRewriteSession(DocumentRewriteSession session) {
if (fActiveRewriteSession == session) {
DocumentRewriteSessionType sessionType = session.getSessionType();
if (DocumentRewriteSessionType.SEQUENTIAL == sessionType || DocumentRewriteSessionType.STRICTLY_SEQUENTIAL == sessionType)
stopSequentialRewrite();
stopRewriteSessionOnPartitioners(session);
ILineTracker tracker = getTracker();
if (tracker instanceof ILineTrackerExtension) {
ILineTrackerExtension extension = (ILineTrackerExtension) tracker;
extension.stopRewriteSession(session, get());
}
fActiveRewriteSession = null;
DocumentRewriteSessionEvent event = new DocumentRewriteSessionEvent(this, session, DocumentRewriteSessionEvent.SESSION_STOP);
fireDocumentRewriteSessionEvent(event);
}
}
Aggregations