<commit_before>package fr.inria.diverse.melange.preferences

import org.eclipse.core.runtime.Platform
import org.eclipse.core.runtime.preferences.IPreferencesService

/**
 * So ugly, but Xtext doesn't appear to
 * provide something cleaner
 */
class MelangePreferencesAccess {
	static private final String PREFS_ID = "fr.inria.diverse.melange.ui"
	static MelangePreferencesAccess instance
	IPreferencesService preferencesService
	
	boolean isUserLaunch

	private new() {
		preferencesService = Platform.preferencesService
		isUserLaunch = false
	}

	synchronized static def MelangePreferencesAccess getInstance() {
		if (instance === null)
			instance = new MelangePreferencesAccess

		return instance
	}

	def boolean isGenerateAdaptersCode() {
		return preferencesService.getBoolean(PREFS_ID, MelangePreferencesConstants.GENERATE_ADAPTERS_CODE, true, null)
	}
	
	
	/**
	 * Return true if the user request a full compilation.
	 * Should return false if compilation process is automatically launched 
	 */
	def boolean isUserLaunch(){
		return isUserLaunch
	}

	def boolean enableCodeGenerator(){
		isUserLaunch = true
	}
	
	def void disableCodeGenerator(){
		isUserLaunch = false
	}
}<commit_msg>Fix MelangePreferencesAccess for standalone mode<commit_after>package fr.inria.diverse.melange.preferences

import org.eclipse.core.runtime.Platform
import org.eclipse.core.runtime.preferences.IPreferencesService

/**
 * So ugly, but Xtext doesn't appear to
 * provide something cleaner
 */
class MelangePreferencesAccess {
	static private final String PREFS_ID = "fr.inria.diverse.melange.ui"
	static MelangePreferencesAccess instance
	IPreferencesService preferencesService
	
	boolean isUserLaunch

	private new() {
		preferencesService = Platform.preferencesService
		isUserLaunch = false
	}

	synchronized static def MelangePreferencesAccess getInstance() {
		if (instance === null)
			instance = new MelangePreferencesAccess

		return instance
	}

	def boolean isGenerateAdaptersCode() {
		return
			if (preferencesService !== null)
				preferencesService.getBoolean(PREFS_ID, MelangePreferencesConstants.GENERATE_ADAPTERS_CODE, true, null)
			else true
	}
	
	
	/**
	 * Return true if the user request a full compilation.
	 * Should return false if compilation process is automatically launched 
	 */
	def boolean isUserLaunch(){
		return isUserLaunch
	}

	def boolean enableCodeGenerator(){
		isUserLaunch = true
	}
	
	def void disableCodeGenerator(){
		isUserLaunch = false
	}
}
{'fraction_non_alphanumeric': 0.06970185334407736, 'fraction_numerical': 0.0, 'mean_word_length': 4.842352941176471, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6653686', 'n_tokens_mistral': 739, 'n_tokens_neox': 669, 'n_words': 191}