protected IConsoleDocumentPartitioner getPartitioner() {
return new MM(this);
}
};
final TextConsoleViewer sv = new TextConsoleViewer(owner, console);
ConsolePlugin.getDefault().getConsoleManager()
.createPatternMatchListeners(console);
IDocument document = console.getDocument();
document.setDocumentPartitioner(new MM(console));
logViewer.setFilter(new IFilter(){
public boolean accept(Object o) {
return true;
}
public Point match(String text) {
if (filterText!=null&&filterText.length()>0){
int indexOf = text.indexOf(filterText);
if (indexOf!=-1){
return new Point(indexOf,filterText.length());
}
}
return new Point(0,0);
}
});
sv.getTextWidget().setEditable(false);
// sv.setDocument(document);
// sv.getTextWidget().setFont(JFaceResources.getTextFont());
logViewer.getSelectionProvider().addSelectionChangedListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (!event.getSelection().isEmpty()) {
IStructuredSelection sm = (IStructuredSelection) event
.getSelection();
Object firstElement = sm.getFirstElement();
ILogItem item = (ILogItem) firstElement;
sv.getDocument().set(item.getMessage());
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
sv.getTextWidget().redraw();
}
});
}
}
});