public void documentAboutToBeChanged(DocumentEvent event) {
//only report when we have a new line
if (event.fText.indexOf('\r') != -1 || event.fText.indexOf('\n') != -1) {
try {
ITypedRegion partition = event.fDocument.getPartition(event.fOffset);
if (partition instanceof IOConsolePartition) {
IOConsolePartition p = (IOConsolePartition) partition;
//we only communicate about inputs (because we only care about what the user writes)
if (p.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {
if (event.fText.length() <= 2) {
//the user typed something
final String inputFound = p.getString();
for (IConsoleInputListener listener : participants) {
listener.newLineReceived(inputFound, target);
}
}
}
}
} catch (Exception e) {
Log.log(e);
}
}
}
public void documentChanged(DocumentEvent event) {
//only report when we have a new line
if (event.fText.indexOf('\r') != -1 || event.fText.indexOf('\n') != -1) {
try {
ITypedRegion partition = event.fDocument.getPartition(event.fOffset);
if (partition instanceof IOConsolePartition) {
IOConsolePartition p = (IOConsolePartition) partition;
//we only communicate about inputs (because we only care about what the user writes)
if (p.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {