blob: 26c6c35ef21e406b38d50a63ae0f70d569452e6a [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2005, 2017 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.r.console.ui;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.statet.ecommons.preferences.core.PreferenceAccess;
import org.eclipse.statet.internal.r.console.ui.page.RConsolePage;
import org.eclipse.statet.nico.core.NicoCore;
import org.eclipse.statet.nico.ui.console.NIConsole;
import org.eclipse.statet.nico.ui.console.NIConsoleColorAdapter;
import org.eclipse.statet.r.console.core.RProcess;
import org.eclipse.statet.r.core.IRCoreAccess;
import org.eclipse.statet.r.core.RCodeStyleSettings;
import org.eclipse.statet.r.core.RCore;
import org.eclipse.statet.r.core.renv.IREnv;
import org.eclipse.statet.r.launching.ui.RErrorLineTracker;
public class RConsole extends NIConsole implements IRCoreAccess {
private final PreferenceAccess prefs;
public RConsole(final RProcess process, final NIConsoleColorAdapter adapter) {
super(process, adapter);
final RErrorLineTracker lineMatcher= new RErrorLineTracker(process);
addPatternMatchListener(lineMatcher);
this.prefs= NicoCore.getInstanceConsolePreferences();
}
@Override
public IPageBookViewPage createPage(final IConsoleView view) {
return new RConsolePage(this, view);
}
@Override
protected String getSymbolicFontName() {
return "org.eclipse.statet.workbench.themes.ConsoleFont"; //$NON-NLS-1$
}
@Override
public PreferenceAccess getPrefs() {
return this.prefs;
}
@Override
public IREnv getREnv() {
return getProcess().getAdapter(IREnv.class);
}
@Override
public RCodeStyleSettings getRCodeStyle() {
return RCore.WORKBENCH_ACCESS.getRCodeStyle();
}
}