added config option to enable/disable XML config file support

This commit is contained in:
Martin Lippert
2019-01-16 13:35:11 +01:00
parent 726bad6764
commit 4f7a2014c4
8 changed files with 37 additions and 13 deletions

View File

@@ -25,6 +25,11 @@
"default": true,
"description": "Enable/Disable Spring running Boot application live hints decorators in the source code"
},
"support-spring-xml-config.on": {
"type": "boolean",
"default": false,
"description": "Enable/Disable Support for Spring XML Config files"
},
"change-detection.on": {
"type": "boolean",
"default": false,

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -93,21 +93,18 @@ public class BootLanguageServerPreferencesPage extends FieldEditorPreferencePage
gd.grabExcessHorizontalSpace = false;
l.setLayoutData(gd);
BooleanFieldEditor liveHintsPrefEditor = new BooleanFieldEditor(Constants.PREF_BOOT_HINTS, "Live Boot Hint Decorators", parent);
addField(liveHintsPrefEditor);
final IPreferenceStore commonsLsPrefs = LanguageServerCommonsActivator.getInstance().getPreferenceStore();
addField(new BooleanFieldEditor(PreferenceConstants.HIGHLIGHT_CODELENS_PREFS, "Highlights CodeLens (Experimental)", parent) {
addField(new BooleanFieldEditor(Constants.PREF_BOOT_HINTS, "Live Boot Hint Decorators", parent));
addField(new BooleanFieldEditor(PreferenceConstants.HIGHLIGHT_CODELENS_PREFS, "Highlights CodeLens (experimental)", parent) {
@Override
public IPreferenceStore getPreferenceStore() {
return commonsLsPrefs;
}
});
BooleanFieldEditor liveChangeDetectionPrefEditor = new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", parent);
addField(liveChangeDetectionPrefEditor);
addField(new BooleanFieldEditor(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS, "Support Spring XML Config files (experimental)", parent));
addField(new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", parent));
l = new Label(parent, SWT.NONE);
gd = new GridData(GridData.FILL_HORIZONTAL);

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,7 @@ public class Constants {
public static final String LANGUAGE_SERVER_VERSION = "1.2.1-SNAPSHOT.jar";
public static final String PREF_BOOT_HINTS = "boot-java.boot-hints.on";
public static final String PREF_SUPPORT_SPRING_XML_CONFIGS = "boot-java.support-spring-xml-config.on";
public static final String PREF_CHANGE_DETECTION = "boot-java.change-detection.on";
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -159,14 +159,17 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
Map<String, Object> settings = new HashMap<>();
Map<String, Object> bootJavaObj = new HashMap<>();
Map<String, Object> bootHint = new HashMap<>();
Map<String, Object> supportXML = new HashMap<>();
Map<String, Object> bootChangeDetection = new HashMap<>();
bootHint.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_BOOT_HINTS));
supportXML.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS));
bootChangeDetection.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_CHANGE_DETECTION));
bootJavaObj.put("boot-hints", bootHint);
bootJavaObj.put("support-spring-xml-config", supportXML);
bootJavaObj.put("change-detection", bootChangeDetection);
ImmutableSet<Pair<String, String>> remoteApps = BootLanguageServerPlugin.getRemoteBootApps().getValues();
bootJavaObj.put("remote-apps", BootLanguageServerPlugin.getRemoteBootApps().getValues()
.stream()
.map(pair -> new RemoteBootAppData(pair.getLeft(), pair.getRight()))

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@ public class PrefsInitializer extends AbstractPreferenceInitializer {
@Override
public void initializeDefaultPreferences() {
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_BOOT_HINTS, true);
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_SUPPORT_SPRING_XML_CONFIGS, false);
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_CHANGE_DETECTION, false);
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2019 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,11 @@ public class BootJavaConfig {
return enabled == null || enabled.booleanValue();
}
public boolean isSpringXMLSupportEnabled() {
Boolean enabled = settings.getBoolean("boot-java", "support-spring-xml-config", "on");
return enabled != null && enabled.booleanValue();
}
public boolean isChangeDetectionEnabled() {
Boolean enabled = settings.getBoolean("boot-java", "change-detection", "on");
return enabled != null && enabled.booleanValue();

View File

@@ -4,6 +4,7 @@ import { createPreferenceProxy, PreferenceProxy, PreferenceService, PreferenceCo
// tslint:disable:max-line-length
export const HIGHLIGHTS_PREF_NAME = 'boot-java.boot-hints.on';
export const XML_SUPPORT_PREF_NAME = 'boot-java.support-spring-xml-config.on';
export const CODELENS_PREF_NAME = 'boot-java.highlight-codelens.on';
export const BootConfigSchema: PreferenceSchema = {
@@ -15,6 +16,11 @@ export const BootConfigSchema: PreferenceSchema = {
description: 'Enable/Disable Spring running Boot application live hints decorators in Java source code.',
default: true
},
'boot-java.support-spring-xml-config.on': {
type: 'boolean',
description: 'Enable/Disable Support for Spring XML Config files',
default: false
},
'boot-java.change-detection.on': {
type: 'boolean',
description: 'Enable/Disable detecting changes of running Spring Boot applications.',
@@ -30,6 +36,7 @@ export const BootConfigSchema: PreferenceSchema = {
export interface BootConfiguration {
'boot-java.boot-hints.on': boolean;
'boot-java.support-spring-xml-config.on': boolean;
'boot-java.change-detection.on': boolean;
'boot-java.highlight-codelens.on': boolean;
}

View File

@@ -68,6 +68,11 @@
"default": true,
"description": "Enable/Disable Spring running Boot application live hints decorators in Java source code"
},
"boot-java.support-spring-xml-config.on": {
"type": "boolean",
"default": false,
"description": "Enable/Disable Support for Spring XML Config files"
},
"boot-java.highlight-codelens.on": {
"type": "boolean",
"default": true,