Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2015-11-25 23:22:18 +0000
committerTom Schindl2015-11-25 23:25:29 +0000
commit6bba38d194f90ef28a6500ada1eddf547b8e8c26 (patch)
treeb972c94f534f33c8cd9b7d278af1fba89c6a2677 /bundles
parentc6eb653d23b0e2a2849344210ae279ea0d8a82c7 (diff)
downloadorg.eclipse.efxclipse-6bba38d194f90ef28a6500ada1eddf547b8e8c26.tar.gz
org.eclipse.efxclipse-6bba38d194f90ef28a6500ada1eddf547b8e8c26.tar.xz
org.eclipse.efxclipse-6bba38d194f90ef28a6500ada1eddf547b8e8c26.zip
Bug 483038 - Allow to configures editor highlightings based on JSON
Diffstat (limited to 'bundles')
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.classpath7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.gitignore1
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.project33
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/META-INF/MANIFEST.MF20
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider.xml8
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/build.properties5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/pom.xml34
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/ConfigurationPresentationReconcilerTypeProvider.java35
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationPresentationReconciler.java22
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationRuleScanner.java173
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/.classpath7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/.gitignore1
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/.project33
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/META-INF/MANIFEST.MF21
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider.xml8
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationModelCF.xml9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/build.properties5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/pom.xml34
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelDependentTypeProvider.java30
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelProvider.java10
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationPartitioner.java29
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/Util.java50
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationDocumentPartitionerProvider.java36
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationModelCF.java50
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationRuleBasedPartitionScanner.java53
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/.gitignore13
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorBase.java5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorGModel.java30
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/LanguageDef.java15
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Partition.java22
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule.java10
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_MultiLine.java16
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_SingleLine.java16
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Token.java17
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner.java10
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_CharacterRule.java13
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_Keyword.java13
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_PatternRule.java16
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_SingleLineRule.java16
41 files changed, 927 insertions, 13 deletions
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.classpath b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.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.fx/.gitignore b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.project b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.project
new file mode 100644
index 000000000..b531d2641
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.code.editor.configuration.text.fx</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.fx/.settings/org.eclipse.jdt.core.prefs b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/.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.fx/.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.fx/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..05453bb22
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Fx
+Bundle-SymbolicName: org.eclipse.fx.code.editor.configuration.text.fx
+Bundle-Version: 2.2.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: javax.inject;version="1.0.0",
+ org.eclipse.fx.code.editor;version="2.2.0",
+ org.eclipse.fx.code.editor.configuration,
+ org.eclipse.fx.code.editor.configuration.text,
+ org.eclipse.fx.code.editor.fx.services;version="2.2.0",
+ org.eclipse.fx.core;version="2.2.0",
+ org.eclipse.fx.text.rules,
+ org.eclipse.fx.text.ui,
+ org.eclipse.fx.text.ui.presentation,
+ org.eclipse.fx.text.ui.rules,
+ org.eclipse.jface.text.rules,
+ org.osgi.service.component.annotations
+Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider.xml
+Require-Bundle: org.eclipse.text;bundle-version="3.5.400"
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider.xml
new file mode 100644
index 000000000..e3131b42f
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider.xml
@@ -0,0 +1,8 @@
+<?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.fx.ConfigurationPresentationReconcilerTypeProvider">
+ <service>
+ <provide interface="org.eclipse.fx.code.editor.fx.services.PresentationReconcilerTypeProvider"/>
+ </service>
+ <reference bind="registerModelProvider" cardinality="0..n" interface="org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider" name="registerModelProvider" policy="dynamic" policy-option="greedy" unbind="unregisterModelProvider"/>
+ <implementation class="org.eclipse.fx.code.editor.configuration.text.fx.ConfigurationPresentationReconcilerTypeProvider"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/build.properties b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/build.properties
new file mode 100644
index 000000000..c58ea2178
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/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.fx/pom.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/pom.xml
new file mode 100644
index 000000000..3cf4cbc6d
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/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 JavaFX Toolkit Config</name>
+ <groupId>org.eclipse.fx.runtime</groupId>
+ <artifactId>org.eclipse.fx.code.editor.configuration.text.fx</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> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/ConfigurationPresentationReconcilerTypeProvider.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/ConfigurationPresentationReconcilerTypeProvider.java
new file mode 100644
index 000000000..7722011cb
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/ConfigurationPresentationReconcilerTypeProvider.java
@@ -0,0 +1,35 @@
+package org.eclipse.fx.code.editor.configuration.text.fx;
+
+import java.util.Map;
+
+import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationModelDependentTypeProvider;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider;
+import org.eclipse.fx.code.editor.configuration.text.fx.internal.ConfigurationPresentationReconciler;
+import org.eclipse.fx.code.editor.fx.services.PresentationReconcilerTypeProvider;
+import org.eclipse.fx.text.ui.presentation.PresentationReconciler;
+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
+public class ConfigurationPresentationReconcilerTypeProvider extends ConfigurationModelDependentTypeProvider<PresentationReconciler> implements PresentationReconcilerTypeProvider {
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE,policy=ReferencePolicy.DYNAMIC,policyOption=ReferencePolicyOption.GREEDY)
+ @Override
+ public void registerModelProvider(ConfigurationModelProvider provider, Map<String, Object> properties) {
+ super.registerModelProvider(provider, properties);
+ }
+
+ @Override
+ public void unregisterModelProvider(ConfigurationModelProvider provider) {
+ super.unregisterModelProvider(provider);
+ }
+
+ @Override
+ public Class<? extends PresentationReconciler> getType(Input<?> s) {
+ return ConfigurationPresentationReconciler.class;
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationPresentationReconciler.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationPresentationReconciler.java
new file mode 100644
index 000000000..8241f6e68
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationPresentationReconciler.java
@@ -0,0 +1,22 @@
+package org.eclipse.fx.code.editor.configuration.text.fx.internal;
+
+import javax.inject.Inject;
+
+import org.eclipse.fx.code.editor.configuration.LanguageDef;
+import org.eclipse.fx.code.editor.configuration.Partition;
+import org.eclipse.fx.text.ui.presentation.PresentationReconciler;
+import org.eclipse.fx.text.ui.rules.DefaultDamagerRepairer;
+
+@SuppressWarnings("restriction")
+public class ConfigurationPresentationReconciler extends PresentationReconciler {
+
+ @Inject
+ public ConfigurationPresentationReconciler(LanguageDef model) {
+ for (Partition sc : model.getPartitionList()) {
+ ConfigurationRuleScanner s = new ConfigurationRuleScanner(model, sc);
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(s);
+ setDamager(dr, sc.getName());
+ setRepairer(dr, sc.getName());
+ }
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationRuleScanner.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationRuleScanner.java
new file mode 100644
index 000000000..670e9b5ef
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text.fx/src/org/eclipse/fx/code/editor/configuration/text/fx/internal/ConfigurationRuleScanner.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.code.editor.configuration.text.fx.internal;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.eclipse.fx.code.editor.configuration.LanguageDef;
+import org.eclipse.fx.code.editor.configuration.Partition;
+import org.eclipse.fx.code.editor.configuration.TokenScanner;
+import org.eclipse.fx.code.editor.configuration.TokenScanner_CharacterRule;
+import org.eclipse.fx.code.editor.configuration.TokenScanner_Keyword;
+import org.eclipse.fx.code.editor.configuration.TokenScanner_MultiLineRule;
+import org.eclipse.fx.code.editor.configuration.TokenScanner_PatternRule;
+import org.eclipse.fx.code.editor.configuration.TokenScanner_SingleLineRule;
+import org.eclipse.fx.code.editor.configuration.text.Util;
+import org.eclipse.fx.text.rules.CharacterRule;
+import org.eclipse.fx.text.rules.CombinedWordRule;
+import org.eclipse.fx.text.rules.JavaLikeWordDetector;
+import org.eclipse.fx.text.rules.RegexRule;
+import org.eclipse.fx.text.ui.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IWhitespaceDetector;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+
+@SuppressWarnings("restriction")
+public class ConfigurationRuleScanner extends RuleBasedScanner {
+ public ConfigurationRuleScanner(LanguageDef languageDef, Partition parition) {
+ Token defaultToken = null;
+ IRule[] rules = new IRule[getRuleCount(parition)];
+ int i = 0;
+ Map<Token,TokenScanner_Keyword> keyWordList = new HashMap<>();
+ for( org.eclipse.fx.code.editor.configuration.Token st : parition.getTokenList() ) {
+ Token token = new Token(new TextAttribute(languageDef.getFileSuffix() + "." + st.getName()));
+ if( st.isDefaultToken() ) {
+ defaultToken = token;
+ setDefaultReturnToken(token);
+ }
+
+ for (TokenScanner ru : st.getTokenScannerList()) {
+ if( ru instanceof TokenScanner_SingleLineRule ) {
+ TokenScanner_SingleLineRule sru = (TokenScanner_SingleLineRule) ru;
+ String endSeq = sru.getEndSeq();
+ rules[i++] = Util.wrap(sru.getCheck(),new SingleLineRule(
+ sru.getStartSeq(),
+ endSeq,
+ token,
+ sru.getEscapedBy() != null ? sru.getEscapedBy().charAt(0) : 0,
+ endSeq == null || endSeq.isEmpty()));
+ } else if( ru instanceof TokenScanner_MultiLineRule ) {
+ TokenScanner_MultiLineRule sml = (TokenScanner_MultiLineRule) ru;
+ String endSeq = sml.getEndSeq();
+ rules[i++] = Util.wrap(sml.getCheck(),new MultiLineRule(
+ sml.getStartSeq(),
+ endSeq,
+ token,
+ sml.getEscapedBy() != null ? sml.getEscapedBy().charAt(0) : 0,
+ endSeq == null || endSeq.isEmpty()));
+ } else if( ru instanceof TokenScanner_CharacterRule ) {
+ TokenScanner_CharacterRule scr = (TokenScanner_CharacterRule) ru;
+ char[] c = new char[scr.getCharacterList().size()];
+ for( int j = 0; j < c.length; j++ ) {
+ c[j] = scr.getCharacterList().get(j).charAt(0);
+ }
+ rules[i++] = Util.wrap(scr.getCheck(),new CharacterRule(token, c));
+ } else if( ru instanceof TokenScanner_Keyword ) {
+ keyWordList.put(token,(TokenScanner_Keyword) ru);
+ } else if( ru instanceof TokenScanner_PatternRule ) {
+ TokenScanner_PatternRule rr = (TokenScanner_PatternRule) ru;
+ rules[i++] = Util.wrap(rr.getCheck(),new RegexRule(token, Pattern.compile(rr.getStartPattern()), Math.max(1,rr.getStartLength()),Pattern.compile(rr.getContainmentPattern())));
+ }
+ }
+ }
+
+ if( parition.getWhitespace() != null ) {
+ if( parition.getWhitespace().isJavawhiteSpace() ) {
+ rules[i++] = new WhitespaceRule(new IWhitespaceDetector() {
+
+ @Override
+ public boolean isWhitespace(char c) {
+ return Character.isWhitespace(c);
+ }
+ });
+ } else {
+ rules[i++] = new WhitespaceRule(new FixedCharacterWSDetector(parition.getWhitespace().getCharacterList()));
+ }
+ }
+
+
+ if( ! keyWordList.isEmpty() ) {
+ JavaLikeWordDetector wordDetector= new JavaLikeWordDetector();
+ CombinedWordRule combinedWordRule= new CombinedWordRule(wordDetector, defaultToken);
+ for( Entry<Token, TokenScanner_Keyword> kg : keyWordList.entrySet() ) {
+ CombinedWordRule.WordMatcher wordRule= new CombinedWordRule.WordMatcher();
+ for( String k : kg.getValue().getKeywordList() ) {
+ wordRule.addWord(k, kg.getKey());
+ }
+ combinedWordRule.addWordMatcher(wordRule);
+ }
+ rules[rules.length-1] = combinedWordRule;
+ }
+
+ setRules(rules);
+ }
+
+ private static int getRuleCount(Partition partition) {
+ int rv = 0;
+ boolean hasKeyGroup = false;
+ for (org.eclipse.fx.code.editor.configuration.Token token : partition.getTokenList()) {
+ rv += token.getTokenScannerList().stream().filter( s -> ! (s instanceof TokenScanner_Keyword)).count();
+ if( token.getTokenScannerList().stream().filter( s -> s instanceof TokenScanner_Keyword).count() > 0 ) {
+ hasKeyGroup = true;
+ }
+ }
+
+ if( hasKeyGroup ) {
+ rv += 1;
+ }
+
+ if(partition.getWhitespace() != null) {
+ rv += 1;
+ }
+
+ return rv;
+ }
+
+ static class JSWSDectector implements IWhitespaceDetector {
+
+ @Override
+ public boolean isWhitespace(char c) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
+
+ static class FixedCharacterWSDetector implements IWhitespaceDetector {
+ private final char[] chars;
+
+ public FixedCharacterWSDetector(List<String> list) {
+ chars = new char[list.size()];
+ int i = 0;
+ for( String s : list ) {
+ chars[i++] = s.charAt(0);
+ }
+ }
+
+ @Override
+ public boolean isWhitespace(char c) {
+ for( char ch : chars ) {
+ if( ch == c ) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/.classpath b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.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/.gitignore b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/.project b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.project
new file mode 100644
index 000000000..c4b9bdd5a
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.code.editor.configuration.text</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/.settings/org.eclipse.jdt.core.prefs b/bundles/code/org.eclipse.fx.code.editor.configuration.text/.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/.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/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.configuration.text/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..79d5902b0
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Text
+Bundle-SymbolicName: org.eclipse.fx.code.editor.configuration.text
+Bundle-Version: 2.2.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: javax.inject;version="1.0.0",
+ org.eclipse.e4.core.contexts,
+ org.eclipse.fx.code.editor,
+ org.eclipse.fx.code.editor.configuration,
+ org.eclipse.fx.code.editor.services;version="2.2.0",
+ org.eclipse.fx.core;version="2.2.0",
+ org.eclipse.fx.core.function;version="2.2.0",
+ org.eclipse.fx.text.rules,
+ org.eclipse.jface.text.rules,
+ org.osgi.service.component.annotations;version="1.2.0"
+Require-Bundle: org.eclipse.text;bundle-version="3.5.400"
+Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationModelCF.xml,
+ OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider.xml
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.fx.code.editor.configuration.text
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider.xml
new file mode 100644
index 000000000..887724045
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider.xml
@@ -0,0 +1,8 @@
+<?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.internal.ConfigurationDocumentPartitionerProvider">
+ <service>
+ <provide interface="org.eclipse.fx.code.editor.services.DocumentPartitionerTypeProvider"/>
+ </service>
+ <reference bind="registerModelProvider" cardinality="0..n" interface="org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider" name="registerModelProvider" policy="dynamic" policy-option="greedy" unbind="unregisterModelProvider"/>
+ <implementation class="org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationDocumentPartitionerProvider"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationModelCF.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationModelCF.xml
new file mode 100644
index 000000000..3d0854131
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/OSGI-INF/services/org.eclipse.fx.code.editor.configuration.text.internal.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.internal.ConfigurationModelCF">
+ <property name="service.context.key" value="org.eclipse.fx.code.editor.configuration.LanguageDe"/>
+ <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.internal.ConfigurationModelCF"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/build.properties b/bundles/code/org.eclipse.fx.code.editor.configuration.text/build.properties
new file mode 100644
index 000000000..c58ea2178
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/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/pom.xml b/bundles/code/org.eclipse.fx.code.editor.configuration.text/pom.xml
new file mode 100644
index 000000000..4712168f1
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/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</name>
+ <groupId>org.eclipse.fx.runtime</groupId>
+ <artifactId>org.eclipse.fx.code.editor.configuration.text</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> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelDependentTypeProvider.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelDependentTypeProvider.java
new file mode 100644
index 000000000..17c992fbb
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelDependentTypeProvider.java
@@ -0,0 +1,30 @@
+package org.eclipse.fx.code.editor.configuration.text;
+
+import static org.eclipse.fx.core.RankedObjectRegistry.getOSGiServiceRank;
+
+import java.util.Map;
+
+import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.services.InputDependentTypeProviderService;
+import org.eclipse.fx.core.RankedObjectRegistry;
+
+@SuppressWarnings("restriction")
+public abstract class ConfigurationModelDependentTypeProvider<T> implements InputDependentTypeProviderService<T> {
+ private RankedObjectRegistry<ConfigurationModelProvider> modelProviders = new RankedObjectRegistry<>();
+
+ public void registerModelProvider(ConfigurationModelProvider provider, Map<String, Object> properties) {
+ modelProviders.registerObject(getOSGiServiceRank(properties), provider);
+ }
+
+ public void unregisterModelProvider(ConfigurationModelProvider provider) {
+ modelProviders.unregisterObject(provider);
+ }
+
+ @Override
+ public boolean test(Input<?> s) {
+ synchronized (modelProviders) {
+ return modelProviders.unsynchronizedStream().filter( m -> m.applies(s)).findFirst().isPresent();
+ }
+ }
+
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelProvider.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelProvider.java
new file mode 100644
index 000000000..6288e3cb2
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationModelProvider.java
@@ -0,0 +1,10 @@
+package org.eclipse.fx.code.editor.configuration.text;
+
+import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.configuration.LanguageDef;
+
+@SuppressWarnings("restriction")
+public interface ConfigurationModelProvider {
+ public boolean applies(Input<?> input);
+ public LanguageDef getModel(Input<?> input);
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationPartitioner.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationPartitioner.java
new file mode 100644
index 000000000..eb3eb8985
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/ConfigurationPartitioner.java
@@ -0,0 +1,29 @@
+package org.eclipse.fx.code.editor.configuration.text;
+
+import javax.inject.Inject;
+
+import org.eclipse.fx.code.editor.configuration.LanguageDef;
+import org.eclipse.fx.code.editor.configuration.text.internal.ConfigurationRuleBasedPartitionScanner;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.jface.text.rules.IPartitionTokenScanner;
+
+@SuppressWarnings("restriction")
+public class ConfigurationPartitioner extends FastPartitioner {
+
+ @Inject
+ public ConfigurationPartitioner(LanguageDef m) {
+ super(getScanner(m), getParitions(m));
+ }
+
+ private static IPartitionTokenScanner getScanner(LanguageDef m) {
+ return new ConfigurationRuleBasedPartitionScanner(m.getPartitionList());
+ }
+
+ private static String[] getParitions(LanguageDef m) {
+ return m.getPartitionList()
+ .stream().filter( p -> ! p.getName().equals(IDocument.DEFAULT_CONTENT_TYPE))
+ .map((p) -> p.getName())
+ .toArray((size) -> new String[size]);
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/Util.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/Util.java
new file mode 100644
index 000000000..c0419d7e5
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/Util.java
@@ -0,0 +1,50 @@
+package org.eclipse.fx.code.editor.configuration.text;
+
+import java.util.function.IntPredicate;
+
+import org.eclipse.fx.code.editor.configuration.Check;
+import org.eclipse.fx.code.editor.configuration.Equals;
+import org.eclipse.fx.code.editor.configuration.Range;
+import org.eclipse.fx.core.function.IntRelationOperation;
+import org.eclipse.fx.text.rules.ColumnStartRule;
+import org.eclipse.fx.text.rules.PredicateColumnStartRule;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.IRule;
+
+@SuppressWarnings("restriction")
+public class Util {
+ public static IRule wrap(Check check, IRule rule) {
+ if( check == null ) {
+ return rule;
+ } else {
+ IntPredicate p = null;
+ if( check instanceof Equals ) {
+ int c = ((Equals) check).getValue();
+ p = v -> v == c;
+ } else if( check instanceof Range ) {
+ Range r = (Range) check;
+ if( r.getMin() != -1 && r.getMax() != -1 ) {
+ int min = r.getMin();
+ int max = r.getMax();
+ IntRelationOperation minOp = r.isMinIncl() ? IntRelationOperation::lt : IntRelationOperation::lte;
+ IntRelationOperation maxOp = r.isMaxIncl() ? IntRelationOperation::lt : IntRelationOperation::lte;
+ p = v -> minOp.apply(min, v) && maxOp.apply(v,max);
+ } else if( r.getMin() != -1 ) {
+ int min = r.getMin();
+ IntRelationOperation minOp = r.isMinIncl() ? IntRelationOperation::lt : IntRelationOperation::lte;
+ p = v -> minOp.apply(min, v);
+ } else if( r.getMax() != -1 ) {
+ int max = r.getMax();
+ IntRelationOperation maxOp = r.isMaxIncl() ? IntRelationOperation::lt : IntRelationOperation::lte;
+ p = v -> maxOp.apply(v,max);
+ }
+ }
+
+ if( p != null ) {
+ return rule instanceof IPredicateRule ? new PredicateColumnStartRule((IPredicateRule) rule, p) : new ColumnStartRule(rule, p);
+ } else {
+ return rule;
+ }
+ }
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationDocumentPartitionerProvider.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationDocumentPartitionerProvider.java
new file mode 100644
index 000000000..3e7841efd
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationDocumentPartitionerProvider.java
@@ -0,0 +1,36 @@
+package org.eclipse.fx.code.editor.configuration.text.internal;
+
+import java.util.Map;
+
+import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationModelProvider;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationPartitioner;
+import org.eclipse.fx.code.editor.configuration.text.ConfigurationModelDependentTypeProvider;
+import org.eclipse.fx.code.editor.services.DocumentPartitionerTypeProvider;
+import org.eclipse.jface.text.IDocumentPartitioner;
+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
+public class ConfigurationDocumentPartitionerProvider extends ConfigurationModelDependentTypeProvider<IDocumentPartitioner> implements DocumentPartitionerTypeProvider {
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE,policy=ReferencePolicy.DYNAMIC,policyOption=ReferencePolicyOption.GREEDY)
+ @Override
+ public void registerModelProvider(ConfigurationModelProvider provider, Map<String, Object> properties) {
+ super.registerModelProvider(provider, properties);
+ }
+
+ @Override
+ public void unregisterModelProvider(ConfigurationModelProvider provider) {
+ super.unregisterModelProvider(provider);
+ }
+
+ @Override
+ public Class<? extends IDocumentPartitioner> getType(Input<?> input) {
+ return ConfigurationPartitioner.class;
+ }
+
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationModelCF.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationModelCF.java
new file mode 100644
index 000000000..911231ba5
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationModelCF.java
@@ -0,0 +1,50 @@
+package org.eclipse.fx.code.editor.configuration.text.internal;
+
+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.LanguageDe"})
+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);
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationRuleBasedPartitionScanner.java b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationRuleBasedPartitionScanner.java
new file mode 100644
index 000000000..6e893afe9
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration.text/src/org/eclipse/fx/code/editor/configuration/text/internal/ConfigurationRuleBasedPartitionScanner.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.code.editor.configuration.text.internal;
+
+import java.util.List;
+
+import org.eclipse.fx.code.editor.configuration.Partition;
+import org.eclipse.fx.code.editor.configuration.PartitionRule;
+import org.eclipse.fx.code.editor.configuration.PartitionRule_MultiLine;
+import org.eclipse.fx.code.editor.configuration.PartitionRule_SingleLine;
+import org.eclipse.fx.code.editor.configuration.text.Util;
+import org.eclipse.jface.text.rules.IPredicateRule;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+
+@SuppressWarnings("restriction")
+public class ConfigurationRuleBasedPartitionScanner extends RuleBasedPartitionScanner {
+ public ConfigurationRuleBasedPartitionScanner(List<Partition> paritioner) {
+ IPredicateRule[] pr = new IPredicateRule[paritioner.stream().mapToInt( p -> p.getRuleList().size()).sum()];
+ int i = 0;
+
+ for( Partition p : paritioner ) {
+ for( PartitionRule r : p.getRuleList() ) {
+ if( r instanceof PartitionRule_SingleLine ) {
+ PartitionRule_SingleLine sr = (PartitionRule_SingleLine) r;
+ String endSeq = sr.getEndSeq();
+ String escapeSeq = sr.getEscapedBy();
+ pr[i] = new SingleLineRule(sr.getStartSeq(), endSeq, new Token(p.getName()), escapeSeq != null ? escapeSeq.charAt(0) : 0, endSeq == null || endSeq.isEmpty());
+ } else if( r instanceof PartitionRule_MultiLine ) {
+ PartitionRule_MultiLine mr = (PartitionRule_MultiLine) r;
+ String endSeq = mr.getEndSeq();
+ String escapeSeq = mr.getEscapedBy();
+ pr[i] = new MultiLineRule(mr.getStartSeq(), endSeq, new Token(p.getName()), escapeSeq != null ? escapeSeq.charAt(0) : 0, endSeq == null || endSeq.isEmpty());
+ }
+
+ pr[i] = (IPredicateRule) Util.wrap(r.getCheck(),pr[i]);
+
+ i++;
+ }
+ }
+ setPredicateRules(pr);
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/.gitignore b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/.gitignore
deleted file mode 100644
index 21d6b2f8c..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-/EditorBase.java
-/EditorGModel.java
-/LanguageDef.java
-/Partition.java
-/PartitionRule.java
-/PartitionRule_MultiLine.java
-/PartitionRule_SingleLine.java
-/Token.java
-/TokenScanner.java
-/TokenScanner_CharacterRule.java
-/TokenScanner_Keyword.java
-/TokenScanner_PatternRule.java
-/TokenScanner_SingleLineRule.java
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorBase.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorBase.java
new file mode 100644
index 000000000..4a31ebfb8
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorBase.java
@@ -0,0 +1,5 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface EditorBase {
+
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorGModel.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorGModel.java
new file mode 100644
index 000000000..3fe8e95dd
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/EditorGModel.java
@@ -0,0 +1,30 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface EditorGModel {
+ public static EditorGModel create() {
+ return new org.eclipse.fx.code.editor.configuration.gson.GsonElementFactory();
+ }
+
+ public <T extends EditorBase> T createObject(java.io.Reader json);
+ public <T extends EditorBase> java.util.List<T> createList(java.io.Reader json);
+
+ public String toString(EditorBase o);
+ public String toString(java.util.List<EditorBase> o);
+
+ public LanguageDef.Builder LanguageDefBuilder();
+ public Partition.Builder PartitionBuilder();
+ public PartitionRule.Builder PartitionRuleBuilder();
+ public PartitionRule_MultiLine.Builder PartitionRule_MultiLineBuilder();
+ public PartitionRule_SingleLine.Builder PartitionRule_SingleLineBuilder();
+ public PartitionWhiteSpace.Builder PartitionWhiteSpaceBuilder();
+ public Token.Builder TokenBuilder();
+ public TokenScanner.Builder TokenScannerBuilder();
+ public TokenScanner_CharacterRule.Builder TokenScanner_CharacterRuleBuilder();
+ public TokenScanner_Keyword.Builder TokenScanner_KeywordBuilder();
+ public TokenScanner_PatternRule.Builder TokenScanner_PatternRuleBuilder();
+ public TokenScanner_SingleLineRule.Builder TokenScanner_SingleLineRuleBuilder();
+ public TokenScanner_MultiLineRule.Builder TokenScanner_MultiLineRuleBuilder();
+ public Check.Builder CheckBuilder();
+ public Equals.Builder EqualsBuilder();
+ public Range.Builder RangeBuilder();
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/LanguageDef.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/LanguageDef.java
new file mode 100644
index 000000000..82e43bf86
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/LanguageDef.java
@@ -0,0 +1,15 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface LanguageDef extends EditorBase {
+ public String getFileSuffix();
+ public java.util.List<Partition> getPartitionList();
+
+ public interface Builder {
+ public Builder fileSuffix(String fileSuffix);
+ public Builder partitionList(java.util.List<Partition> partitionList);
+ public Builder appendPartitionList(Partition partitionList);
+ public Builder partitionList(java.util.function.Function<EditorGModel,java.util.List<Partition>> provider);
+ public Builder appendPartitionList(java.util.function.Function<Partition.Builder,Partition> provider);
+ public LanguageDef build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Partition.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Partition.java
new file mode 100644
index 000000000..d94f26836
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Partition.java
@@ -0,0 +1,22 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface Partition extends EditorBase {
+ public String getName();
+ public java.util.List<PartitionRule> getRuleList();
+ public java.util.List<Token> getTokenList();
+ public PartitionWhiteSpace getWhitespace();
+
+ public interface Builder {
+ public Builder name(String name);
+ public Builder ruleList(java.util.List<PartitionRule> ruleList);
+ public Builder appendRuleList(PartitionRule ruleList);
+ public Builder ruleList(java.util.function.Function<EditorGModel,java.util.List<PartitionRule>> provider);
+ public Builder appendRuleList(java.util.function.Function<PartitionRule.Builder,PartitionRule> provider);
+ public Builder tokenList(java.util.List<Token> tokenList);
+ public Builder appendTokenList(Token tokenList);
+ public Builder tokenList(java.util.function.Function<EditorGModel,java.util.List<Token>> provider);
+ public Builder appendTokenList(java.util.function.Function<Token.Builder,Token> provider);
+ public Builder whitespace(PartitionWhiteSpace whitespace);
+ public Partition build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule.java
new file mode 100644
index 000000000..23c57ed47
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule.java
@@ -0,0 +1,10 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface PartitionRule extends EditorBase {
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder check(Check check);
+ public PartitionRule build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_MultiLine.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_MultiLine.java
new file mode 100644
index 000000000..e275cd47e
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_MultiLine.java
@@ -0,0 +1,16 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface PartitionRule_MultiLine extends EditorBase, PartitionRule {
+ public String getStartSeq();
+ public String getEndSeq();
+ public String getEscapedBy();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder startSeq(String startSeq);
+ public Builder endSeq(String endSeq);
+ public Builder escapedBy(String escapedBy);
+ public Builder check(Check check);
+ public PartitionRule_MultiLine build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_SingleLine.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_SingleLine.java
new file mode 100644
index 000000000..8f1d0f972
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/PartitionRule_SingleLine.java
@@ -0,0 +1,16 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface PartitionRule_SingleLine extends EditorBase, PartitionRule {
+ public String getStartSeq();
+ public String getEndSeq();
+ public String getEscapedBy();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder startSeq(String startSeq);
+ public Builder endSeq(String endSeq);
+ public Builder escapedBy(String escapedBy);
+ public Builder check(Check check);
+ public PartitionRule_SingleLine build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Token.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Token.java
new file mode 100644
index 000000000..7c1780159
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/Token.java
@@ -0,0 +1,17 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface Token extends EditorBase {
+ public boolean isDefaultToken();
+ public String getName();
+ public java.util.List<TokenScanner> getTokenScannerList();
+
+ public interface Builder {
+ public Builder defaultToken(boolean defaultToken);
+ public Builder name(String name);
+ public Builder tokenScannerList(java.util.List<TokenScanner> tokenScannerList);
+ public Builder appendTokenScannerList(TokenScanner tokenScannerList);
+ public Builder tokenScannerList(java.util.function.Function<EditorGModel,java.util.List<TokenScanner>> provider);
+ public Builder appendTokenScannerList(java.util.function.Function<TokenScanner.Builder,TokenScanner> provider);
+ public Token build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner.java
new file mode 100644
index 000000000..db0fba1bc
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner.java
@@ -0,0 +1,10 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface TokenScanner extends EditorBase {
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder check(Check check);
+ public TokenScanner build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_CharacterRule.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_CharacterRule.java
new file mode 100644
index 000000000..d50cfcf10
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_CharacterRule.java
@@ -0,0 +1,13 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface TokenScanner_CharacterRule extends EditorBase, TokenScanner {
+ public java.util.List<String> getCharacterList();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder characterList(java.util.List<String> characterList);
+ public Builder appendCharacterList(String characterList);
+ public Builder check(Check check);
+ public TokenScanner_CharacterRule build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_Keyword.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_Keyword.java
new file mode 100644
index 000000000..1934f6427
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_Keyword.java
@@ -0,0 +1,13 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface TokenScanner_Keyword extends EditorBase, TokenScanner {
+ public java.util.List<String> getKeywordList();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder keywordList(java.util.List<String> keywordList);
+ public Builder appendKeywordList(String keywordList);
+ public Builder check(Check check);
+ public TokenScanner_Keyword build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_PatternRule.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_PatternRule.java
new file mode 100644
index 000000000..bb58b0328
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_PatternRule.java
@@ -0,0 +1,16 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface TokenScanner_PatternRule extends EditorBase, TokenScanner {
+ public int getStartLength();
+ public String getStartPattern();
+ public String getContainmentPattern();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder startLength(int startLength);
+ public Builder startPattern(String startPattern);
+ public Builder containmentPattern(String containmentPattern);
+ public Builder check(Check check);
+ public TokenScanner_PatternRule build();
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_SingleLineRule.java b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_SingleLineRule.java
new file mode 100644
index 000000000..94f4110bc
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.configuration/src-gen/org/eclipse/fx/code/editor/configuration/TokenScanner_SingleLineRule.java
@@ -0,0 +1,16 @@
+package org.eclipse.fx.code.editor.configuration;
+
+public interface TokenScanner_SingleLineRule extends EditorBase, TokenScanner {
+ public String getStartSeq();
+ public String getEndSeq();
+ public String getEscapedBy();
+ public Check getCheck();
+
+ public interface Builder {
+ public Builder startSeq(String startSeq);
+ public Builder endSeq(String endSeq);
+ public Builder escapedBy(String escapedBy);
+ public Builder check(Check check);
+ public TokenScanner_SingleLineRule build();
+ }
+}

Back to the top