org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SARLPreferenceStoreInitializer.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;

	// Initialize the default visibilities for the optional issue codes.
	setupIssueCodesDefaults(preferenceStoreAccess);

	final IPreferenceStore preferenceStore = org.eclipse.jdt.ui.PreferenceConstants.getPreferenceStore();
	preferenceStore.addPropertyChangeListener(this);

	// Copy the Subword navigation from the JDT plugin.
	preferenceStoreAccess.getWritablePreferenceStore().setDefault(
			PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
			preferenceStore.getBoolean(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));

	// Initialize the editor preferences
	setupSourceViewerDefaults(preferenceStoreAccess);
	setupCodeminingDefaults(preferenceStoreAccess);

	// Initialize the generators for the extra languages.
	setupExtraLanguageGeneratorDefaults(preferenceStoreAccess);
}
 
Example #2
Source File: AbstractPreferenceAccess.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the preference accessor.
 *
 * @return the accessor.
 */
protected IPreferenceStoreAccess getPreferenceStoreAccess() {
	if (this.preferenceStoreAccess == null) {
		final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
		this.preferenceStoreAccess = injector.getInstance(IPreferenceStoreAccess.class);
	}
	return this.preferenceStoreAccess;
}
 
Example #3
Source File: XtendPreferenceStoreInitializer.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;

	IPreferenceStore preferenceStore = org.eclipse.jdt.ui.PreferenceConstants.getPreferenceStore();
	preferenceStore.addPropertyChangeListener(this);
	preferenceStoreAccess.getWritablePreferenceStore().setDefault(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION,
			preferenceStore.getBoolean(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
	
}
 
Example #4
Source File: BuilderPreferenceAccess.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	IPreferenceStore store = preferenceStoreAccess.getWritablePreferenceStore();
	initializeBuilderPreferences(store);
	for (OutputConfiguration configuration : outputConfigurationProvider.getOutputConfigurations()) {
		initializeOutputPreferences(store, configuration);
	}
}
 
Example #5
Source File: GamlMarkOccurrenceActionContributor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initialize(final IPreferenceStoreAccess preferenceStoreAccess) {
	GamaPreferences.Modeling.EDITOR_MARK_OCCURRENCES.onChange(newValue -> stateChanged(newValue));
	access = preferenceStoreAccess;
	preferenceStoreAccess.getWritablePreferenceStore().setDefault(getPreferenceKey(),
			GamaPreferences.Modeling.EDITOR_MARK_OCCURRENCES.getValue());
	preferenceStoreAccess.getWritablePreferenceStore().setValue(getPreferenceKey(),
			GamaPreferences.Modeling.EDITOR_MARK_OCCURRENCES.getValue());
}
 
Example #6
Source File: SARLBuilderPreferenceAccess.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	final IPreferenceStore store = preferenceStoreAccess.getWritablePreferenceStore();
	store.setDefault(PREF_GENERATED_TEST_SOURCE_FOLDER, SARLConfig.FOLDER_TEST_SOURCE_GENERATED);
	store.setDefault(PREF_GENERATE_INLINE, GeneratorConfig2.DEFAULT_GENERATE_INLINE_ANNOTATION);
	store.setDefault(PREF_USE_EXPRESSION_INTERPRETER, GeneratorConfig2.DEFAULT_USE_EXPRESSION_INTERPRETER_FOR_INLINE_ANNOTATION);
	store.setDefault(PREF_GENERATE_PURE, GeneratorConfig2.DEFAULT_GENERATE_PURE_ANNOTATION);
	store.setDefault(PREF_GENERATE_EQUALITY_TEST_FUNCTIONS, GeneratorConfig2.DEFAULT_GENERATE_EQUALITY_TEST_FUNCTIONS);
	store.setDefault(PREF_GENERATE_TOSTRING_FUNCTIONS, GeneratorConfig2.DEFAULT_GENERATE_TOSTRING_FUNCTION);
	store.setDefault(PREF_GENERATE_CLONE_FUNCTIONS, GeneratorConfig2.DEFAULT_GENERATE_CLONE_FUNCTION);
	store.setDefault(PREF_GENERATE_SERIAL_NUMBER_FIELDS, GeneratorConfig2.DEFAULT_GENERATE_SERIAL_NUMBER_FIELD);
}
 
