Eclipse Spring preferences re-organization

This commit is contained in:
aboyko
2023-02-13 12:27:22 -05:00
parent 11e6a31ef3
commit fbbb6fbcfd
23 changed files with 203 additions and 460 deletions

View File

@@ -175,7 +175,7 @@
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.springsource.ide.eclipse.commons.preferencePage"
category="org.springframework.tooling.boot.ls.liveInfo"
class="org.springframework.tooling.boot.ls.prefs.RemoteAppsPrefsPage"
id="org.springframework.tooling.boot.ls.prefs.RemoteAppsPrefsPage"
name="Remote Boot Apps">
@@ -184,10 +184,10 @@
category="org.springsource.ide.eclipse.commons.preferencePage"
class="org.springframework.tooling.boot.ls.XmlConfigPreferencePage"
id="org.springframework.tooling.boot.xml.ls.preferences"
name="Spring XML Config">
name="XML Config Files">
</page>
<page
class="org.springframework.tooling.boot.ls.BootJavaPreferencesPage"
class="org.springframework.tooling.boot.ls.prefs.BootJavaPreferencesPage"
id="org.springsource.ide.eclipse.commons.preferencePage"
name="Spring">
</page>
@@ -209,6 +209,18 @@
id="org.springframework.tooling.boot.ls.rewrite.load"
name="Plug Recipes">
</page>
<page
category="org.springsource.ide.eclipse.commons.preferencePage"
class="org.springframework.tooling.boot.ls.prefs.ValidationPreferencePage"
id="org.springframework.tooling.boot.validation"
name="Validation">
</page>
<page
category="org.springsource.ide.eclipse.commons.preferencePage"
class="org.springframework.tooling.boot.ls.prefs.LiveInformationPreferencePage"
id="org.springframework.tooling.boot.ls.liveInfo"
name="Live Information">
</page>
</extension>
@@ -216,7 +228,7 @@
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.springframework.tooling.boot.ls.PrefsInitializer">
class="org.springframework.tooling.boot.ls.prefs.PrefsInitializer">
</initializer>
</extension>

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2022 Pivotal, Inc.
* Copyright (c) 2017, 2023 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
@@ -22,6 +22,7 @@ import org.eclipse.ui.keys.IBindingService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.springframework.tooling.boot.ls.prefs.CategoryProblemsSeverityPrefsPage;
import org.springframework.tooling.boot.ls.prefs.LiveInformationPreferencePage;
/**
* Boot-Java LS extension plugin
@@ -53,7 +54,7 @@ public class BootLanguageServerPlugin extends AbstractUIPlugin {
plugin = this;
super.start(context);
deactivateDuplicateKeybindings();
BootJavaPreferencesPage.manageCodeMiningPreferences();
LiveInformationPreferencePage.manageCodeMiningPreferences();
CategoryProblemsSeverityPrefsPage.loadProblemCategoriesIntoPreferences();
}

View File

@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2017, 2023 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls.prefs;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
import org.springframework.tooling.boot.ls.Constants;
/**
* Preference page for Boot-Java LS extension
*
* @author Alex Boyko
*
*/
public class BootJavaPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(BootLanguageServerPlugin.getDefault().getPreferenceStore());
}
@Override
protected void createFieldEditors() {
Composite fieldEditorParent = getFieldEditorParent();
addField(new BooleanFieldEditor(Constants.PREF_START_LS_EARLY, "Start Language Server at startup if Spring Boot is a dependency", fieldEditorParent));
addField(new BooleanFieldEditor(Constants.PREF_SCAN_JAVA_TEST_SOURCES, "Scan Java test sources", fieldEditorParent));
addField(new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", fieldEditorParent));
}
}

View File

