Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2015-12-18 04:44:50 -0500
committerTom Schindl2015-12-18 04:44:50 -0500
commit67e42b74e4fec97c23234b9a6fc2904379717a80 (patch)
tree5c38d4d36eac8f8216c6c1f038e7a78fd796acbf /bundles/code/org.eclipse.fx.code.editor.configuration.text.e4
parent6b8f081bde9889926145f800fc7ddea3e5163358 (diff)
downloadorg.eclipse.efxclipse-67e42b74e4fec97c23234b9a6fc2904379717a80.tar.gz
org.eclipse.efxclipse-67e42b74e4fec97c23234b9a6fc2904379717a80.tar.xz
org.eclipse.efxclipse-67e42b74e4fec97c23234b9a6fc2904379717a80.zip
Bug 484645 - org.eclipse.fx.code.editor.configuration.text should not require e4/osgi stuff
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/.classpath7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.gitignore2
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.project33
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/ca.ecliptical.pde.ds.prefs5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF13
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.xml9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/build.properties5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/pom.xml34
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/ConfigurationModelCF.java50
10 files changed, 165 insertions, 0 deletions
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.classpath b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.gitignore b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.gitignore
new file mode 100644
index 000000000..09e3bc9b2
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+/target/
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.project b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.project
new file mode 100644
index 000000000..86e7a2b98
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.code.editor.configuration.text.e4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/ca.ecliptical.pde.ds.prefs b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/ca.ecliptical.pde.ds.prefs
new file mode 100644
index 000000000..963a30719
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/ca.ecliptical.pde.ds.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+enabled=true
+path=OSGI-INF/services
+validationErrorLevel=error
+validationErrorLevel.missingImplicitUnbindMethod=error
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/org.eclipse.jdt.core.prefs b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..0c68a61dc
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
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
new file mode 100644
index 000000000..71d7643a4
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: E4
+Bundle-SymbolicName: org.eclipse.fx.code.editor.configuration.text.e4
+Bundle-Version: 2.2.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.e4.core.contexts;bundle-version="1.4.0"
+Import-Package: org.eclipse.fx.code.editor;version="2.2.0",
+ org.eclipse.fx.code.editor.configuration,
+ org.eclipse.fx.code.editor.configuration.text,
+ org.osgi.service.component.annotations
+Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.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.ConfigurationModelCF.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.xml
new file mode 100644
index 000000000..364c87295
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF.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.ConfigurationModelCF">
+ <property name="service.context.key" value="org.eclipse.fx.code.editor.configuration.LanguageDef"/>
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+ <reference bind="registerProvider" cardinality="0..n" interface="org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider" name="registerProvider" policy="dynamic" policy-option="greedy" unbind="unregisterProvider"/>
+ <implementation class="org.eclipse.fx.code.editor.configuration.text.e4.ConfigurationModelCF"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/build.properties b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/build.properties
new file mode 100644
index 000000000..c58ea2178
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/pom.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/pom.xml
new file mode 100644
index 000000000..42b58d169
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/pom.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>e(fx)clipse - Runtime - Code - JSON UI Toolkit Independent Config e4 integration</name>
+ <groupId>org.eclipse.fx.runtime</groupId>
+ <artifactId>org.eclipse.fx.code.editor.configuration.text.e4</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <parent>
+ <groupId>org.eclipse.fx</groupId>
+ <artifactId>releng</artifactId>
+ <relativePath>../../../releng/org.eclipse.fx.releng/pom.xml</relativePath>
+ <version>2.2.0-SNAPSHOT</version>
+ </parent>
+
+ <build>
+ <resources>
+ <!-- to ensure that the feature lookup of the ui test works -->
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>META-INF/</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/ConfigurationModelCF.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/ConfigurationModelCF.java
new file mode 100644
index 000000000..adaab64ac
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.e4/src/org/eclipse/fx/code/editor/configuration/text/e4/ConfigurationModelCF.java
@@ -0,0 +1,50 @@
+package org.eclipse.fx.code.editor.configuration.text.e4;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.e4.core.contexts.ContextFunction;
+import org.eclipse.e4.core.contexts.IContextFunction;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider;
+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.LanguageDef"})
+public class ConfigurationModelCF extends ContextFunction {
+ private List<ConfigurationModelProvider> providerList = new ArrayList<>();
+
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE,policy=ReferencePolicy.DYNAMIC,policyOption=ReferencePolicyOption.GREEDY)
+ public void registerProvider(ConfigurationModelProvider provider) {
+ synchronized (providerList) {
+ providerList.add(provider);
+ }
+ }
+
+ public void unregisterProvider(ConfigurationModelProvider provider) {
+ synchronized (providerList) {
+ providerList.remove(provider);
+ }
+ }
+
+ @Override
+ public Object compute(IEclipseContext context) {
+ List<ConfigurationModelProvider> list;
+
+ synchronized (providerList) {
+ list = new ArrayList<>(providerList);
+ }
+
+ Input<?> input = context.get(Input.class);
+
+ return list.stream()
+ .filter( p -> p.applies(input))
+ .findFirst()
+ .map( p -> p.getModel(input)).orElse(null);
+ }
+}

Back to the top