Example #7
Source File: SARLPreferences.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the preference store for the given project.
 *
 * @param project the project.
 * @return the preference store or {@code null}.
 */
public static IPreferenceStore getSARLPreferencesFor(IProject project) {
	if (project != null) {
		final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
		final IPreferenceStoreAccess preferenceStoreAccess = injector.getInstance(IPreferenceStoreAccess.class);
		return preferenceStoreAccess.getWritablePreferenceStore(project);
	}
	return null;
}
 
Example #8
Source File: TextAttributeProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Inject
public TextAttributeProvider(IHighlightingConfiguration highlightingConfig,
		IPreferenceStoreAccess preferenceStoreAccess, PreferenceStoreAccessor prefStoreAccessor) {
	this.highlightingConfig = highlightingConfig;
	this.preferencesAccessor = prefStoreAccessor;
	this.attributes = new HashMap<String, TextAttribute>();
	preferenceStoreAccess.getPreferenceStore().addPropertyChangeListener(this);
	initialize();
}
 
Example #9
Source File: PyPreferenceInitializer.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	final IPreferenceStore store = access.getWritablePreferenceStore();
	initializeGeneralOptions(store);
	initializeTypeConversion(store);
	initializeFeatureNameConversion(store);
}
 
Example #10
Source File: ExtensionPointExtraLanguagePreferenceInitializer.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	if (this.initializers == null) {
		this.initializers = new ArrayList<>();
		final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
				SARLUiConfig.NAMESPACE, SARLUiConfig.EXTENSION_POINT_EXTRA_LANGUAGE_GENERATORS);
		if (extensionPoint != null) {
			Object obj;
			for (final IConfigurationElement element : extensionPoint.getConfigurationElements()) {
				try {
					obj = element.createExecutableExtension(EXTENSION_POINT_PREFERENCE_INITIALIZER_ATTRIBUTE);
					if (obj instanceof IPreferenceStoreInitializer) {
						this.initializers.add((IPreferenceStoreInitializer) obj);
					}
				} catch (CoreException exception) {
					LangActivator.getInstance().getLog().log(new Status(
							IStatus.WARNING,
							LangActivator.getInstance().getBundle().getSymbolicName(),
							exception.getLocalizedMessage(),
							exception));
				}
			}
		}
	}
	for (final IPreferenceStoreInitializer initializer : this.initializers) {
		initializer.initialize(access);
	}
}
 
Example #11
Source File: ConfigurableIssueCodesPreferenceStoreInitializer.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	IPreferenceStore preferenceStore = preferenceStoreAccess.getWritablePreferenceStore();
	for (PreferenceKey prefKey : issueCodesProvider.getConfigurableIssueCodes().values()) {
		preferenceStore.setDefault(prefKey.getId(), prefKey.getDefaultValue());
	}
}
 
Example #12
Source File: PreferenceStoreAccessTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	preferenceStoreAccess = Guice.createInjector(new AbstractGenericModule() {
		@SuppressWarnings("unused")
		public void configureModule(Binder binder) {
			binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance(LANGUAGE_ID);
			binder.bind(IPreferenceStoreInitializer.class).toInstance(PreferenceStoreAccessTest.this);
		}
	}).getInstance(IPreferenceStoreAccess.class);
}
 
Example #13
Source File: ExtraLanguagePreferenceAccess.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Replies the preference accessor.
 *
 * @return the accessor.
 */
@Inject
public IPreferenceStoreAccess getPreferenceStoreAccess() {
	return this.preferenceStoreAccess;
}
 
Example #14
Source File: XtendRefactoringPreferences.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	access.getWritablePreferenceStore().setDefault(SAVE_ALL_BEFORE_REFACTORING, true);
	access.getWritablePreferenceStore().setDefault(USE_INLINE_REFACTORING, true);
}
 