@@ -108,7 +108,7 @@ public class CategoryProblemsSeverityPrefsPage extends ProblemSeverityPreferityP
//use workbenches's preference manager
PreferenceManager pm= PlatformUI.getWorkbench().getPreferenceManager();
pm.addTo("org.springsource.ide.eclipse.commons.preferencePage", node); //add the node in the PreferenceManager
pm.addTo("org.springsource.ide.eclipse.commons.preferencePage/org.springframework.tooling.boot.validation", node); //add the node in the PreferenceManager
}
ALL_PROBLEM_CATEGORIES = ImmutableList.copyOf(categories);

View File

@@ -1,14 +1,14 @@
/*******************************************************************************
* Copyright (c) 2017, 2022 Pivotal, Inc.
* Copyright (c) 2023 VMware, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
* VMware, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls;
package org.springframework.tooling.boot.ls.prefs;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -21,17 +21,13 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
import org.springframework.tooling.boot.ls.Constants;
import org.springframework.tooling.ls.eclipse.commons.LanguageServerCommonsActivator;
import org.springframework.tooling.ls.eclipse.commons.preferences.PreferenceConstants;
/**
* Preference page for Boot-Java LS extension
*
* @author Alex Boyko
*
*/
public class BootJavaPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public class LiveInformationPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
/**
* Starts a preference change listener that keeps code mining preferences in sync with
* whether or not STS4 codelenses are enabled.
@@ -70,6 +66,10 @@ public class BootJavaPreferencesPage extends FieldEditorPreferencePage implement
}
}
public LiveInformationPreferencePage() {
}
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(BootLanguageServerPlugin.getDefault().getPreferenceStore());
@@ -80,10 +80,7 @@ public class BootJavaPreferencesPage extends FieldEditorPreferencePage implement
final IPreferenceStore commonsLsPrefs = LanguageServerCommonsActivator.getInstance().getPreferenceStore();
Composite fieldEditorParent = getFieldEditorParent();
addField(new BooleanFieldEditor(Constants.PREF_START_LS_EARLY, "Start Language Server at startup if Spring Boot is a dependency", fieldEditorParent));
addField(new BooleanFieldEditor(Constants.PREF_SCAN_JAVA_TEST_SOURCES, "Scan Java test sources", fieldEditorParent));
addField(new StringFieldEditor(Constants.PREF_LIVE_INFORMATION_FETCH_DATA_RETRY_MAX_NO, "Live Information - Max number of retries (before giving up)", fieldEditorParent));
addField(new StringFieldEditor(Constants.PREF_LIVE_INFORMATION_FETCH_DATA_RETRY_DELAY_IN_SECONDS, "Live Information - Delay between retries in seconds", fieldEditorParent));
@@ -93,9 +90,6 @@ public class BootJavaPreferencesPage extends FieldEditorPreferencePage implement
return commonsLsPrefs;
}
});
addField(new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", fieldEditorParent));
addField(new BooleanFieldEditor(Constants.PREF_VALIDATION_SPEL_EXPRESSIONS, "SpEL Expression Syntax Validation", fieldEditorParent));
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2022 Pivotal, Inc.
* Copyright (c) 2017, 2023 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
@@ -8,11 +8,12 @@
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls;
package org.springframework.tooling.boot.ls.prefs;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.springframework.tooling.boot.ls.prefs.StringListEditor;
import org.springframework.tooling.boot.ls.BootLanguageServerPlugin;
import org.springframework.tooling.boot.ls.Constants;
/**
* Preferences initializer for Boot-Java LS extension

View File

@@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2023 VMware, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* VMware, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.tooling.boot.ls.prefs;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
public class ValidationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
public ValidationPreferencePage() {
}
public ValidationPreferencePage(String title) {
super(title);
}
public ValidationPreferencePage(String title, ImageDescriptor image) {
super(title, image);
}
@Override
public void init(IWorkbench workbench) {
}
@Override
protected Control createContents(Composite parent) {
return null;
}
@Override
public void createControl(Composite parent) {
Composite content = new Composite(parent, SWT.NONE);
setControl(content);
}
}