use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.
the class BasicStructuredDocument method setText.
/**
* One of the APIs to manipulate the IStructuredDocument in terms of text.
*/
public StructuredDocumentEvent setText(Object requester, String theString) {
StructuredDocumentEvent result = null;
result = replaceText(requester, 0, getLength(), theString, getNextModificationStamp(), true);
return result;
}
use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.
the class JobSafeStructuredDocument method replaceText.
/* (non-Javadoc)
* @see org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument#replaceText(java.lang.Object, int, int, java.lang.String, boolean)
*/
public StructuredDocumentEvent replaceText(final Object requester, final int start, final int replacementLength, final String changes, final boolean ignoreReadOnlySettings) {
StructuredDocumentEvent event = null;
IExecutionDelegate delegate = getExecutionDelegate();
if (delegate == null) {
event = super.replaceText(requester, start, replacementLength, changes, ignoreReadOnlySettings);
} else {
final Object[] resultSlot = new Object[1];
JobSafeRunnable runnable = new JobSafeRunnable() {
public void run() throws Exception {
resultSlot[0] = JobSafeStructuredDocument.super.replaceText(requester, start, replacementLength, changes, ignoreReadOnlySettings);
}
public void handleException(Throwable exception) {
resultSlot[0] = new NoChangeEvent(JobSafeStructuredDocument.this, requester, changes, start, replacementLength);
super.handleException(exception);
}
};
delegate.execute(runnable);
event = (StructuredDocumentEvent) resultSlot[0];
}
return event;
}
use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.
the class JobSafeStructuredDocument method setText.
public StructuredDocumentEvent setText(final Object requester, final String theString) {
StructuredDocumentEvent event = null;
IExecutionDelegate executionDelegate = getExecutionDelegate();
if (executionDelegate == null) {
event = super.setText(requester, theString);
} else {
final Object[] resultSlot = new Object[1];
JobSafeRunnable runnable = new JobSafeRunnable() {
public void run() throws Exception {
resultSlot[0] = JobSafeStructuredDocument.super.setText(requester, theString);
}
public void handleException(Throwable exception) {
resultSlot[0] = new NoChangeEvent(JobSafeStructuredDocument.this, requester, theString, 0, 0);
super.handleException(exception);
}
};
executionDelegate.execute(runnable);
event = (StructuredDocumentEvent) resultSlot[0];
}
return event;
}
use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.
the class StructuredDocumentReParser method checkForCDATA.
/**
* A change to a CDATA tag can result in all being reparsed.
*/
private StructuredDocumentEvent checkForCDATA() {
StructuredDocumentEvent result = null;
// $NON-NLS-1$
result = checkForCriticalKey("<![CDATA[");
if (result == null)
// $NON-NLS-1$
result = checkForCriticalKey("]]>");
return result;
}
use of org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent in project webtools.sourceediting by eclipse.
the class StructuredDocumentReParser method checkForNoChange.
/**
* Checks to see if change request exactly matches the text it would be
* replacing. (In future, this, or similar method is where to check for
* "read only" attempted change.)
*/
private StructuredDocumentEvent checkForNoChange() {
StructuredDocumentEvent result = null;
// doesn't do this.)
if ((fChanges != null) && (fDeletedText != null) && (fChanges.length() == fDeletedText.length()) && (fChanges.equals(fDeletedText))) {
result = new NoChangeEvent(fStructuredDocument, fRequester, fChanges, fStart, fLengthToReplace);
((NoChangeEvent) result).reason = NoChangeEvent.NO_CONTENT_CHANGE;
}
return result;
}
Aggregations