From 9e1f790f0d24a3a68926f116dd1554b17dd97b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Thu, 14 Nov 2024 09:55:21 +0100 Subject: [PATCH] Add example of extension in regular bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christoph Läubrich --- org.eclipse.m2e.bnd.ui/build.properties | 1 + .../m2e/bnd/ui/lemminx/MyExtension.java | 21 +++++++++++++++++++ .../org.eclipse.pde.ds.annotations.prefs | 2 +- .../m2e/lemminx/bnd/BndLemminxPlugin.java | 6 ++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 org.eclipse.m2e.bnd.ui/src/org/eclipse/m2e/bnd/ui/lemminx/MyExtension.java diff --git a/org.eclipse.m2e.bnd.ui/build.properties b/org.eclipse.m2e.bnd.ui/build.properties index c58ea2178c..d5ed28ecef 100644 --- a/org.eclipse.m2e.bnd.ui/build.properties +++ b/org.eclipse.m2e.bnd.ui/build.properties @@ -3,3 +3,4 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ OSGI-INF/ +jars.extra.classpath = platform:/plugin/org.eclipse.wildwebdeveloper.xml/language-servers/server/org.eclipse.lemminx-uber.jar diff --git a/org.eclipse.m2e.bnd.ui/src/org/eclipse/m2e/bnd/ui/lemminx/MyExtension.java b/org.eclipse.m2e.bnd.ui/src/org/eclipse/m2e/bnd/ui/lemminx/MyExtension.java new file mode 100644 index 0000000000..659eaddd9a --- /dev/null +++ b/org.eclipse.m2e.bnd.ui/src/org/eclipse/m2e/bnd/ui/lemminx/MyExtension.java @@ -0,0 +1,21 @@ +package org.eclipse.m2e.bnd.ui.lemminx; + +import org.eclipse.lemminx.services.extensions.IXMLExtension; +import org.eclipse.lemminx.services.extensions.XMLExtensionsRegistry; +import org.eclipse.lsp4j.InitializeParams; + +public class MyExtension implements IXMLExtension { + + @Override + public void start(InitializeParams arg0, XMLExtensionsRegistry arg1) { + // TODO Auto-generated method stub + + } + + @Override + public void stop(XMLExtensionsRegistry arg0) { + // TODO Auto-generated method stub + + } + +} diff --git a/org.eclipse.m2e.core/.settings/org.eclipse.pde.ds.annotations.prefs b/org.eclipse.m2e.core/.settings/org.eclipse.pde.ds.annotations.prefs index 73a356b6d0..19be1e2fb6 100644 --- a/org.eclipse.m2e.core/.settings/org.eclipse.pde.ds.annotations.prefs +++ b/org.eclipse.m2e.core/.settings/org.eclipse.pde.ds.annotations.prefs @@ -1,5 +1,5 @@ classpath=true -dsVersion=V1_3 +dsVersion=V1_5 eclipse.preferences.version=1 enabled=true generateBundleActivationPolicyLazy=true diff --git a/org.eclipse.m2e.lemminx.bnd/src/main/java/org/eclipse/m2e/lemminx/bnd/BndLemminxPlugin.java b/org.eclipse.m2e.lemminx.bnd/src/main/java/org/eclipse/m2e/lemminx/bnd/BndLemminxPlugin.java index cbc9ab8904..5aa3aa0cb4 100644 --- a/org.eclipse.m2e.lemminx.bnd/src/main/java/org/eclipse/m2e/lemminx/bnd/BndLemminxPlugin.java +++ b/org.eclipse.m2e.lemminx.bnd/src/main/java/org/eclipse/m2e/lemminx/bnd/BndLemminxPlugin.java @@ -43,26 +43,32 @@ public void start(InitializeParams params, XMLExtensionsRegistry registry) { @Override public void onAttributeName(boolean arg0, ICompletionRequest arg1, ICompletionResponse arg2, CancelChecker arg3) throws Exception { + logger.log(Level.INFO, "onAttributeName"); } @Override public void onAttributeValue(String arg0, ICompletionRequest arg1, ICompletionResponse arg2, CancelChecker arg3) throws Exception { + logger.log(Level.INFO, "onAttributeValue"); } @Override public void onDTDSystemId(String arg0, ICompletionRequest arg1, ICompletionResponse arg2, CancelChecker arg3) throws Exception { + logger.log(Level.INFO, "onDTDSystemId"); } @Override public void onTagOpen(ICompletionRequest arg0, ICompletionResponse arg1, CancelChecker arg2) throws Exception { + logger.log(Level.INFO, "onTagOpen"); } @Override public void onXMLContent(ICompletionRequest completionRequest, ICompletionResponse response, CancelChecker checker) throws Exception { + + logger.log(Level.INFO, "onXMLContent"); try { // FIXME CDATA do not trigger completion: // https://github.com/eclipse/lemminx/issues/1694