From f4a548d2095b32573da4be23c16ae889636c3e38 Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Thu, 22 Feb 2024 16:53:11 +0100 Subject: [PATCH 1/6] [276] Refactor API to provide a stable API with v2.0.0 --- .../cdt/lsp/clangd/ClangdConfiguration.java | 2 +- .../clangd/ClangdConfigurationAccess.java | 2 +- .../clangd/ClangdLanguageServerProvider.java | 2 +- .../editor/ClangdConfigurationArea.java | 2 +- .../editor/ClangdConfigurationPage.java | 8 +++---- .../clangd/editor/CompileCommandsMonitor.java | 2 +- .../org.eclipse.cdt.lsp/META-INF/MANIFEST.MF | 20 +++++++++-------- ...nternal.editor.EditorMetadataDefaults.xml} | 4 ++-- ....cdt.lsp.internal.editor.FormatOnSave.xml} | 6 ++--- ...ternal.ui.BuiltinEditorOptionsDefault.xml} | 4 ++-- ...nal.ui.DefaultConfigurationVisibility.xml} | 4 ++-- ...internal.ui.EditorConfigurationAccess.xml} | 6 ++--- bundles/org.eclipse.cdt.lsp/plugin.xml | 22 +++++++++---------- .../lsp/{editor => }/ResolveProjectScope.java | 3 +-- .../lsp/{editor => config}/Configuration.java | 2 +- .../ConfigurationAccess.java | 3 ++- .../editor/CEditorAssociationOverride.java | 4 ++-- .../editor/DebugHoverProvider.java | 2 +- .../editor/EditorMetadataDefaults.java | 5 ++++- .../editor/EditorPreferenceInitializer.java | 4 +++- .../editor/EditorPreferredOptions.java | 5 ++++- .../editor}/FormatOnSave.java | 4 ++-- .../editor/LspEditorFileImageDescriptor.java | 2 +- .../lsp/internal/editor/SpellingEnabled.java | 2 +- .../HasLanguageServerPropertyTester.java | 4 ++-- .../ui}/BuiltinEditorOptionsDefault.java | 5 +++-- .../ui}/DefaultConfigurationVisibility.java | 3 ++- .../ui}/EditorConfigurationAccess.java | 8 ++++++- .../ui}/EditorConfigurationArea.java | 6 ++++- .../ui}/SaveActionsConfigurationArea.java | 5 ++++- .../ui}/SaveActionsConfigurationPage.java | 5 ++++- .../ui/navigator/CSymbolsContentProvider.java | 2 +- .../navigator/CSymbolsOpenActionProvider.java | 2 +- .../navigator/FileBufferListenerAdapter.java | 2 +- .../ui/navigator/SymbolsManager.java | 4 ++-- .../lsp/{editor => ui}/ConfigurationArea.java | 2 +- .../EditorConfigurationPage.java | 6 ++++- .../eclipse/cdt/lsp/{ => util}/LspUtils.java | 3 ++- 38 files changed, 105 insertions(+), 72 deletions(-) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.editor.EditorMetadataDefaults.xml => org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml} (69%) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.editor.format.FormatOnSave.xml => org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml} (65%) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.editor.BuiltinEditorOptionsDefault.xml => org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml} (58%) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.editor.DefaultConfigurationVisibility.xml => org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml} (63%) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.editor.EditorConfigurationAccess.xml => org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml} (70%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => }/ResolveProjectScope.java (93%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => config}/Configuration.java (96%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => config}/ConfigurationAccess.java (94%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/CEditorAssociationOverride.java (98%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/DebugHoverProvider.java (98%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/EditorMetadataDefaults.java (93%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/EditorPreferenceInitializer.java (91%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/EditorPreferredOptions.java (89%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor/format => internal/editor}/FormatOnSave.java (94%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/editor/LspEditorFileImageDescriptor.java (98%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{server/enable => internal/server}/HasLanguageServerPropertyTester.java (97%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/BuiltinEditorOptionsDefault.java (82%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/DefaultConfigurationVisibility.java (73%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/EditorConfigurationAccess.java (87%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/EditorConfigurationArea.java (89%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/SaveActionsConfigurationArea.java (92%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => internal/ui}/SaveActionsConfigurationPage.java (79%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/ui/navigator/CSymbolsContentProvider.java (99%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/ui/navigator/CSymbolsOpenActionProvider.java (99%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/ui/navigator/FileBufferListenerAdapter.java (96%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => internal}/ui/navigator/SymbolsManager.java (99%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => ui}/ConfigurationArea.java (98%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{editor => ui}/EditorConfigurationPage.java (97%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => util}/LspUtils.java (98%) diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfiguration.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfiguration.java index 7413ee85..e2fe1b41 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfiguration.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfiguration.java @@ -16,7 +16,7 @@ import java.net.URI; import java.util.List; -import org.eclipse.cdt.lsp.editor.Configuration; +import org.eclipse.cdt.lsp.config.Configuration; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdConfigurationAccess.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdConfigurationAccess.java index 3fd44255..80d7cad2 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdConfigurationAccess.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdConfigurationAccess.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.lsp.clangd.ClangdMetadata; import org.eclipse.cdt.lsp.clangd.ClangdOptions; import org.eclipse.cdt.lsp.clangd.ClangdQualifier; -import org.eclipse.cdt.lsp.editor.ConfigurationAccess; +import org.eclipse.cdt.lsp.config.ConfigurationAccess; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.preferences.DefaultScope; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdLanguageServerProvider.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdLanguageServerProvider.java index 413e718d..197e75c4 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdLanguageServerProvider.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdLanguageServerProvider.java @@ -23,7 +23,7 @@ import org.eclipse.cdt.lsp.clangd.ClangdConfiguration; import org.eclipse.cdt.lsp.clangd.ClangdFallbackFlags; -import org.eclipse.cdt.lsp.editor.Configuration; +import org.eclipse.cdt.lsp.config.Configuration; import org.eclipse.cdt.lsp.editor.LanguageServerEnable; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationArea.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationArea.java index 0fa27266..516dd8bf 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationArea.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationArea.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.lsp.clangd.ClangdMetadata; import org.eclipse.cdt.lsp.clangd.ClangdOptions; -import org.eclipse.cdt.lsp.editor.ConfigurationArea; +import org.eclipse.cdt.lsp.ui.ConfigurationArea; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.OsgiPreferenceMetadataStore; import org.eclipse.core.runtime.preferences.PreferenceMetadata; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationPage.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationPage.java index 796dd76e..5e31abe8 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationPage.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/ClangdConfigurationPage.java @@ -16,13 +16,13 @@ import java.io.IOException; -import org.eclipse.cdt.lsp.LspUtils; import org.eclipse.cdt.lsp.clangd.ClangdConfiguration; import org.eclipse.cdt.lsp.clangd.ClangdMetadata; import org.eclipse.cdt.lsp.clangd.ClangdOptions; -import org.eclipse.cdt.lsp.editor.Configuration; -import org.eclipse.cdt.lsp.editor.ConfigurationArea; -import org.eclipse.cdt.lsp.editor.EditorConfigurationPage; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.ui.ConfigurationArea; +import org.eclipse.cdt.lsp.ui.EditorConfigurationPage; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.IDialogConstants; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/CompileCommandsMonitor.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/CompileCommandsMonitor.java index c3444be2..18de44b4 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/CompileCommandsMonitor.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/CompileCommandsMonitor.java @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Stream; -import org.eclipse.cdt.lsp.LspUtils; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; diff --git a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF index ebfe36f0..2a3ce87f 100644 --- a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF @@ -2,14 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.cdt.lsp;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 2.0.0.qualifier Export-Package: org.eclipse.cdt.lsp, + org.eclipse.cdt.lsp.config;x-friends:="org.eclipse.cdt.lsp.clangd", org.eclipse.cdt.lsp.editor, org.eclipse.cdt.lsp.server, - org.eclipse.cdt.lsp.server.enable, org.eclipse.cdt.lsp.services, org.eclipse.cdt.lsp.services.ast, - org.eclipse.cdt.lsp.services.symbolinfo + org.eclipse.cdt.lsp.services.symbolinfo, + org.eclipse.cdt.lsp.ui;x-friends:="org.eclipse.cdt.lsp.clangd", + org.eclipse.cdt.lsp.util;x-friends:="org.eclipse.cdt.lsp.clangd" Bundle-Activator: org.eclipse.cdt.lsp.LspPlugin Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, @@ -36,9 +38,9 @@ Require-Bundle: org.eclipse.ui, Bundle-RequiredExecutionEnvironment: JavaSE-17 Automatic-Module-Name: org.eclipse.cdt.lsp Bundle-ActivationPolicy: lazy -Service-Component: OSGI-INF/org.eclipse.cdt.lsp.editor.BuiltinEditorOptionsDefault.xml, - OSGI-INF/org.eclipse.cdt.lsp.editor.DefaultConfigurationVisibility.xml, - OSGI-INF/org.eclipse.cdt.lsp.editor.EditorConfigurationAccess.xml, - OSGI-INF/org.eclipse.cdt.lsp.editor.EditorMetadataDefaults.xml, - OSGI-INF/org.eclipse.cdt.lsp.editor.format.FormatOnSave.xml, - OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml +Service-Component: OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorMetadataDefaults.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml similarity index 69% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorMetadataDefaults.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml index 12edd8ef..eef92159 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorMetadataDefaults.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml @@ -1,8 +1,8 @@ - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.format.FormatOnSave.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml similarity index 65% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.format.FormatOnSave.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml index a24ed398..c67d09ad 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.format.FormatOnSave.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml @@ -1,9 +1,9 @@ - + - - + + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.BuiltinEditorOptionsDefault.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml similarity index 58% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.BuiltinEditorOptionsDefault.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml index 0859936b..8d9c5a86 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.BuiltinEditorOptionsDefault.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml @@ -1,7 +1,7 @@ - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.DefaultConfigurationVisibility.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml similarity index 63% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.DefaultConfigurationVisibility.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml index 50f1d3bf..ea2a589c 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.DefaultConfigurationVisibility.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml @@ -1,8 +1,8 @@ - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorConfigurationAccess.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml similarity index 70% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorConfigurationAccess.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml index 9058fcae..18bb6e9c 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.editor.EditorConfigurationAccess.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml @@ -1,10 +1,10 @@ - + - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/plugin.xml b/bundles/org.eclipse.cdt.lsp/plugin.xml index 90f0c04f..11f30383 100644 --- a/bundles/org.eclipse.cdt.lsp/plugin.xml +++ b/bundles/org.eclipse.cdt.lsp/plugin.xml @@ -14,7 +14,7 @@ + class="org.eclipse.cdt.lsp.internal.editor.EditorPreferenceInitializer"> @@ -129,7 +129,7 @@ @@ -137,7 +137,7 @@ point="org.eclipse.ui.navigator.navigatorContent"> @@ -209,7 +209,7 @@ @@ -264,21 +264,21 @@ + class="org.eclipse.cdt.lsp.internal.editor.LspEditorFileImageDescriptor"> @@ -288,7 +288,7 @@ point="org.eclipse.ui.propertyPages"> diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ResolveProjectScope.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ResolveProjectScope.java similarity index 93% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ResolveProjectScope.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ResolveProjectScope.java index 9b413f3f..f9d81073 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ResolveProjectScope.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ResolveProjectScope.java @@ -11,12 +11,11 @@ * Contributors: * Alexander Fedorov (ArSysOp) - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp; import java.util.Optional; import java.util.function.Function; -import org.eclipse.cdt.lsp.ResolveProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ProjectScope; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/Configuration.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/Configuration.java similarity index 96% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/Configuration.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/Configuration.java index 714c9691..ec6ca7fb 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/Configuration.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/Configuration.java @@ -1,4 +1,4 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.config; import java.net.URI; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationAccess.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/ConfigurationAccess.java similarity index 94% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationAccess.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/ConfigurationAccess.java index e1f4e8a7..0d022044 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationAccess.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/config/ConfigurationAccess.java @@ -10,10 +10,11 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.config; import java.util.Optional; +import org.eclipse.cdt.lsp.ResolveProjectScope; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.preferences.IEclipsePreferences; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/CEditorAssociationOverride.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/CEditorAssociationOverride.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java index a91c07e8..fbd73565 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/CEditorAssociationOverride.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java @@ -10,12 +10,12 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; import org.eclipse.cdt.codan.core.model.IProblemReporter; import org.eclipse.cdt.lsp.LspPlugin; -import org.eclipse.cdt.lsp.LspUtils; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DebugHoverProvider.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/DebugHoverProvider.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DebugHoverProvider.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/DebugHoverProvider.java index ac52d13e..a0080b02 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DebugHoverProvider.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/DebugHoverProvider.java @@ -10,7 +10,7 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; import java.util.Objects; import java.util.Optional; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorMetadataDefaults.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorMetadataDefaults.java similarity index 93% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorMetadataDefaults.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorMetadataDefaults.java index f70a713f..3433ae14 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorMetadataDefaults.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorMetadataDefaults.java @@ -1,4 +1,7 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; + +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.editor.EditorOptionsDefaults; /******************************************************************************* * Copyright (c) 2023 Contributors to the Eclipse Foundation. diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferenceInitializer.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferenceInitializer.java similarity index 91% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferenceInitializer.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferenceInitializer.java index 8d759843..05dd29da 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferenceInitializer.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferenceInitializer.java @@ -10,8 +10,10 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.editor.EditorMetadata; import org.eclipse.core.runtime.ServiceCaller; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.DefaultScope; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferredOptions.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferredOptions.java similarity index 89% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferredOptions.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferredOptions.java index a8527239..53ee2d45 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorPreferredOptions.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/EditorPreferredOptions.java @@ -10,11 +10,14 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; import java.util.Objects; import org.eclipse.cdt.lsp.PreferredOptions; +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.editor.EditorOptions; +import org.eclipse.cdt.lsp.editor.LanguageServerEnable; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.preferences.IScopeContext; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/format/FormatOnSave.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/FormatOnSave.java similarity index 94% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/format/FormatOnSave.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/FormatOnSave.java index 919a5fe6..b47beb3b 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/format/FormatOnSave.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/FormatOnSave.java @@ -10,9 +10,9 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor.format; +package org.eclipse.cdt.lsp.internal.editor; -import org.eclipse.cdt.lsp.editor.Configuration; +import org.eclipse.cdt.lsp.config.Configuration; import org.eclipse.cdt.lsp.editor.EditorOptions; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.text.IDocument; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/LspEditorFileImageDescriptor.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/LspEditorFileImageDescriptor.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java index a9e5092b..2fdaab3d 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/LspEditorFileImageDescriptor.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java @@ -9,7 +9,7 @@ * Contributors: * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.editor; import java.net.URL; import java.util.HashMap; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/SpellingEnabled.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/SpellingEnabled.java index 0ff39d78..dd876aa3 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/SpellingEnabled.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/SpellingEnabled.java @@ -15,7 +15,7 @@ import java.util.Optional; -import org.eclipse.cdt.lsp.LspUtils; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.runtime.CoreException; import org.eclipse.ui.IEditorInput; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/server/enable/HasLanguageServerPropertyTester.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java similarity index 97% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/server/enable/HasLanguageServerPropertyTester.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java index f3f605ee..5b7bf20d 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/server/enable/HasLanguageServerPropertyTester.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java @@ -12,7 +12,7 @@ * Alexander Fedorov (ArSysOp) - rework access to preferences *******************************************************************************/ -package org.eclipse.cdt.lsp.server.enable; +package org.eclipse.cdt.lsp.internal.server; import java.io.File; import java.net.URI; @@ -23,8 +23,8 @@ import org.eclipse.cdt.lsp.ExistingResource; import org.eclipse.cdt.lsp.InitialUri; import org.eclipse.cdt.lsp.LspPlugin; -import org.eclipse.cdt.lsp.LspUtils; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/BuiltinEditorOptionsDefault.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/BuiltinEditorOptionsDefault.java similarity index 82% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/BuiltinEditorOptionsDefault.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/BuiltinEditorOptionsDefault.java index b8ac8038..abfb5464 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/BuiltinEditorOptionsDefault.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/BuiltinEditorOptionsDefault.java @@ -10,12 +10,13 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; +import org.eclipse.cdt.lsp.editor.EditorOptionsDefaults; import org.osgi.service.component.annotations.Component; @Component -public class BuiltinEditorOptionsDefault implements EditorOptionsDefaults { +public final class BuiltinEditorOptionsDefault implements EditorOptionsDefaults { @Override public boolean preferLspEditor() { diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DefaultConfigurationVisibility.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/DefaultConfigurationVisibility.java similarity index 73% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DefaultConfigurationVisibility.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/DefaultConfigurationVisibility.java index 76e3ddac..650543cf 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/DefaultConfigurationVisibility.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/DefaultConfigurationVisibility.java @@ -1,5 +1,6 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; +import org.eclipse.cdt.lsp.editor.ConfigurationVisibility; import org.osgi.service.component.annotations.Component; @Component(property = { "service.ranking:Integer=0" }) diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationAccess.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationAccess.java similarity index 87% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationAccess.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationAccess.java index 4852bb19..f40ea704 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationAccess.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationAccess.java @@ -10,11 +10,17 @@ * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; import java.util.Optional; import org.eclipse.cdt.lsp.LspQualifier; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.config.ConfigurationAccess; +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.editor.EditorOptions; +import org.eclipse.cdt.lsp.editor.LanguageServerEnable; +import org.eclipse.cdt.lsp.internal.editor.EditorPreferredOptions; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.preferences.DefaultScope; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationArea.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationArea.java similarity index 89% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationArea.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationArea.java index b0e518d7..c0e322bf 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationArea.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/EditorConfigurationArea.java @@ -11,8 +11,12 @@ * Contributors: * Alexander Fedorov (ArSysOp) - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; +import org.eclipse.cdt.lsp.editor.ConfigurationVisibility; +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.editor.EditorOptions; +import org.eclipse.cdt.lsp.ui.ConfigurationArea; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.OsgiPreferenceMetadataStore; import org.eclipse.jface.layout.GridLayoutFactory; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationArea.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationArea.java similarity index 92% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationArea.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationArea.java index 775d860d..b8f08833 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationArea.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationArea.java @@ -1,5 +1,8 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.editor.EditorOptions; +import org.eclipse.cdt.lsp.ui.ConfigurationArea; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.OsgiPreferenceMetadataStore; import org.eclipse.jface.layout.GridLayoutFactory; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationPage.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationPage.java similarity index 79% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationPage.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationPage.java index 5a7ed645..4884106f 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/SaveActionsConfigurationPage.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/SaveActionsConfigurationPage.java @@ -1,5 +1,8 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.internal.ui; +import org.eclipse.cdt.lsp.editor.EditorMetadata; +import org.eclipse.cdt.lsp.ui.ConfigurationArea; +import org.eclipse.cdt.lsp.ui.EditorConfigurationPage; import org.eclipse.swt.widgets.Composite; public class SaveActionsConfigurationPage extends EditorConfigurationPage { diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsContentProvider.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsContentProvider.java similarity index 99% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsContentProvider.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsContentProvider.java index 45ef7315..9c5cc5d8 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsContentProvider.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsContentProvider.java @@ -11,7 +11,7 @@ * Alexander Fedorov (ArSysOp) - use Platform for logging *******************************************************************************/ -package org.eclipse.cdt.lsp.ui.navigator; +package org.eclipse.cdt.lsp.internal.ui.navigator; import java.util.Set; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsOpenActionProvider.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsOpenActionProvider.java similarity index 99% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsOpenActionProvider.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsOpenActionProvider.java index 57e6b0d8..3c0140a5 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/CSymbolsOpenActionProvider.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/CSymbolsOpenActionProvider.java @@ -11,7 +11,7 @@ * Alexander Fedorov (ArSysOp) - use Platform for logging *******************************************************************************/ -package org.eclipse.cdt.lsp.ui.navigator; +package org.eclipse.cdt.lsp.internal.ui.navigator; import org.eclipse.cdt.internal.ui.cview.CViewMessages; import org.eclipse.core.resources.IFile; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/FileBufferListenerAdapter.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/FileBufferListenerAdapter.java similarity index 96% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/FileBufferListenerAdapter.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/FileBufferListenerAdapter.java index 9f7798ee..e6d2b95f 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/FileBufferListenerAdapter.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/FileBufferListenerAdapter.java @@ -10,7 +10,7 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.ui.navigator; +package org.eclipse.cdt.lsp.internal.ui.navigator; import org.eclipse.core.filebuffers.IFileBuffer; import org.eclipse.core.filebuffers.IFileBufferListener; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/SymbolsManager.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/SymbolsManager.java similarity index 99% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/SymbolsManager.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/SymbolsManager.java index 289fadd2..9f2d9756 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/navigator/SymbolsManager.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/ui/navigator/SymbolsManager.java @@ -10,7 +10,7 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.ui.navigator; +package org.eclipse.cdt.lsp.internal.ui.navigator; import java.net.URI; import java.util.HashMap; @@ -23,7 +23,7 @@ import java.util.concurrent.TimeoutException; import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.lsp.LspUtils; +import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filebuffers.IFileBuffer; import org.eclipse.core.filebuffers.IFileBufferListener; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationArea.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/ConfigurationArea.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationArea.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/ConfigurationArea.java index e7303375..25905ffd 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/ConfigurationArea.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/ConfigurationArea.java @@ -1,4 +1,4 @@ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.ui; import java.util.ArrayList; import java.util.HashMap; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationPage.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/EditorConfigurationPage.java similarity index 97% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationPage.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/EditorConfigurationPage.java index 210a098f..4edfb878 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/EditorConfigurationPage.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/ui/EditorConfigurationPage.java @@ -12,11 +12,15 @@ * Alexander Fedorov (ArSysOp) - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.editor; +package org.eclipse.cdt.lsp.ui; import java.util.Optional; +import org.eclipse.cdt.lsp.ResolveProjectScope; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.editor.EditorMetadata; import org.eclipse.cdt.lsp.internal.messages.LspUiMessages; +import org.eclipse.cdt.lsp.internal.ui.EditorConfigurationArea; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.Platform; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspUtils.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspUtils.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java index e4a8ce60..0a9a2e0c 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspUtils.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java @@ -9,7 +9,7 @@ * Contributors: * See git history *******************************************************************************/ -package org.eclipse.cdt.lsp; +package org.eclipse.cdt.lsp.util; import java.net.URI; import java.util.ArrayList; @@ -18,6 +18,7 @@ import java.util.Optional; import java.util.stream.Stream; +import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; From 2bfb330c54c5dd02aa40dd30d3d15bf37624758e Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Fri, 23 Feb 2024 10:23:19 +0100 Subject: [PATCH 2/6] Fix errors in unit tests due to refactoring --- .../org.eclipse.cdt.lsp.test/build.properties | 3 +- .../org/eclipse/cdt/lsp/test/TestUtils.java | 8 +++ .../HasLanguageServerPropertyTesterTest.java | 4 +- .../LspEditorPreferencesTesterTest.java | 51 +++++++++---------- .../cdt/lsp/test/{ => util}/LspUtilsTest.java | 4 +- .../clangd/editor/tests/EditorTestUtils.java | 51 ------------------- .../cdt/lsp/clangd/tests/TestUtils.java | 21 +------- .../LspEditorActiveTesterTest.java | 2 +- .../.classpath | 11 ++++ .../org.eclipse.cdt.lsp.server.test/.project | 28 ++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 9 ++++ .../META-INF/MANIFEST.MF | 9 ++++ .../build.properties | 5 ++ .../fragment.xml | 2 +- .../test}/CLanguageServerProviderTest.java | 2 +- .../test}/MockCLanguageServerProvider.java | 2 +- 16 files changed, 105 insertions(+), 107 deletions(-) rename bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/{server/enable => internal/server}/HasLanguageServerPropertyTesterTest.java (96%) rename {tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions => bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server}/LspEditorPreferencesTesterTest.java (89%) rename bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/{ => util}/LspUtilsTest.java (94%) delete mode 100644 tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/EditorTestUtils.java rename tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/{clangd/editor/tests => internal/clangd/tests/editor}/expressions/LspEditorActiveTesterTest.java (98%) create mode 100644 tests/org.eclipse.cdt.lsp.server.test/.classpath create mode 100644 tests/org.eclipse.cdt.lsp.server.test/.project create mode 100644 tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF create mode 100644 tests/org.eclipse.cdt.lsp.server.test/build.properties rename {bundles/org.eclipse.cdt.lsp.test => tests/org.eclipse.cdt.lsp.server.test}/fragment.xml (79%) rename {bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server => tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test}/CLanguageServerProviderTest.java (97%) rename {bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server => tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test}/MockCLanguageServerProvider.java (96%) diff --git a/bundles/org.eclipse.cdt.lsp.test/build.properties b/bundles/org.eclipse.cdt.lsp.test/build.properties index e3023e14..34d2e4d2 100644 --- a/bundles/org.eclipse.cdt.lsp.test/build.properties +++ b/bundles/org.eclipse.cdt.lsp.test/build.properties @@ -1,5 +1,4 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - .,\ - fragment.xml + . diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/TestUtils.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/TestUtils.java index b1167b65..ae57d59f 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/TestUtils.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/TestUtils.java @@ -17,12 +17,15 @@ import java.io.UnsupportedEncodingException; import java.net.URI; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.editor.EditorMetadata; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.ServiceCaller; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; @@ -33,6 +36,11 @@ public class TestUtils { + public static void setLspPreferred(IProject project, boolean value) { + ServiceCaller.callOnce(TestUtils.class, Configuration.class, // + cc -> cc.storage(project).save(value, ((EditorMetadata) cc.metadata()).preferLspEditor())); + } + public static IProject createCProject(String projectName) throws CoreException { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (project.exists()) { diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/enable/HasLanguageServerPropertyTesterTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java similarity index 96% rename from bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/enable/HasLanguageServerPropertyTesterTest.java rename to bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java index b781a9b1..a44e765c 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/enable/HasLanguageServerPropertyTesterTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java @@ -10,7 +10,7 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.test.server.enable; +package org.eclipse.cdt.lsp.test.internal.server; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -19,7 +19,7 @@ import java.io.IOException; import org.eclipse.cdt.lsp.LspPlugin; -import org.eclipse.cdt.lsp.server.enable.HasLanguageServerPropertyTester; +import org.eclipse.cdt.lsp.internal.server.HasLanguageServerPropertyTester; import org.eclipse.cdt.lsp.test.TestUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; diff --git a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorPreferencesTesterTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java similarity index 89% rename from tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorPreferencesTesterTest.java rename to bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java index 262f52b7..feed27a1 100644 --- a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorPreferencesTesterTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java @@ -12,7 +12,7 @@ * Alexander Fedorov (ArSysOp) - extract headless part *******************************************************************************/ -package org.eclipse.cdt.lsp.clangd.editor.tests.expressions; +package org.eclipse.cdt.lsp.test.internal.server; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -22,10 +22,9 @@ import java.io.UnsupportedEncodingException; import org.eclipse.cdt.lsp.LspPlugin; -import org.eclipse.cdt.lsp.clangd.editor.tests.EditorTestUtils; -import org.eclipse.cdt.lsp.clangd.tests.TestUtils; +import org.eclipse.cdt.lsp.internal.server.HasLanguageServerPropertyTester; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; -import org.eclipse.cdt.lsp.server.enable.HasLanguageServerPropertyTester; +import org.eclipse.cdt.lsp.test.TestUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.junit.jupiter.api.AfterEach; @@ -105,10 +104,10 @@ public void testEditorUsedToOpenCppFile_WITHOUT_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, MAIN_CPP, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor: assertEquals(LspPlugin.C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -123,10 +122,10 @@ public void testEditorUsedToOpenCppFile_WITH_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, MAIN_CPP, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor (LSP): assertEquals(LspPlugin.LSP_C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -141,10 +140,10 @@ public void testEditorUsedToOpenCppHeaderFile_WITHOUT_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, HEADER_HPP, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor: assertEquals(LspPlugin.C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -159,10 +158,10 @@ public void testEditorUsedToOpenCppHeaderFile_WITH_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, HEADER_HPP, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor (LSP): assertEquals(LspPlugin.LSP_C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -177,10 +176,10 @@ public void testEditorUsedToOpenCFile_WITHOUT_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, MAIN_C, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor: assertEquals(LspPlugin.C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -194,10 +193,10 @@ public void testEditorUsedToOpenCFile_WITH_LsEditorPreferred() throws CoreExcept //AND a file exits in the given project: var file = TestUtils.createFile(project, MAIN_C, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor (LSP): assertEquals(LspPlugin.LSP_C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -212,10 +211,10 @@ public void testEditorUsedToOpenCHeaderFile_WITHOUT_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, HEADER_HPP, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor: assertEquals(LspPlugin.C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } /** @@ -230,10 +229,10 @@ public void testEditorUsedToOpenCHeaderFile_WITH_LsEditorPreferred() //AND a file exits in the given project: var file = TestUtils.createFile(project, HEADER_H, FILE_CONTENT); //WHEN this file will be opened: - var editorPart = EditorTestUtils.openInEditor(file); + var editorPart = TestUtils.openInEditor(file); //THEN it will be opened in the C/C++ Editor (LSP): assertEquals(LspPlugin.LSP_C_EDITOR_ID, editorPart.getEditorSite().getId()); - EditorTestUtils.closeEditor(editorPart, false); + TestUtils.closeEditor(editorPart, false); } //********************************************************************************************************************************** @@ -253,7 +252,7 @@ public void testLsNotEnabledByTabSwitchFromLspToNonLspProjectFile() //AND a file exists in the given project: var lspProjectFile = TestUtils.createFile(project, MAIN_C, FILE_CONTENT); //AND this file will be opened: - var lspEditorPart = EditorTestUtils.openInEditor(lspProjectFile); + var lspEditorPart = TestUtils.openInEditor(lspProjectFile); //AND a second project with DISABLED "Prefer C/C++ Editor (LSP)" in the preferences: var nonLspProject = TestUtils.createCProject("NonLspProject"); TestUtils.setLspPreferred(nonLspProject, false); @@ -262,15 +261,15 @@ public void testLsNotEnabledByTabSwitchFromLspToNonLspProjectFile() //THEN the LS won't be enabled for the non LSP project file: assertTrue(!new HasLanguageServerPropertyTester().test(nonLspProjectFile.getLocationURI(), null, null, null)); //AND those file has been be opened: - var nonLspEditorPart = EditorTestUtils.openInEditor(nonLspProjectFile); + var nonLspEditorPart = TestUtils.openInEditor(nonLspProjectFile); //THEN the file from the project with enabled "Prefer C/C++ Editor (LSP)" has been opened in the C/C++ Editor (LSP): assertEquals(LspPlugin.LSP_C_EDITOR_ID, lspEditorPart.getEditorSite().getId()); //THEN the file from the project with disabled "Prefer C/C++ Editor (LSP)" has been opened in the C/C++ Editor: assertEquals(LspPlugin.C_EDITOR_ID, nonLspEditorPart.getEditorSite().getId()); //clean-up: - EditorTestUtils.closeEditor(lspEditorPart, false); - EditorTestUtils.closeEditor(nonLspEditorPart, false); + TestUtils.closeEditor(lspEditorPart, false); + TestUtils.closeEditor(nonLspEditorPart, false); TestUtils.deleteProject(nonLspProject); } @@ -286,7 +285,7 @@ public void testLsEnableByHyperlinkFromLspFileToExternalFile() throws CoreExcept //AND a file exists in the given project: var lspProjectFile = TestUtils.createFile(project, MAIN_C, FILE_CONTENT); //AND this file has been opened: - var lspEditorPart = EditorTestUtils.openInEditor(lspProjectFile); + var lspEditorPart = TestUtils.openInEditor(lspProjectFile); //WHEN an external header file shall be opened in the C/C++ Editor: File externalFile = new File(TEMP_DIR, EXTERNAL_HEADER_HPP); externalFile.createNewFile(); @@ -294,7 +293,7 @@ public void testLsEnableByHyperlinkFromLspFileToExternalFile() throws CoreExcept assertTrue(new HasLanguageServerPropertyTester().test(externalFile.toURI(), null, null, null)); //clean-up: - EditorTestUtils.closeEditor(lspEditorPart, false); + TestUtils.closeEditor(lspEditorPart, false); externalFile.delete(); } diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/LspUtilsTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/util/LspUtilsTest.java similarity index 94% rename from bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/LspUtilsTest.java rename to bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/util/LspUtilsTest.java index 22ec7f33..e0d5df4f 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/LspUtilsTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/util/LspUtilsTest.java @@ -11,12 +11,12 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.test; +package org.eclipse.cdt.lsp.test.util; import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.lsp.LspUtils; +import org.eclipse.cdt.lsp.util.LspUtils; import org.junit.jupiter.api.Test; class LspUtilsTest { diff --git a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/EditorTestUtils.java b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/EditorTestUtils.java deleted file mode 100644 index f0f15f9b..00000000 --- a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/EditorTestUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2023 Bachmann electronic GmbH 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: - * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation - * Alexander Fedorov (ArSysOp) - extract headless part - *******************************************************************************/ - -package org.eclipse.cdt.lsp.clangd.editor.tests; - -import java.net.URI; - -import org.eclipse.core.resources.IFile; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; - -public final class EditorTestUtils { - - public static IEditorPart openInEditor(URI uri, String editorID) throws PartInitException { - IEditorPart part = IDE.openEditor(EditorTestUtils.getWorkbenchPage(), uri, editorID, true); - part.setFocus(); - return part; - } - - public static IEditorPart openInEditor(IFile file) throws PartInitException { - IEditorPart part = IDE.openEditor(EditorTestUtils.getWorkbenchPage(), file); - part.setFocus(); - return part; - } - - public static boolean closeEditor(IEditorPart editor, boolean save) { - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - return page.closeEditor(editor, save); - } - - private static IWorkbenchPage getWorkbenchPage() { - return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - } - -} diff --git a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/tests/TestUtils.java b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/tests/TestUtils.java index e62e683d..ad167fa0 100644 --- a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/tests/TestUtils.java +++ b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/tests/TestUtils.java @@ -15,13 +15,8 @@ package org.eclipse.cdt.lsp.clangd.tests; -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; - -import org.eclipse.cdt.lsp.editor.Configuration; +import org.eclipse.cdt.lsp.config.Configuration; import org.eclipse.cdt.lsp.editor.EditorMetadata; -import org.eclipse.cdt.lsp.editor.EditorOptions; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.ResourcesPlugin; @@ -37,13 +32,6 @@ public static void setLspPreferred(IProject project, boolean value) { cc -> cc.storage(project).save(value, ((EditorMetadata) cc.metadata()).preferLspEditor())); } - public static boolean isLspPreferred(IProject project) { - boolean[] enabled = new boolean[1]; - ServiceCaller.callOnce(TestUtils.class, Configuration.class, // - c -> enabled[0] = ((EditorOptions) c.options(project)).preferLspEditor()); - return enabled[0]; - } - public static IProject createCProject(String projectName) throws CoreException { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (project.exists()) { @@ -67,13 +55,6 @@ public static void deleteProject(IProject project) throws CoreException { } } - public static IFile createFile(IProject p, String name, String content) - throws CoreException, UnsupportedEncodingException { - IFile testFile = p.getFile(name); - testFile.create(new ByteArrayInputStream(content.getBytes(testFile.getCharset())), true, null); - return testFile; - } - public static String getName(TestInfo testInfo) { String displayName = testInfo.getDisplayName(); String replaceFirst = displayName.replaceFirst("\\(.*\\)", ""); diff --git a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorActiveTesterTest.java b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java similarity index 98% rename from tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorActiveTesterTest.java rename to tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java index 9a32a402..d1d3ec29 100644 --- a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/clangd/editor/tests/expressions/LspEditorActiveTesterTest.java +++ b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java @@ -11,7 +11,7 @@ * Dominic Scharfe (COSEDA Technologies GmbH) - initial implementation * Alexander Fedorov (ArSysOp) - extract headless part *******************************************************************************/ -package org.eclipse.cdt.lsp.clangd.editor.tests.expressions; +package org.eclipse.cdt.lsp.internal.clangd.tests.editor.expressions; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/tests/org.eclipse.cdt.lsp.server.test/.classpath b/tests/org.eclipse.cdt.lsp.server.test/.classpath new file mode 100644 index 00000000..675a5e29 --- /dev/null +++ b/tests/org.eclipse.cdt.lsp.server.test/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tests/org.eclipse.cdt.lsp.server.test/.project b/tests/org.eclipse.cdt.lsp.server.test/.project new file mode 100644 index 00000000..2bd4cca9 --- /dev/null +++ b/tests/org.eclipse.cdt.lsp.server.test/.project @@ -0,0 +1,28 @@ + + + org.eclipse.cdt.lsp.server.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..62ef3488 --- /dev/null +++ b/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF b/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF new file mode 100644 index 00000000..c5df37d1 --- /dev/null +++ b/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Language Server Provider Test +Bundle-SymbolicName: org.eclipse.cdt.lsp.server.test;singleton:=true +Bundle-Version: 1.0.0.qualifier +Fragment-Host: org.eclipse.cdt.lsp;bundle-version="1.0.0" +Require-Bundle: junit-jupiter-api +Automatic-Module-Name: org.eclipse.cdt.lsp.server.test +Bundle-RequiredExecutionEnvironment: JavaSE-17 diff --git a/tests/org.eclipse.cdt.lsp.server.test/build.properties b/tests/org.eclipse.cdt.lsp.server.test/build.properties new file mode 100644 index 00000000..e3023e14 --- /dev/null +++ b/tests/org.eclipse.cdt.lsp.server.test/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.xml diff --git a/bundles/org.eclipse.cdt.lsp.test/fragment.xml b/tests/org.eclipse.cdt.lsp.server.test/fragment.xml similarity index 79% rename from bundles/org.eclipse.cdt.lsp.test/fragment.xml rename to tests/org.eclipse.cdt.lsp.server.test/fragment.xml index ec2b7919..386c4599 100644 --- a/bundles/org.eclipse.cdt.lsp.test/fragment.xml +++ b/tests/org.eclipse.cdt.lsp.server.test/fragment.xml @@ -4,7 +4,7 @@ diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/CLanguageServerProviderTest.java b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java similarity index 97% rename from bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/CLanguageServerProviderTest.java rename to tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java index 044e697d..24f674f2 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/CLanguageServerProviderTest.java +++ b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java @@ -10,7 +10,7 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.test.server; +package org.eclipse.cdt.lsp.server.test; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/MockCLanguageServerProvider.java b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java similarity index 96% rename from bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/MockCLanguageServerProvider.java rename to tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java index be757368..cd965a80 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/server/MockCLanguageServerProvider.java +++ b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java @@ -11,7 +11,7 @@ * Alexander Fedorov (ArSysOp) - rework access to preferences *******************************************************************************/ -package org.eclipse.cdt.lsp.test.server; +package org.eclipse.cdt.lsp.server.test; import java.net.URI; import java.util.Collections; From 232025e18e2fd314c13ebacd385cf06eab4cc9f1 Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Fri, 23 Feb 2024 10:36:23 +0100 Subject: [PATCH 3/6] Disable server definition test --- tests/org.eclipse.cdt.lsp.server.test/fragment.xml | 4 ---- .../cdt/lsp/server/test/CLanguageServerProviderTest.java | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/org.eclipse.cdt.lsp.server.test/fragment.xml b/tests/org.eclipse.cdt.lsp.server.test/fragment.xml index 386c4599..40bb102a 100644 --- a/tests/org.eclipse.cdt.lsp.server.test/fragment.xml +++ b/tests/org.eclipse.cdt.lsp.server.test/fragment.xml @@ -3,10 +3,6 @@ - - diff --git a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java index 24f674f2..3d9cf800 100644 --- a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java +++ b/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java @@ -17,6 +17,7 @@ import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.runtime.CoreException; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public class CLanguageServerProviderTest { @@ -24,6 +25,7 @@ public class CLanguageServerProviderTest { /** * Tests whether the ICLanguageServerProvider with the largest priority is used. */ + @Disabled @Test public void testLsProvidersPriority() throws CoreException { //WHEN a language server provider gets created from the serverProvider extension point: From 2f7e5abc2ebdf550b52d829aa96d13c54020cadb Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Fri, 23 Feb 2024 13:19:18 +0100 Subject: [PATCH 4/6] Fix cdt.lsp unit tests --- .../org.eclipse.cdt.lsp.test/build.properties | 3 +- .../org.eclipse.cdt.lsp.test}/fragment.xml | 4 +++ .../server}/CLanguageServerProviderTest.java | 4 +-- .../server}/MockCLanguageServerProvider.java | 11 ++++++-- .../editor/LspEditorFileImageDescriptor.java | 2 +- .../.classpath | 11 -------- .../org.eclipse.cdt.lsp.server.test/.project | 28 ------------------- .../.settings/org.eclipse.jdt.core.prefs | 9 ------ .../META-INF/MANIFEST.MF | 9 ------ .../build.properties | 5 ---- 10 files changed, 17 insertions(+), 69 deletions(-) rename {tests/org.eclipse.cdt.lsp.server.test => bundles/org.eclipse.cdt.lsp.test}/fragment.xml (53%) rename {tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test => bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server}/CLanguageServerProviderTest.java (93%) rename {tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test => bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server}/MockCLanguageServerProvider.java (67%) delete mode 100644 tests/org.eclipse.cdt.lsp.server.test/.classpath delete mode 100644 tests/org.eclipse.cdt.lsp.server.test/.project delete mode 100644 tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF delete mode 100644 tests/org.eclipse.cdt.lsp.server.test/build.properties diff --git a/bundles/org.eclipse.cdt.lsp.test/build.properties b/bundles/org.eclipse.cdt.lsp.test/build.properties index 34d2e4d2..e3023e14 100644 --- a/bundles/org.eclipse.cdt.lsp.test/build.properties +++ b/bundles/org.eclipse.cdt.lsp.test/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + fragment.xml diff --git a/tests/org.eclipse.cdt.lsp.server.test/fragment.xml b/bundles/org.eclipse.cdt.lsp.test/fragment.xml similarity index 53% rename from tests/org.eclipse.cdt.lsp.server.test/fragment.xml rename to bundles/org.eclipse.cdt.lsp.test/fragment.xml index 40bb102a..3d903e6c 100644 --- a/tests/org.eclipse.cdt.lsp.server.test/fragment.xml +++ b/bundles/org.eclipse.cdt.lsp.test/fragment.xml @@ -3,6 +3,10 @@ + + diff --git a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java similarity index 93% rename from tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java rename to bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java index 3d9cf800..c55f9c74 100644 --- a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/CLanguageServerProviderTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java @@ -10,14 +10,13 @@ * Gesa Hentschke (Bachmann electronic GmbH) - initial implementation *******************************************************************************/ -package org.eclipse.cdt.lsp.server.test; +package org.eclipse.cdt.lsp.test.internal.server; import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.runtime.CoreException; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; public class CLanguageServerProviderTest { @@ -25,7 +24,6 @@ public class CLanguageServerProviderTest { /** * Tests whether the ICLanguageServerProvider with the largest priority is used. */ - @Disabled @Test public void testLsProvidersPriority() throws CoreException { //WHEN a language server provider gets created from the serverProvider extension point: diff --git a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/MockCLanguageServerProvider.java similarity index 67% rename from tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java rename to bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/MockCLanguageServerProvider.java index cd965a80..c33770fe 100644 --- a/tests/org.eclipse.cdt.lsp.server.test/src/org/eclipse/cdt/lsp/server/test/MockCLanguageServerProvider.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/MockCLanguageServerProvider.java @@ -11,16 +11,21 @@ * Alexander Fedorov (ArSysOp) - rework access to preferences *******************************************************************************/ -package org.eclipse.cdt.lsp.server.test; +package org.eclipse.cdt.lsp.test.internal.server; import java.net.URI; import java.util.Collections; import java.util.List; +import org.eclipse.cdt.lsp.config.Configuration; +import org.eclipse.cdt.lsp.editor.LanguageServerEnable; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.ServiceCaller; public class MockCLanguageServerProvider implements ICLanguageServerProvider { + private final ServiceCaller editorConfiguration = new ServiceCaller<>(getClass(), + Configuration.class); @Override public List getCommands(URI rootUri) { @@ -29,7 +34,9 @@ public List getCommands(URI rootUri) { @Override public boolean isEnabledFor(IProject project) { - return false; + boolean[] enabled = new boolean[1]; + editorConfiguration.call(c -> enabled[0] = ((LanguageServerEnable) c.options(project)).isEnabledFor(project)); + return enabled[0]; } } diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java index 2fdaab3d..8164cf04 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java @@ -54,7 +54,7 @@ public ImageDescriptor getHeaderImageDescriptor() { @Override public boolean isEnabled(IProject project) { - return cLanguageServerProvider.isEnabledFor(project); + return cLanguageServerProvider != null ? cLanguageServerProvider.isEnabledFor(project) : false; } private final void declareRegistryImage(String key, String path) { diff --git a/tests/org.eclipse.cdt.lsp.server.test/.classpath b/tests/org.eclipse.cdt.lsp.server.test/.classpath deleted file mode 100644 index 675a5e29..00000000 --- a/tests/org.eclipse.cdt.lsp.server.test/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/tests/org.eclipse.cdt.lsp.server.test/.project b/tests/org.eclipse.cdt.lsp.server.test/.project deleted file mode 100644 index 2bd4cca9..00000000 --- a/tests/org.eclipse.cdt.lsp.server.test/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.cdt.lsp.server.test - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 62ef3488..00000000 --- a/tests/org.eclipse.cdt.lsp.server.test/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,9 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 -org.eclipse.jdt.core.compiler.compliance=17 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=17 diff --git a/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF b/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF deleted file mode 100644 index c5df37d1..00000000 --- a/tests/org.eclipse.cdt.lsp.server.test/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Language Server Provider Test -Bundle-SymbolicName: org.eclipse.cdt.lsp.server.test;singleton:=true -Bundle-Version: 1.0.0.qualifier -Fragment-Host: org.eclipse.cdt.lsp;bundle-version="1.0.0" -Require-Bundle: junit-jupiter-api -Automatic-Module-Name: org.eclipse.cdt.lsp.server.test -Bundle-RequiredExecutionEnvironment: JavaSE-17 diff --git a/tests/org.eclipse.cdt.lsp.server.test/build.properties b/tests/org.eclipse.cdt.lsp.server.test/build.properties deleted file mode 100644 index e3023e14..00000000 --- a/tests/org.eclipse.cdt.lsp.server.test/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - fragment.xml From 9171cba84bf38e4ee1354a849e58145068550445 Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Mon, 26 Feb 2024 11:16:12 +0100 Subject: [PATCH 5/6] Make LspPlugin non public --- ...pse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml | 2 +- .../cdt/lsp/clangd/ClangdConfigurationFileManager.java | 2 +- .../cdt/lsp/internal/clangd/ClangdFallbackManager.java | 2 +- .../clangd/editor/expressions/LspEditorActiveTester.java | 2 +- .../handlers/ToggleSourceAndHeaderCommandHandler.java | 2 +- .../internal/server/CLanguageServerProviderTest.java | 2 +- .../internal/server/LspEditorPreferencesTesterTest.java | 2 +- bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF | 9 +++++---- ...=> org.eclipse.cdt.lsp.plugin.InitialFileManager.xml} | 6 +++--- .../lsp/internal/editor/CEditorAssociationOverride.java | 2 +- .../internal/editor/LspEditorFileImageDescriptor.java | 2 +- .../cdt/lsp/internal/server/CLanguageServerRegistry.java | 2 +- .../server/CLanguageServerStreamConnectionProvider.java | 2 +- .../internal/server/HasLanguageServerPropertyTester.java | 4 ++-- .../cdt/lsp/{internal => plugin}/InitialFileManager.java | 4 +--- .../src/org/eclipse/cdt/lsp/{ => plugin}/InitialUri.java | 2 +- .../src/org/eclipse/cdt/lsp/{ => plugin}/LspPlugin.java | 2 +- .../src/org/eclipse/cdt/lsp/util/LspUtils.java | 2 +- .../editor/expressions/LspEditorActiveTesterTest.java | 2 +- 19 files changed, 26 insertions(+), 27 deletions(-) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.internal.InitialFileManager.xml => org.eclipse.cdt.lsp.plugin.InitialFileManager.xml} (57%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{internal => plugin}/InitialFileManager.java (94%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => plugin}/InitialUri.java (95%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{ => plugin}/LspPlugin.java (98%) diff --git a/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml b/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml index 9f125db1..b029d172 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml +++ b/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationFileManager.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationFileManager.java index eab32250..46829823 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationFileManager.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/clangd/ClangdConfigurationFileManager.java @@ -26,7 +26,7 @@ import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java index 66d59f03..f9f27e36 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java @@ -20,8 +20,8 @@ import org.eclipse.cdt.core.build.ICBuildConfigurationManager; import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.lsp.ExistingResource; -import org.eclipse.cdt.lsp.InitialUri; import org.eclipse.cdt.lsp.clangd.ClangdFallbackFlags; +import org.eclipse.cdt.lsp.plugin.InitialUri; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/expressions/LspEditorActiveTester.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/expressions/LspEditorActiveTester.java index 37b1524b..44986039 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/expressions/LspEditorActiveTester.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/expressions/LspEditorActiveTester.java @@ -14,7 +14,7 @@ import java.util.Optional; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.runtime.Adapters; import org.eclipse.ui.IEditorPart; diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/handlers/ToggleSourceAndHeaderCommandHandler.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/handlers/ToggleSourceAndHeaderCommandHandler.java index c58c3b08..d1782ec3 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/handlers/ToggleSourceAndHeaderCommandHandler.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/editor/handlers/ToggleSourceAndHeaderCommandHandler.java @@ -15,8 +15,8 @@ import java.net.URI; import java.util.Optional; -import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.internal.clangd.editor.ClangdPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.services.ClangdLanguageServer; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java index c55f9c74..1fd67424 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/CLanguageServerProviderTest.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.runtime.CoreException; import org.junit.jupiter.api.Test; diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java index feed27a1..4713d5aa 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/LspEditorPreferencesTesterTest.java @@ -21,8 +21,8 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; -import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.internal.server.HasLanguageServerPropertyTester; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.cdt.lsp.test.TestUtils; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF index 2a3ce87f..815a9ed7 100644 --- a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF @@ -6,13 +6,14 @@ Bundle-Version: 2.0.0.qualifier Export-Package: org.eclipse.cdt.lsp, org.eclipse.cdt.lsp.config;x-friends:="org.eclipse.cdt.lsp.clangd", org.eclipse.cdt.lsp.editor, + org.eclipse.cdt.lsp.plugin;x-friends:="org.eclipse.cdt.lsp.clangd", org.eclipse.cdt.lsp.server, org.eclipse.cdt.lsp.services, org.eclipse.cdt.lsp.services.ast, org.eclipse.cdt.lsp.services.symbolinfo, org.eclipse.cdt.lsp.ui;x-friends:="org.eclipse.cdt.lsp.clangd", org.eclipse.cdt.lsp.util;x-friends:="org.eclipse.cdt.lsp.clangd" -Bundle-Activator: org.eclipse.cdt.lsp.LspPlugin +Bundle-Activator: org.eclipse.cdt.lsp.plugin.LspPlugin Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -38,9 +39,9 @@ Require-Bundle: org.eclipse.ui, Bundle-RequiredExecutionEnvironment: JavaSE-17 Automatic-Module-Name: org.eclipse.cdt.lsp Bundle-ActivationPolicy: lazy -Service-Component: OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml, - OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml, +Service-Component: OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml, - OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml + OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml, + OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml similarity index 57% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml index 209f290a..94a42797 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.InitialFileManager.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml @@ -1,8 +1,8 @@ - + - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java index fbd73565..2c89a351 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/CEditorAssociationOverride.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.lsp.internal.editor; import org.eclipse.cdt.codan.core.model.IProblemReporter; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.resources.IFile; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java index 8164cf04..e87d9b24 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/LspEditorFileImageDescriptor.java @@ -14,7 +14,7 @@ import java.net.URL; import java.util.HashMap; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.cdt.ui.lsp.ICFileImageDescriptor; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerRegistry.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerRegistry.java index 1fc39519..c0184393 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerRegistry.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerRegistry.java @@ -15,7 +15,7 @@ import java.util.HashMap; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.core.runtime.Adapters; import org.eclipse.core.runtime.CoreException; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerStreamConnectionProvider.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerStreamConnectionProvider.java index ccb02151..69f5a3cf 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerStreamConnectionProvider.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/CLanguageServerStreamConnectionProvider.java @@ -15,7 +15,7 @@ import java.net.URI; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java index 5b7bf20d..04bd2086 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java @@ -21,8 +21,8 @@ import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.lsp.ExistingResource; -import org.eclipse.cdt.lsp.InitialUri; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.InitialUri; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.cdt.lsp.util.LspUtils; import org.eclipse.core.expressions.PropertyTester; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/InitialFileManager.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java similarity index 94% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/InitialFileManager.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java index 3c0023cd..9718adda 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/InitialFileManager.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java @@ -11,14 +11,12 @@ * Alexander Fedorov (ArSysOp) - rework to OSGi component *******************************************************************************/ -package org.eclipse.cdt.lsp.internal; +package org.eclipse.cdt.lsp.plugin; import java.net.URI; import java.net.URISyntaxException; import java.util.Optional; -import org.eclipse.cdt.lsp.InitialUri; -import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.ExistingResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/InitialUri.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java similarity index 95% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/InitialUri.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java index 4ce337e7..3eb30f80 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/InitialUri.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java @@ -9,7 +9,7 @@ * Contributors: * Alexander Fedorov (ArSysOp) - initial API *******************************************************************************/ -package org.eclipse.cdt.lsp; +package org.eclipse.cdt.lsp.plugin; import java.net.URI; import java.util.Optional; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspPlugin.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/LspPlugin.java similarity index 98% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspPlugin.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/LspPlugin.java index 6b516637..5da895f7 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/LspPlugin.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/LspPlugin.java @@ -11,7 +11,7 @@ * Alexander Fedorov (ArSysOp) - use Platform for logging *******************************************************************************/ -package org.eclipse.cdt.lsp; +package org.eclipse.cdt.lsp.plugin; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java index 0a9a2e0c..fe646b69 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/util/LspUtils.java @@ -18,7 +18,7 @@ import java.util.Optional; import java.util.stream.Stream; -import org.eclipse.cdt.lsp.LspPlugin; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; diff --git a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java index d1d3ec29..a27e4222 100644 --- a/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java +++ b/tests/org.eclipse.cdt.lsp.clangd.tests/src/org/eclipse/cdt/lsp/internal/clangd/tests/editor/expressions/LspEditorActiveTesterTest.java @@ -18,8 +18,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.internal.clangd.editor.expressions.LspEditorActiveTester; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.texteditor.ITextEditor; From d1398615e2e4be70c2d1008afd4e7122d4fed962 Mon Sep 17 00:00:00 2001 From: Gesa HENTSCHKE Date: Wed, 28 Feb 2024 13:17:45 +0100 Subject: [PATCH 6/6] Move InitialFileManager into internal package --- ...clipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml | 2 +- .../cdt/lsp/internal/clangd/ClangdFallbackManager.java | 2 +- .../server/HasLanguageServerPropertyTesterTest.java | 2 +- bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF | 4 ++-- ....eclipse.cdt.lsp.internal.editor.InitialFileManager.xml} | 6 +++--- .../org/eclipse/cdt/lsp/{plugin => editor}/InitialUri.java | 2 +- .../lsp/{plugin => internal/editor}/InitialFileManager.java | 4 +++- .../internal/server/HasLanguageServerPropertyTester.java | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) rename bundles/org.eclipse.cdt.lsp/OSGI-INF/{org.eclipse.cdt.lsp.plugin.InitialFileManager.xml => org.eclipse.cdt.lsp.internal.editor.InitialFileManager.xml} (56%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{plugin => editor}/InitialUri.java (95%) rename bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/{plugin => internal/editor}/InitialFileManager.java (93%) diff --git a/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml b/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml index b029d172..2762d073 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml +++ b/bundles/org.eclipse.cdt.lsp.clangd/OSGI-INF/org.eclipse.cdt.lsp.internal.clangd.ClangdFallbackManager.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java index f9f27e36..d899ceec 100644 --- a/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java +++ b/bundles/org.eclipse.cdt.lsp.clangd/src/org/eclipse/cdt/lsp/internal/clangd/ClangdFallbackManager.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.lsp.ExistingResource; import org.eclipse.cdt.lsp.clangd.ClangdFallbackFlags; -import org.eclipse.cdt.lsp.plugin.InitialUri; +import org.eclipse.cdt.lsp.editor.InitialUri; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; diff --git a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java index a44e765c..fc99cd2a 100644 --- a/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java +++ b/bundles/org.eclipse.cdt.lsp.test/src/org/eclipse/cdt/lsp/test/internal/server/HasLanguageServerPropertyTesterTest.java @@ -18,8 +18,8 @@ import java.io.File; import java.io.IOException; -import org.eclipse.cdt.lsp.LspPlugin; import org.eclipse.cdt.lsp.internal.server.HasLanguageServerPropertyTester; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.test.TestUtils; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; diff --git a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF index 815a9ed7..c1d10932 100644 --- a/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.cdt.lsp/META-INF/MANIFEST.MF @@ -41,7 +41,7 @@ Automatic-Module-Name: org.eclipse.cdt.lsp Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/org.eclipse.cdt.lsp.internal.editor.EditorMetadataDefaults.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.editor.FormatOnSave.xml, + OSGI-INF/org.eclipse.cdt.lsp.internal.editor.InitialFileManager.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.ui.BuiltinEditorOptionsDefault.xml, OSGI-INF/org.eclipse.cdt.lsp.internal.ui.DefaultConfigurationVisibility.xml, - OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml, - OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml + OSGI-INF/org.eclipse.cdt.lsp.internal.ui.EditorConfigurationAccess.xml diff --git a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.InitialFileManager.xml similarity index 56% rename from bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml rename to bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.InitialFileManager.xml index 94a42797..72903e4e 100644 --- a/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.plugin.InitialFileManager.xml +++ b/bundles/org.eclipse.cdt.lsp/OSGI-INF/org.eclipse.cdt.lsp.internal.editor.InitialFileManager.xml @@ -1,8 +1,8 @@ - + - + - + \ No newline at end of file diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/InitialUri.java similarity index 95% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/InitialUri.java index 3eb30f80..4998a716 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialUri.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/editor/InitialUri.java @@ -9,7 +9,7 @@ * Contributors: * Alexander Fedorov (ArSysOp) - initial API *******************************************************************************/ -package org.eclipse.cdt.lsp.plugin; +package org.eclipse.cdt.lsp.editor; import java.net.URI; import java.util.Optional; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/InitialFileManager.java similarity index 93% rename from bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java rename to bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/InitialFileManager.java index 9718adda..70463e78 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/plugin/InitialFileManager.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/editor/InitialFileManager.java @@ -11,13 +11,15 @@ * Alexander Fedorov (ArSysOp) - rework to OSGi component *******************************************************************************/ -package org.eclipse.cdt.lsp.plugin; +package org.eclipse.cdt.lsp.internal.editor; import java.net.URI; import java.net.URISyntaxException; import java.util.Optional; import org.eclipse.cdt.lsp.ExistingResource; +import org.eclipse.cdt.lsp.editor.InitialUri; +import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; diff --git a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java index 04bd2086..039118ee 100644 --- a/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java +++ b/bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/internal/server/HasLanguageServerPropertyTester.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.lsp.ExistingResource; -import org.eclipse.cdt.lsp.plugin.InitialUri; +import org.eclipse.cdt.lsp.editor.InitialUri; import org.eclipse.cdt.lsp.plugin.LspPlugin; import org.eclipse.cdt.lsp.server.ICLanguageServerProvider; import org.eclipse.cdt.lsp.util.LspUtils;