Example #15
Source File: StyledTextXtextAdapter.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
protected IPreferenceStoreAccess getPreferenceStoreAccess() {
	return this.preferenceStoreAccess;
}
 
Example #16
Source File: XtextStyledTextHighlightingHelper.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void setPreferenceStoreAccessor(
		IPreferenceStoreAccess preferenceStoreAccessor) {
	this.preferenceStoreAccessor = preferenceStoreAccessor;
}
 
Example #17
Source File: XtextStyledTextHighlightingHelper.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public IPreferenceStoreAccess getPreferenceStoreAccessor() {
	return preferenceStoreAccessor;
}
 
Example #18
Source File: SARLCodeminingPreferenceAccess.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	access.getWritablePreferenceStore().setDefault(CODEMINING_PROPERTY, CODEMINING_DEFAULT_VALUE);
}
 
Example #19
Source File: SARLPreferenceStoreInitializer.java    From sarl with Apache License 2.0 4 votes vote down vote up
private void setupSourceViewerDefaults(IPreferenceStoreAccess preferenceStoreAccess) {
	this.sourceViewerInitializer.initialize(preferenceStoreAccess);
}
 
Example #20
Source File: SARLSourceViewerPreferenceAccess.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	access.getWritablePreferenceStore().setDefault(AUTOFORMATTING_PROPERTY, AUTOFORMATTING_DEFAULT_VALUE);
}
 
Example #21
Source File: AbstractPreferenceAccess.java    From sarl with Apache License 2.0 4 votes vote down vote up
/** Change the preference accessor.
 *
 * @param preferenceStoreAccess the accessor.
 */
@Inject
public void setPreferenceStoreAccess(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;
}
 
Example #22
Source File: BuilderPreferenceAccess.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setPreferenceStoreAccess(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;
}
 
Example #23
Source File: SARLPreferenceStoreInitializer.java    From sarl with Apache License 2.0 4 votes vote down vote up
private void setupCodeminingDefaults(IPreferenceStoreAccess preferenceStoreAccess) {
	this.codeminingInitializer.initialize(preferenceStoreAccess);
}
 
Example #24
Source File: SARLPreferenceStoreInitializer.java    From sarl with Apache License 2.0 4 votes vote down vote up
private void setupIssueCodesDefaults(IPreferenceStoreAccess preferenceStoreAccess) {
	final IPreferenceStore store = preferenceStoreAccess.getWritablePreferenceStore();
	for (final PreferenceKey prefKey : this.issueCodes.getConfigurableIssueCodes().values()) {
		store.setDefault(prefKey.getId(), prefKey.getDefaultValue());
	}
}
 
Example #25
Source File: SARLPreferenceStoreInitializer.java    From sarl with Apache License 2.0 4 votes vote down vote up
private void setupExtraLanguageGeneratorDefaults(IPreferenceStoreAccess preferenceStoreAccess) {
	this.extraLanguagePreferenceInitializer.initialize(preferenceStoreAccess);
}
 
Example #26
Source File: AbstractToggleActionContributor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void initialize(IPreferenceStoreAccess preferenceStoreAccess) {
	preferenceStoreAccess.getWritablePreferenceStore().setDefault(getPreferenceKey(), getPreferenceDefaultValue());
}
 
Example #27
Source File: N4JSBuilderPreferenceAccess.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
@Inject
public void setPreferenceStoreAccess(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;
}
 
Example #28
Source File: PreferenceStoreAccessTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void initialize(IPreferenceStoreAccess access) {
	access.getWritablePreferenceStore().setDefault("someBoolean", true);
}
 
Example #29
Source File: SingleCodetemplateUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Provider<IPreferenceStoreAccess> provideIPreferenceStoreAccess() {
	Injector injector = CodetemplatesActivator.getInstance().getInjector("org.eclipse.xtext.ui.codetemplates.Codetemplates");
	return injector.getProvider(IPreferenceStoreAccess.class);
}
 
Example #30
Source File: TaskTagPreferencePage.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setPreferenceStoreAccess(IPreferenceStoreAccess preferenceStoreAccess) {
	this.preferenceStoreAccess = preferenceStoreAccess;
}