// Path: antlr4ide.core/src/main/java/com/github/jknack/antlr4ide/console/ConsoleImpl.java
// public final class ConsoleImpl implements Console {
// 	
// 	public static final String QUALIFIER = "com.github.jknack.antlr4ide";
// 	public static final String KEY = "loglevel";
// 	
// 	/** default log level for console and loggers.*/
// 	public static final Level DEFAULT_LOGLEVEL = Level.INFO;
// 	
// 	/** default log level for console and loggers as a java.lang.String.*/
// 	public static final String DEFAULT_LOGLEVEL_AS_STRING = DEFAULT_LOGLEVEL.toString();
// 
// 	@Override
// 	public void error(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.error(msg);
// 	}
// 	
// 	@Override
// 	public void warning(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.warn(msg);
// 	}
// 	
// 	@Override
// 	public void info(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.info(msg);
// 	}
// 	
// 	@Override
// 	public void debug(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.debug(msg);
// 	}
// 
// 	@Override
// 	public void trace(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.trace(msg);
// 	}
// 	
// 	public static Logger getLogger() {
// 		final Logger logger = LogManager.getRootLogger();
// 		logger.setAdditivity(true);
// 		// set log-level of logger
// 		Level level = getLogLevel();
// 		logger.setLevel(level);
// 		return logger;
// 	}
// 	
// 	private String format(final String message, final Object...args) {
// 		final String result = String.format(message, args);
// 		return result;
// 	}
// 	
// 	public static Level getLogLevel() {
// 		final IPreferencesService service = Platform.getPreferencesService();
// 		final String string = service.getString(QUALIFIER, KEY, 
// 				DEFAULT_LOGLEVEL_AS_STRING, null);
// 		final Level result = Level.toLevel(string);
// 		return result;
// 	}
// 	
// }


import com.github.jknack.antlr4ide.console.ConsoleImpl;
import org.apache.log4j.Level;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
package com.github.jknack.antlr4ide.ui.preferences;



/**
 * GeneralPreferencePage
 *
 * @see <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-72.htm"
 * >Eclipse preferences</a>
 * 
 * @see <a href="http://xtextcasts.org/episodes/21-preference-page">Xtext
 *      preferences</a>
 * @see <a
 *      href="http://stackoverflow.com/questions/7964212/correctly-initializing-and-retrieving-preferences-in-a-xtext-based-eclipse-plugi">Xtext
 *      preferences on stack-overflow</a>
 */
public class GeneralPreferencePage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {
	
	public GeneralPreferencePage() {
		super(FieldEditorPreferencePage.GRID);
	}

	@Override
	public void createFieldEditors() {
		final Level[] logLevels = new Level[] { Level.OFF, Level.ERROR, 
				Level.WARN, Level.INFO, Level.DEBUG, Level.TRACE };
		final String[][] values = new String[logLevels.length][2];
		for (int i = 0; i < logLevels.length; i++) {
			// constructor of ComboFieldEditor expects a two-dimensional
			// array with label-value pairs.
			values[i][0] = logLevels[i].toString();
			values[i][1] = logLevels[i].toString();
		}
		final ComboFieldEditor editor = new ComboFieldEditor(
// Path: antlr4ide.core/src/main/java/com/github/jknack/antlr4ide/console/ConsoleImpl.java
// public final class ConsoleImpl implements Console {
// 	
// 	public static final String QUALIFIER = "com.github.jknack.antlr4ide";
// 	public static final String KEY = "loglevel";
// 	
// 	/** default log level for console and loggers.*/
// 	public static final Level DEFAULT_LOGLEVEL = Level.INFO;
// 	
// 	/** default log level for console and loggers as a java.lang.String.*/
// 	public static final String DEFAULT_LOGLEVEL_AS_STRING = DEFAULT_LOGLEVEL.toString();
// 
// 	@Override
// 	public void error(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.error(msg);
// 	}
// 	
// 	@Override
// 	public void warning(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.warn(msg);
// 	}
// 	
// 	@Override
// 	public void info(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.info(msg);
// 	}
// 	
// 	@Override
// 	public void debug(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.debug(msg);
// 	}
// 
// 	@Override
// 	public void trace(String message, Object...args) {
// 		final Logger logger = getLogger();
// 		final String msg = format(message, args);
// 		logger.trace(msg);
// 	}
// 	
// 	public static Logger getLogger() {
// 		final Logger logger = LogManager.getRootLogger();
// 		logger.setAdditivity(true);
// 		// set log-level of logger
// 		Level level = getLogLevel();
// 		logger.setLevel(level);
// 		return logger;
// 	}
// 	
// 	private String format(final String message, final Object...args) {
// 		final String result = String.format(message, args);
// 		return result;
// 	}
// 	
// 	public static Level getLogLevel() {
// 		final IPreferencesService service = Platform.getPreferencesService();
// 		final String string = service.getString(QUALIFIER, KEY, 
// 				DEFAULT_LOGLEVEL_AS_STRING, null);
// 		final Level result = Level.toLevel(string);
// 		return result;
// 	}
// 	
// }


// Path: antlr4ide.ui/src/main/java/com/github/jknack/antlr4ide/ui/preferences/GeneralPreferencePage.java
import com.github.jknack.antlr4ide.console.ConsoleImpl;
import org.apache.log4j.Level;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;

package com.github.jknack.antlr4ide.ui.preferences;



/**
 * GeneralPreferencePage
 *
 * @see <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-72.htm"
 * >Eclipse preferences</a>
 * 
 * @see <a href="http://xtextcasts.org/episodes/21-preference-page">Xtext
 *      preferences</a>
 * @see <a
 *      href="http://stackoverflow.com/questions/7964212/correctly-initializing-and-retrieving-preferences-in-a-xtext-based-eclipse-plugi">Xtext
 *      preferences on stack-overflow</a>
 */
public class GeneralPreferencePage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {
	
	public GeneralPreferencePage() {
		super(FieldEditorPreferencePage.GRID);
	}

	@Override
	public void createFieldEditors() {
		final Level[] logLevels = new Level[] { Level.OFF, Level.ERROR, 
				Level.WARN, Level.INFO, Level.DEBUG, Level.TRACE };
		final String[][] values = new String[logLevels.length][2];
		for (int i = 0; i < logLevels.length; i++) {
			// constructor of ComboFieldEditor expects a two-dimensional
			// array with label-value pairs.
			values[i][0] = logLevels[i].toString();
			values[i][1] = logLevels[i].toString();
		}
		final ComboFieldEditor editor = new ComboFieldEditor(
				ConsoleImpl.KEY, "Log level:", values, 