composite.setLayout(new GridLayout(1, false));
final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
consoleOutputViewer = new SourceViewer(sashForm, null, SWT.V_SCROLL
| SWT.H_SCROLL | SWT.MULTI | SWT.READ_ONLY);
consoleOutputText = consoleOutputViewer.getTextWidget();
consoleOutputText.setFont(JFaceResources.getTextFont());
bgcolor = DebugUIPlugin
.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR);
consoleOutputText.setBackground(bgcolor);
DebugUIPlugin.getDefault().getPreferenceStore()
.addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) {
if (event.getProperty().equals(
IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) {
final Color color = DebugUIPlugin
.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR);
consoleOutputText.setBackground(color);
consoleInputText.setBackground(color);
}
}
});
consoleOutputText.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
if (e.stateMask == 0 && e.character != '\0') {
consoleInputText.setFocus();
consoleInputText.append("" + e.character);
consoleInputText.setCaretOffset(consoleInputText.getText().length());
}
e.doit = true;
}
});
final IPreferenceStore store = ErlideUIPlugin.getDefault().getPreferenceStore();
final IColorManager colorManager = new ColorManager();
consoleOutputViewer.setDocument(fDoc);
consoleOutputViewer.configure(new ErlangConsoleSourceViewerConfiguration(store,
colorManager, backend));
consoleInputViewer = new SourceViewer(sashForm, null, SWT.MULTI | SWT.WRAP
| SWT.V_SCROLL);
consoleInputText = consoleInputViewer.getTextWidget();
consoleInputViewer.setDocument(new Document());
consoleInputViewer.configure(new ErlangConsoleSourceViewerConfiguration(store,
colorManager, backend));