Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-03-23 06:13:27 -0400
committerTom Schindl2016-03-23 06:13:27 -0400
commit3c396b179388eed514cd26b0c8eb30ac25c900fb (patch)
tree6b733e424e3eeee4a18cc947b006f6903bddc69a /bundles/code/org.eclipse.fx.code.editor.configuration.text.e4
parent72cf8c3199e9ba2de649af59eea9bcbd5ff7dd7b (diff)
downloadorg.eclipse.efxclipse-3c396b179388eed514cd26b0c8eb30ac25c900fb.tar.gz
org.eclipse.efxclipse-3c396b179388eed514cd26b0c8eb30ac25c900fb.tar.xz
org.eclipse.efxclipse-3c396b179388eed514cd26b0c8eb30ac25c900fb.zip
Bug 490265 - Allow to contribute rules dynamically
Diffstat (limited to 'bundles/code/org.eclipse.fx.code.editor.configuration.text.e4')
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF.xml9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/DynamicScannerRuleCalculatorCF.java29
3 files changed, 44 insertions, 1 deletions
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF
index b52768121..ff8807d02 100644
--- a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF
@@ -8,6 +8,11 @@ Require-Bundle: org.eclipse.e4.core.contexts;bundle-version="1.4.0"
Import-Package: org.eclipse.fx.code.editor;version="2.3.0",
org.eclipse.fx.code.editor.configuration;version="2.3.0",
org.eclipse.fx.code.editor.configuration.text;version="2.3.0",
+ org.eclipse.fx.code.editor.e4;version="2.3.0",
+ org.eclipse.fx.code.editor.fx.e4;version="2.3.0",
+ org.eclipse.fx.core;version="2.3.0",
+ org.eclipse.fx.core.di.context;version="2.3.0",
org.osgi.service.component.annotations;version="1.2.0";resolution:=optional
-Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.xml
+Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.xml,
+ OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF.xml
Bundle-ActivationPolicy: lazy
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF.xml
new file mode 100644
index 000000000..a05354ce9
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" name="org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF">
+ <property name="service.context.key" value="org.eclipse.fx.code.editor.configuration.text.DynamicScannerRuleCalculator"/>
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+ <reference bind="registerService" cardinality="0..n" interface="org.eclipse.fx.code.editor.configuration.text.DynamicScannerRuleCalculatorTypeProvider" name="registerService" policy="dynamic" policy-option="greedy" unbind="unregisterService"/>
+ <implementation class="org.eclipse.fx.code.editor.configuration.text.e4.DynamicScannerRuleCalculatorCF"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/DynamicScannerRuleCalculatorCF.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/DynamicScannerRuleCalculatorCF.java
new file mode 100644
index 000000000..b3da66da6
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/DynamicScannerRuleCalculatorCF.java
@@ -0,0 +1,29 @@
+package org.eclipse.fx.code.editor.configuration.text.e4;
+
+import java.util.Map;
+
+import org.eclipse.e4.core.contexts.IContextFunction;
+import org.eclipse.fx.code.editor.configuration.text.DynamicScannerRuleCalculator;
+import org.eclipse.fx.code.editor.configuration.text.DynamicScannerRuleCalculatorTypeProvider;
+import org.eclipse.fx.code.editor.e4.InputBasedContextFunction;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+
+
+@SuppressWarnings("restriction")
+@Component(service=IContextFunction.class,property="service.context.key=org.eclipse.fx.code.editor.configuration.text.DynamicScannerRuleCalculator")
+public class DynamicScannerRuleCalculatorCF extends InputBasedContextFunction<DynamicScannerRuleCalculator,DynamicScannerRuleCalculatorTypeProvider> {
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE,policy=ReferencePolicy.DYNAMIC,policyOption=ReferencePolicyOption.GREEDY)
+ @Override
+ protected void registerService(DynamicScannerRuleCalculatorTypeProvider service, Map<String, Object> properties) {
+ super.registerService(service, properties);
+ }
+
+ @Override
+ protected void unregisterService(DynamicScannerRuleCalculatorTypeProvider service) {
+ super.unregisterService(service);
+ }
+}

Back to the top