Commit 022d71e1 authored by Romain Bioteau's avatar Romain Bioteau

Disale groovy dsl

parent bda2b8e0
......@@ -66,7 +66,8 @@ Require-Bundle: org.bonitasoft.studio.diagram,
org.bonitasoft.studio.tests-utils;bundle-version="6.4.1";resolution:=optional,
org.codehaus.groovy.eclipse.ui,
org.eclipse.debug.ui,
org.eclipse.core.databinding.beans
org.eclipse.core.databinding.beans,
org.codehaus.groovy.eclipse.dsl;bundle-version="2.9.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="1.0.0",
......
......@@ -17,7 +17,11 @@ package org.bonitasoft.studio.application;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.debug.DebugPlugin;
import org.bonitasoft.studio.validation.ValidationPlugin;
import org.codehaus.groovy.eclipse.dsl.DSLPreferences;
import org.codehaus.groovy.eclipse.dsl.DSLPreferencesInitializer;
import org.codehaus.groovy.eclipse.dsl.GroovyDSLCoreActivator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
......@@ -60,6 +64,13 @@ public class ApplicationPlugin extends AbstractUIPlugin {
try {
DebugPlugin.getDefault().getBundle().start();
ValidationPlugin.getDefault().getBundle().start();
final IPreferenceStore groovyDSLstore = GroovyDSLCoreActivator.getDefault().getPreferenceStore();
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);
groovyDSLstore.setDefault(DSLPreferences.DISABLED_SCRIPTS, false);
groovyDSLstore.setValue(DSLPreferences.DISABLED_SCRIPTS, false);
} catch (final BundleException e) {
BonitaStudioLog.error(e);
}
......
......@@ -21,7 +21,6 @@ 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;
......@@ -55,23 +54,12 @@ public class PreferenceInitializerTest {
verify(jdtPrefStore).setValue(PreferenceConstants.EDITOR_MARK_OCCURRENCES, Boolean.FALSE);
}
@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,8 +16,6 @@ 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;
......@@ -71,16 +69,6 @@ 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