1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 558549 - Move CDT Language Server preference page to UI bundle

Moved preference page and related things to "org.eclipse.cdt.lsp.ui"

Change-Id: Idf1251789edbd5f6c82b6fb7f3483c75550d6e29
Signed-off-by: Alexander Fedorov <alexander.fedorov@arsysop.ru>
This commit is contained in:
Alexander Fedorov 2019-12-21 22:16:24 +03:00
parent d92d4ac771
commit 5eb0e1923a
16 changed files with 105 additions and 25 deletions

View file

@ -3,5 +3,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -22,9 +22,8 @@ Require-Bundle: com.google.gson;bundle-version="2.8.2",
org.eclipse.cdt.ui
Import-Package: org.eclipse.ui.editors.text,
org.eclipse.ui.texteditor
Export-Package: org.eclipse.cdt.lsp.core;x-internal:=true,
org.eclipse.cdt.lsp.core.cquery;x-internal:=true,
org.eclipse.cdt.lsp.internal.core;x-internal:=true,
org.eclipse.cdt.lsp.internal.ui;x-internal:=true
Export-Package: org.eclipse.cdt.lsp.core;x-friends:="org.eclipse.cdt.lsp.ui",
org.eclipse.cdt.lsp.core.cquery;x-friends:="org.eclipse.cdt.lsp.ui",
org.eclipse.cdt.lsp.internal.core;x-internal:=true
Bundle-Activator: org.eclipse.cdt.lsp.core.Activator
Bundle-ActivationPolicy: lazy

View file

@ -23,5 +23,3 @@ reindex.command.name = Reindex
reindex.command.label = Reindex
cDocumentSetupParticipant =C Document Setup Participant
PreferencePageTitle=C/C++ Language Server

View file

@ -13,7 +13,7 @@
###############################################################################
source.. = src/
output.. = target/classes/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\

View file

@ -60,15 +60,6 @@
contentType="org.eclipse.cdt.lsp.core">
</presentationReconciler>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
class="org.eclipse.cdt.lsp.core.CPPLanguageServerPreferencePage"
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
id="org.eclipse.cdt.lsp.core.CPPLanguageServerPreferencePage"
name="%PreferencePageTitle">
</page>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer

View file

@ -129,7 +129,8 @@ public class CPPStreamConnectionProvider extends ProcessStreamConnectionProvider
return null;
}
static File getDefaultLSLocation(String selectedLanguageServer) {
//FIXME: to be extracted to a separate type
public static File getDefaultLSLocation(String selectedLanguageServer) {
String res = null;
String[] command = new String[] { "/bin/bash", "-c", "which " + selectedLanguageServer }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (Platform.getOS().equals(Platform.OS_WIN32)) {

View file

@ -3,5 +3,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes/"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,9 +1,17 @@
Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.cdt.lsp.ui
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.cdt.lsp.ui
Bundle-SymbolicName: org.eclipse.cdt.lsp.ui;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.cdt.lsp.core;bundle-version="[1.1.0,2.0.0)"
Require-Bundle: org.eclipse.osgi;bundle-version="[3.15.0,4.0.0)",
org.eclipse.equinox.preferences;bundle-version="[3.7.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.115.0,4.0.0)",
org.eclipse.lsp4e;bundle-version="0.13.1",
org.eclipse.cdt.lsp.core;bundle-version="[1.1.0,2.0.0)"
Export-Package: org.eclipse.cdt.lsp.internal.ui;x-internal:=true,
org.eclipse.cdt.lsp.internal.ui.preferences;x-internal:=true
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.cdt.lsp.internal.ui.LspUiActivator

View file

@ -14,3 +14,5 @@
Bundle-Name = CDT LSP UI
Bundle-Vendor = Eclipse CDT
preferencePages.languageServer.name=C/C++ Language Server

View file

@ -12,7 +12,9 @@
###############################################################################
source.. = src/
output.. = target/classes/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/
OSGI-INF/,\
plugin.xml

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (c) 2019 ArSysOp and others
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.
SPDX-License-Identifier: EPL-2.0
Contributors:
Alexander Fedorov <alexander.fedorov@arsysop.ru> - initial API and implementation
-->
<plugin>
<extension
point="org.eclipse.ui.preferencePages">
<page
class="org.eclipse.cdt.lsp.internal.ui.preferences.CPPLanguageServerPreferencePage"
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
id="org.eclipse.cdt.lsp.ui.preferencePages.languageServer"
name="%preferencePages.languageServer.name">
</page>
</extension>
</plugin>

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2019 Eclipse Foundation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Alexander Fedorov <alexander.fedorov@arsysop.ru> - initial API and implementatin
*******************************************************************************/
package org.eclipse.cdt.lsp.internal.ui;
import org.eclipse.cdt.lsp.core.Activator;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
//FIXME: try to remove this class during upcoming preference access rework
public class LspUiActivator implements BundleActivator {
private static LspUiActivator plugin;
private IPreferenceStore preferenceStore;
public static LspUiActivator getDefault() {
return plugin;
}
@Override
public void start(BundleContext context) throws Exception {
plugin = this;
}
@Override
public void stop(BundleContext context) throws Exception {
preferenceStore = null;
plugin = null;
}
//FIXME: currently we are still using "core" bundle to store preferences, to be revisited
public IPreferenceStore getLspCorePreferences() {
if (preferenceStore == null) {
preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);
}
return preferenceStore;
}
}

View file

@ -13,10 +13,13 @@
* Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 558516
*******************************************************************************/
package org.eclipse.cdt.lsp.core;
package org.eclipse.cdt.lsp.internal.ui.preferences;
import java.io.File;
import org.eclipse.cdt.lsp.core.CPPStreamConnectionProvider;
import org.eclipse.cdt.lsp.core.PreferenceConstants;
import org.eclipse.cdt.lsp.internal.ui.LspUiActivator;
import org.eclipse.cdt.lsp.internal.ui.LspUiMessages;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
@ -39,7 +42,7 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i
public CPPLanguageServerPreferencePage() {
super(GRID);
setPreferenceStore(Activator.getDefault().getPreferenceStore());
setPreferenceStore(LspUiActivator.getDefault().getLspCorePreferences());
setDescription(LspUiMessages.CPPLanguageServerPreferencePage_description);
}