Commit 6e319bff authored by Romain Bioteau's avatar Romain Bioteau

Disable Groovy DSL

parent 4862870c
......@@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.ui,
org.mockito;bundle-version="1.9.5";resolution:=optional,
assertj-core;bundle-version="1.5.0";resolution:=optional,
org.eclipse.debug.ui,
org.eclipse.jdt.ui
org.eclipse.jdt.ui,
org.codehaus.groovy.eclipse.dsl;bundle-version="2.9.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
......
......@@ -21,6 +21,7 @@ import static org.mockito.Mockito.verify;
import java.util.Locale;
import org.codehaus.groovy.eclipse.dsl.DSLPreferencesInitializer;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.junit.Test;
......@@ -32,12 +33,12 @@ import org.mockito.runners.MockitoJUnitRunner;
public class PreferenceInitializerTest {
@Mock
public IPreferenceStore apiPrefStore, webPrefStore, bonitaPrefStore, jdtPrefStore;
public IPreferenceStore apiPrefStore, webPrefStore, bonitaPrefStore, jdtPrefStore, dslPreferenceStore;
@Test
public void testLegacyModeDeactivatedByDefault() throws Exception {
final PreferenceInitializer preferenceInitializer = spy(new PreferenceInitializer());
setupeMocks(preferenceInitializer);
setupMocks(preferenceInitializer);
preferenceInitializer.initializeDefaultPreferences();
......@@ -47,18 +48,30 @@ public class PreferenceInitializerTest {
@Test
public void should_disable_mark_occurence() throws Exception {
final PreferenceInitializer preferenceInitializer = spy(new PreferenceInitializer());
setupeMocks(preferenceInitializer);
setupMocks(preferenceInitializer);
preferenceInitializer.initializeDefaultPreferences();
verify(jdtPrefStore).setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, Boolean.FALSE);
}
private void setupeMocks(final PreferenceInitializer preferenceInitializer) {
@Test
public void should_disable_groovy_dsl_support() throws Exception {
final PreferenceInitializer preferenceInitializer = spy(new PreferenceInitializer());
setupMocks(preferenceInitializer);
preferenceInitializer.initializeDefaultPreferences();
verify(dslPreferenceStore).setValue(DSLPreferencesInitializer.AUTO_ADD_DSL_SUPPORT, Boolean.FALSE);
verify(dslPreferenceStore).setValue(DSLPreferencesInitializer.DSLD_DISABLED, Boolean.TRUE);
}
private void setupMocks(final PreferenceInitializer preferenceInitializer) {
doReturn(apiPrefStore).when(preferenceInitializer).getAPIPreferenceStore();
doReturn(webPrefStore).when(preferenceInitializer).getWebBrowserPreferenceStore();
doReturn(bonitaPrefStore).when(preferenceInitializer).getBonitaPreferenceStore();
doReturn(jdtPrefStore).when(preferenceInitializer).getJDTPreferenceStore();
doReturn(dslPreferenceStore).when(preferenceInitializer).getGroovyDSLPreferenceStore();
doReturn(new Locale[] {}).when(preferenceInitializer).getStudioLocales();
doNothing().when(preferenceInitializer).setUTF8DefaultEncoding();
doNothing().when(preferenceInitializer).initDefaultDebugPreferences();
......
......@@ -16,6 +16,8 @@ package org.bonitasoft.studio.preferences;
import java.util.Locale;
import org.codehaus.groovy.eclipse.dsl.DSLPreferencesInitializer;
import org.codehaus.groovy.eclipse.dsl.GroovyDSLCoreActivator;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope;
......@@ -69,6 +71,16 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer impleme
final IPreferenceStore jdtUIStore = getJDTPreferenceStore();
jdtUIStore.setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, Boolean.FALSE);
final IPreferenceStore groovyDSLstore = getGroovyDSLPreferenceStore();
groovyDSLstore.setDefault(DSLPreferencesInitializer.AUTO_ADD_DSL_SUPPORT, false);
groovyDSLstore.setValue(DSLPreferencesInitializer.AUTO_ADD_DSL_SUPPORT, false);
groovyDSLstore.setDefault(DSLPreferencesInitializer.DSLD_DISABLED, true);
groovyDSLstore.setValue(DSLPreferencesInitializer.DSLD_DISABLED, true);
}
protected IPreferenceStore getGroovyDSLPreferenceStore() {
return GroovyDSLCoreActivator.getDefault().getPreferenceStore();
}
protected IPreferenceStore getJDTPreferenceStore() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment