├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── com.typesafe.hocon.releng └── pom.xml ├── com.typesafe.hocon.sdk ├── .project ├── build.properties ├── feature.xml └── pom.xml ├── com.typesafe.hocon.tests ├── .classpath ├── .project ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── pom.xml └── src │ └── com │ └── typesafe │ └── hocon │ └── parser │ └── ParserTest.xtend ├── com.typesafe.hocon.ui ├── .classpath ├── .project ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── plugin.xml ├── plugin.xml_gen ├── pom.xml └── src │ └── com │ └── typesafe │ └── config │ └── ui │ ├── HoconUiModule.java │ ├── contentassist │ └── HoconProposalProvider.xtend │ ├── labeling │ ├── HoconDescriptionLabelProvider.xtend │ └── HoconLabelProvider.xtend │ ├── outline │ └── HoconOutlineTreeProvider.xtend │ └── quickfix │ └── HoconQuickfixProvider.xtend ├── com.typesafe.hocon.updatesite ├── category.xml └── pom.xml ├── com.typesafe.hocon ├── .classpath ├── .project ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── plugin.xml ├── plugin.xml_gen ├── pom.xml └── src │ └── com │ └── typesafe │ └── config │ ├── GenerateHocon.mwe2 │ ├── Hocon.xtext │ ├── HoconRuntimeModule.java │ ├── HoconStandaloneSetup.java │ ├── formatting │ └── HoconFormatter.xtend │ ├── generator │ └── HoconGenerator.xtend │ ├── scoping │ └── HoconScopeProvider.xtend │ └── validation │ └── HoconValidator.xtend ├── images └── screenshot.png ├── publish.sh └── pushToBintray.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | .settings/ 15 | 16 | generated/ 17 | generated-sources/ 18 | src-gen/ 19 | xtend-gen/ 20 | target/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: Java 2 | before_install: echo "MAVEN_OPTS='-Xmx2048m -XX:MaxPermSize=512m'" > ~/.mavenrc 3 | script: cd com.typesafe.hocon.releng && mvn package 4 | 5 | cache: 6 | directories: 7 | - $HOME/.m2 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/dragos/typesafe-config-eclipse.svg?branch=master)](https://travis-ci.org/dragos/typesafe-config-eclipse) 2 | [ ![Download](https://api.bintray.com/packages/dragos/typesafe-config-eclipse/typesafe-config-eclipse/images/download.svg) ](https://bintray.com/dragos/typesafe-config-eclipse/typesafe-config-eclipse/_latestVersion) 3 | 4 | # Eclipse plugin for Typesafe Config files 5 | 6 | This project provides Eclipse toolings for editing configuration files in Hocon format (coloquially called [Typesafe Config](https://github.com/typesafehub/config)). 7 | 8 | # Installation 9 | 10 | ### Eclipse Marketplace: 11 | Drag to your running Eclipse workspace. 12 | Drag the install button on your running Eclipse application 13 | 14 | ### Update site 15 | Alternatively, use the plain old update site: https://dl.bintray.com/dragos/typesafe-config-eclipse/ 16 | 17 | # Features 18 | 19 | - configurable syntax highlighting and error checking 20 | - outline view 21 | - toggle comments 22 | - structured selection (syntax-aware increase/decrease selection) 23 | - auto edits, match braces 24 | 25 | ![Screenshot](/images/screenshot.png?raw=true) 26 | 27 | # Limitations 28 | 29 | - no completion or hyperlinking 30 | 31 | # Build 32 | 33 | Run `mvn` inside `com.typesafe.hocon.releng`. 34 | 35 | # Cut a release 36 | 37 | - check that the current version is correct (1 ahead of the latest release) 38 | - build release 39 | - `./publish.sh `, where `` is a non-SNAPSHOT version. 40 | Say, the current version in `pom.xml` is `1.0.5-SNAPSHOT`, you should call `./publish.sh` with `1.0.5` 41 | - tag (e.g. (`git tag v1.0.5`) and push tags 42 | - bump version (inside `com.typesafe.hocon.releng`): `mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=1.0.6-SNAPSHOT` 43 | 44 | # Contribute 45 | 46 | The project is based on [xtext](https://www.eclipse.org/Xtext/index.html). Help in the form of code contributions is most welcome! 47 | -------------------------------------------------------------------------------- /com.typesafe.hocon.releng/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.typesafe.hocon 6 | parent 7 | 1.0.7-SNAPSHOT 8 | pom 9 | 10 | ../com.typesafe.hocon 11 | ../com.typesafe.hocon.ui 12 | ../com.typesafe.hocon.tests 13 | ../com.typesafe.hocon.sdk 14 | ../com.typesafe.hocon.updatesite 15 | 16 | 17 | 18 | 0.23.0 19 | UTF-8 20 | 2.8.4 21 | 22 | 23 | 24 | 25 | eclipse 26 | p2 27 | http://download.eclipse.org/releases/neon/ 28 | 29 | 30 | Xtext Update Site 31 | p2 32 | http://download.eclipse.org/modeling/tmf/xtext/updates/releases/${xtext.version}/ 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | org.eclipse.xtend 44 | xtend-maven-plugin 45 | ${xtext.version} 46 | 47 | 48 | 49 | compile 50 | xtend-install-debug-info 51 | testCompile 52 | xtend-test-install-debug-info 53 | 54 | 55 | 56 | 57 | xtend-gen 58 | 59 | 60 | 61 | org.apache.maven.plugins 62 | maven-clean-plugin 63 | 2.5 64 | 65 | 66 | gen-clean 67 | 68 | clean 69 | 70 | 71 | 72 | 73 | ${basedir}/xtend-gen 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | org.eclipse.tycho 86 | tycho-maven-plugin 87 | ${tycho-version} 88 | true 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /com.typesafe.hocon.sdk/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.typesafe.hocon.sdk 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /com.typesafe.hocon.sdk/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes =feature.xml 2 | -------------------------------------------------------------------------------- /com.typesafe.hocon.sdk/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Apache License 9 | 10 | Version 2.0, January 2004 11 | 12 | http://www.apache.org/licenses/ 13 | 14 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 15 | 16 | 1. Definitions. 17 | 18 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 19 | 20 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 21 | 22 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 27 | 28 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 29 | 30 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 31 | 32 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 33 | 34 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 35 | 36 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 37 | 38 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 39 | 40 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 41 | 42 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 43 | 44 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 45 | You must cause any modified files to carry prominent notices stating that You changed the files; and 46 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 47 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 48 | 49 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 50 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 51 | 52 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 53 | 54 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 55 | 56 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 57 | 58 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 59 | 60 | END OF TERMS AND CONDITIONS 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /com.typesafe.hocon.sdk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | ../com.typesafe.hocon.releng/pom.xml 7 | com.typesafe.hocon 8 | parent 9 | 1.0.7-SNAPSHOT 10 | 11 | 12 | com.typesafe.hocon.sdk 13 | eclipse-feature 14 | 15 | Typesafe Config Feature 16 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.typesafe.hocon.tests 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.xtext.ui.shared.xtextBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.xtext.ui.shared.xtextNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: com.typesafe.hocon.tests 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.7.qualifier 6 | Bundle-SymbolicName: com.typesafe.hocon.tests;singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: com.typesafe.hocon, 9 | com.typesafe.hocon.ui, 10 | org.eclipse.core.runtime, 11 | org.eclipse.xtext.junit4, 12 | org.eclipse.xtext.xbase.lib, 13 | org.eclipse.ui.workbench;resolution:=optional, 14 | org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional 15 | Import-Package: org.apache.log4j, 16 | org.junit;version="4.5.0", 17 | org.junit.runner;version="4.5.0", 18 | org.junit.runner.manipulation;version="4.5.0", 19 | org.junit.runner.notification;version="4.5.0", 20 | org.junit.runners;version="4.5.0", 21 | org.junit.runners.model;version="4.5.0", 22 | org.hamcrest.core 23 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 24 | Export-Package: com.typesafe.config 25 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = META-INF/,\ 5 | . 6 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | ../com.typesafe.hocon.releng/pom.xml 7 | com.typesafe.hocon 8 | parent 9 | 1.0.7-SNAPSHOT 10 | 11 | 12 | com.typesafe.hocon.tests 13 | eclipse-test-plugin 14 | 15 | Typesafe Config Tests 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-clean-plugin 22 | 23 | 24 | gen-clean 25 | clean 26 | 27 | 28 | 29 | 30 | org.eclipse.xtend 31 | xtend-maven-plugin 32 | 33 | 34 | org.eclipse.tycho 35 | tycho-surefire-plugin 36 | ${tycho-version} 37 | 38 | false 39 | false 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /com.typesafe.hocon.tests/src/com/typesafe/hocon/parser/ParserTest.xtend: -------------------------------------------------------------------------------- 1 | package com.typesafe.hocon.parser 2 | 3 | import com.typesafe.config.HoconInjectorProvider 4 | import com.typesafe.config.hocon.Root 5 | import javax.inject.Inject 6 | import org.eclipse.xtext.junit4.InjectWith 7 | import org.eclipse.xtext.junit4.XtextRunner 8 | import org.eclipse.xtext.junit4.util.ParseHelper 9 | import org.junit.Assert 10 | import org.junit.Test 11 | import org.junit.runner.RunWith 12 | 13 | @RunWith(XtextRunner) 14 | @InjectWith(HoconInjectorProvider) 15 | class ParserTest { 16 | 17 | @Inject 18 | ParseHelper parser 19 | 20 | @Test 21 | def void parseSimpleJson() { 22 | succeeds(''' 23 | "foo": 10.0, 24 | "bar": "baz", 25 | "obj": { 26 | "a": 10, 27 | "b": [1, 2, 3], 28 | "c": true, 29 | "d": false 30 | } 31 | ''') 32 | } 33 | 34 | @Test 35 | def void parseSimpleHocon() { 36 | succeeds(''' 37 | a = true 38 | b = false 39 | c: on 40 | foo = 5seconds 41 | port = 1024 42 | # this one is also a comment 43 | // as is this one 44 | outer { 45 | inner { 46 | value = 10 # this is an example 47 | bar = -100, 48 | 49 | # and another 50 | array = [ 51 | 1, 2, 3 52 | ] 53 | long = 54 | "foo" 55 | } 56 | } 57 | ''') 58 | } 59 | 60 | // taken from the typesafe config test suite 61 | @Test 62 | def void complexHocon() { 63 | succeeds(''' 64 | { 65 | foo: bar baz qux ernie 66 | // The above was a concatenation 67 | 68 | baz = [ abc 123, {a:12 69 | b: { 70 | c: 13 71 | d: { 72 | a: 22 73 | b: "abcdefg" # this is a comment 74 | c: [1, 2, 3] 75 | } 76 | } 77 | }, # this was an object in an array 78 | //The above value is a map containing a map containing a map, all in an array 79 | 22, 80 | // The below value is an array contained in another array 81 | [1,2,3]] 82 | // This is a map with some nested maps and arrays within it, as well as some concatenations 83 | qux { 84 | baz: abc 123 85 | biz: [element1, element2] [element3, element4] 86 | buz: [prependelementtoarray] ${arrayref} 87 | bar: { 88 | baz: abcdefg 89 | bar: { 90 | a: null 91 | b: true 92 | c: [true false 123, null, [1, 2, 3]] 93 | } 94 | } 95 | } 96 | // Did I cover everything? 97 | } 98 | ''') 99 | } 100 | 101 | @Test 102 | def void testLineFeed() { 103 | succeeds("test {\n a = 2 \n}\n") 104 | } 105 | 106 | @Test 107 | def void testCarriageReturnLineFeed() { 108 | succeeds("test {\r\n a = 2 \r\n}\r\n") 109 | } 110 | 111 | @Test 112 | def void testPlusEquals() { 113 | succeeds("foo += 10\n") 114 | } 115 | 116 | @Test 117 | def void testEOF() { 118 | succeeds("foo = 10") 119 | } 120 | 121 | @Test 122 | def void testSubstitution() { 123 | succeeds("foo.bar += ${akka.timeout}\n") 124 | } 125 | 126 | @Test 127 | def void testConditionalSubstitution() { 128 | succeeds("foo = ${?SUB}") 129 | } 130 | 131 | @Test 132 | def void testObjectOneMemberOnSingleLine() { 133 | succeeds("{y: 1}") 134 | } 135 | 136 | @Test 137 | def void testObjectTwoMembersOnSingleLine() { 138 | succeeds("{y: 1, z : 1}") 139 | } 140 | 141 | @Test 142 | def void testObjectTwoMembersOnSingleLineViaEquals() { 143 | succeeds("{y = 1, z = 1}") 144 | } 145 | 146 | @Test 147 | def void testObjectAssignmentOneMemberOnSingleLine() { 148 | succeeds("x = {y: 1}") 149 | } 150 | 151 | @Test 152 | def void testObjectAssignmentTwoMembersOnSingleLine() { 153 | succeeds("x = {y: 1, z : 1}") 154 | } 155 | 156 | @Test 157 | def void testObjectAssignmentTwoMembersOnSingleLineViaEquals() { 158 | succeeds("x = { y = 1, z = 1}") 159 | } 160 | 161 | @Test 162 | def void testObjectAssignmentWithoutSemicolonLineBreak() { 163 | succeeds('''x = {y: 1 164 | z: 1}''') 165 | } 166 | 167 | @Test 168 | def void testObjectWithoutSemicolonLineBreak() { 169 | succeeds('''{y : 1 170 | z : 1}''') 171 | } 172 | 173 | @Test 174 | def void testObjectWithoutSemicolonLineBreakViaEquals() { 175 | succeeds('''{y = 1 176 | z = 1}''') 177 | } 178 | 179 | @Test 180 | def void testObjectTwoMemberAssignmentsOnOneLine() { 181 | fails("{y : 1 z : 1}") 182 | } 183 | 184 | @Test 185 | def void testObjectTwoMemberAssignmentsOnOneLineViaEquals() { 186 | fails("{y = 1 z = 1}") 187 | } 188 | 189 | @Test 190 | def void testTwoAssignmentsOnOneLine() { 191 | fails("y : 1 z : 1") 192 | } 193 | 194 | @Test 195 | def void testTwoAssignmentsOnOneLineViaEquals() { 196 | fails("y = 1 z = 1") 197 | } 198 | 199 | private def void succeeds(String text) { 200 | val model = parser.parse(text) 201 | Assert.assertTrue("No errors expected, but errors found: " + model.eResource.errors, model.eResource.errors.empty) 202 | } 203 | 204 | private def void fails(String text) { 205 | val model = parser.parse(text) 206 | Assert.assertFalse("Error expected, but no error found", model.eResource.errors.empty) 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.typesafe.hocon.ui 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.xtext.ui.shared.xtextBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.xtext.ui.shared.xtextNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: com.typesafe.hocon.ui 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.7.qualifier 6 | Bundle-SymbolicName: com.typesafe.hocon.ui;singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: com.typesafe.hocon;visibility:=reexport, 9 | org.eclipse.xtext.ui, 10 | org.eclipse.ui.editors;bundle-version="3.5.0", 11 | org.eclipse.ui.ide;bundle-version="3.5.0", 12 | org.eclipse.xtext.ui.shared, 13 | org.eclipse.ui, 14 | org.eclipse.xtext.builder, 15 | org.eclipse.xtext.xbase.lib, 16 | org.eclipse.xtext.common.types.ui, 17 | org.eclipse.xtext.ui.codetemplates.ui, 18 | org.eclipse.compare 19 | Import-Package: org.apache.log4j 20 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 21 | Export-Package: com.typesafe.config.ui.quickfix, 22 | com.typesafe.config.ui.contentassist, 23 | com.typesafe.config.ui.internal, 24 | com.typesafe.config.ui.contentassist.antlr, 25 | com.typesafe.config.ui.contentassist.antlr.internal 26 | Bundle-Activator: com.typesafe.config.ui.internal.HoconActivator 27 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = META-INF/,\ 5 | .,\ 6 | plugin.xml 7 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 15 | 16 | 17 | 19 | 22 | 23 | 25 | 26 | 27 | 28 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 80 | 82 | 86 | 87 | 88 | 93 | 94 | 95 | 100 | 101 | 102 | 103 | 105 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 118 | 121 | 122 | 124 | 128 | 129 | 130 | 135 | 136 | 141 | 142 | 143 | 144 | 146 | 150 | 151 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 202 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 214 | 217 | 218 | 219 | 220 | 223 | 224 | 225 | 226 | 227 | 228 | 232 | 233 | 234 | 235 | 239 | 240 | 241 | 242 | 246 | 247 | 248 | 249 | 250 | 252 | 256 | 257 | 258 | 260 | 265 | 266 | 267 | 268 | 270 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 310 | 311 | 313 | 314 | 315 | 316 | 317 | 319 | 323 | 324 | 325 | 326 | 328 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 340 | 343 | 346 | 347 | 348 | 351 | 354 | 355 | 356 | 359 | 362 | 363 | 364 | 365 | 366 | 367 | 370 | 371 | 373 | 374 | 375 | 376 | 377 | 378 | 380 | 382 | 383 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 396 | 397 | 398 | 399 | 400 | 401 | 404 | 405 | 406 | 407 | 410 | 411 | 412 | 413 | 416 | 417 | 418 | 419 | 422 | 423 | 424 | 425 | 426 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/plugin.xml_gen: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 15 | 16 | 17 | 19 | 22 | 23 | 25 | 26 | 27 | 28 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 80 | 82 | 86 | 87 | 88 | 93 | 94 | 95 | 100 | 101 | 102 | 103 | 105 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 118 | 121 | 122 | 124 | 128 | 129 | 130 | 135 | 136 | 141 | 142 | 143 | 144 | 146 | 150 | 151 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 202 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 214 | 217 | 218 | 219 | 220 | 223 | 224 | 225 | 226 | 227 | 228 | 232 | 233 | 234 | 235 | 239 | 240 | 241 | 242 | 246 | 247 | 248 | 249 | 250 | 252 | 256 | 257 | 258 | 260 | 265 | 266 | 267 | 268 | 270 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 310 | 311 | 313 | 314 | 315 | 316 | 317 | 319 | 323 | 324 | 325 | 326 | 328 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 340 | 343 | 346 | 347 | 348 | 351 | 354 | 355 | 356 | 359 | 362 | 363 | 364 | 365 | 366 | 367 | 370 | 371 | 373 | 374 | 375 | 376 | 377 | 378 | 380 | 382 | 383 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 396 | 397 | 398 | 399 | 400 | 401 | 404 | 405 | 406 | 407 | 410 | 411 | 412 | 413 | 416 | 417 | 418 | 419 | 422 | 423 | 424 | 425 | 426 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | ../com.typesafe.hocon.releng/pom.xml 7 | com.typesafe.hocon 8 | parent 9 | 1.0.7-SNAPSHOT 10 | 11 | 12 | com.typesafe.hocon.ui 13 | eclipse-plugin 14 | 15 | Typesafe Config UI 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-clean-plugin 22 | 23 | 24 | gen-clean 25 | clean 26 | 27 | 28 | 29 | 30 | org.eclipse.xtend 31 | xtend-maven-plugin 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/HoconUiModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui; 5 | 6 | import org.eclipse.ui.plugin.AbstractUIPlugin; 7 | 8 | /** 9 | * Use this class to register components to be used within the IDE. 10 | */ 11 | public class HoconUiModule extends com.typesafe.config.ui.AbstractHoconUiModule { 12 | public HoconUiModule(AbstractUIPlugin plugin) { 13 | super(plugin); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/contentassist/HoconProposalProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui.contentassist 5 | 6 | import com.typesafe.config.ui.contentassist.AbstractHoconProposalProvider 7 | 8 | /** 9 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist 10 | * on how to customize the content assistant. 11 | */ 12 | class HoconProposalProvider extends AbstractHoconProposalProvider { 13 | } 14 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/labeling/HoconDescriptionLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui.labeling 5 | 6 | //import org.eclipse.xtext.resource.IEObjectDescription 7 | 8 | /** 9 | * Provides labels for IEObjectDescriptions and IResourceDescriptions. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 12 | */ 13 | class HoconDescriptionLabelProvider extends org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider { 14 | 15 | // Labels and icons can be computed like this: 16 | 17 | // override text(IEObjectDescription ele) { 18 | // ele.name.toString 19 | // } 20 | // 21 | // override image(IEObjectDescription ele) { 22 | // ele.EClass.name + '.gif' 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/labeling/HoconLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui.labeling 5 | 6 | import com.google.inject.Inject 7 | import com.typesafe.config.hocon.Member 8 | import com.typesafe.config.hocon.EString 9 | import com.typesafe.config.hocon.Array 10 | import com.typesafe.config.hocon.Literal 11 | 12 | /** 13 | * Provides labels for EObjects. 14 | * 15 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 16 | */ 17 | class HoconLabelProvider extends org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider { 18 | 19 | @Inject 20 | new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) { 21 | super(delegate); 22 | } 23 | 24 | // Labels and icons can be computed like this: 25 | 26 | def text(Member ele) { 27 | if (ele.memberValue != null 28 | && ele.memberValue.simpleLiterals.size == 1 29 | && ele.memberValue.simpleLiterals.get(0) instanceof EString) 30 | ele.name.getText + ": " + ele.memberValue.simpleLiterals.get(0).getText 31 | else 32 | ele.name.getText 33 | } 34 | 35 | def text(Literal l) { 36 | if (l != null 37 | && l.simpleLiterals.size == 1 38 | && l.simpleLiterals.get(0) instanceof EString) 39 | l.simpleLiterals.get(0).getText 40 | } 41 | 42 | def text(Array l) { 43 | "[]" 44 | } 45 | // 46 | // def image(Greeting ele) { 47 | // 'Greeting.gif' 48 | // } 49 | } 50 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/outline/HoconOutlineTreeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui.outline 5 | 6 | import org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode 7 | import org.eclipse.emf.ecore.EObject 8 | import com.typesafe.config.hocon.Member 9 | import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode 10 | import org.eclipse.xtext.ui.editor.outline.IOutlineNode 11 | import com.typesafe.config.hocon.EString 12 | import com.typesafe.config.hocon.Literal 13 | import com.typesafe.config.hocon.Array 14 | 15 | /** 16 | * Customization of the default outline structure. 17 | * 18 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#outline 19 | */ 20 | class HoconOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider { 21 | 22 | override protected _createChildren(DocumentRootNode parentNode, EObject modelElement) { 23 | super._createChildren(parentNode, modelElement) 24 | } 25 | 26 | def protected _isLeaf(Literal modelElement) { 27 | if (modelElement.simpleLiterals instanceof EString) 28 | true 29 | else 30 | super._isLeaf(modelElement) 31 | } 32 | 33 | override protected _createChildren(IOutlineNode parentNode, EObject modelElement) { 34 | switch modelElement { 35 | Member : 36 | switch v: modelElement.memberValue { 37 | EString: {} 38 | Array: 39 | super._createChildren(parentNode, v.arrayValues.get(0)) 40 | Object: 41 | super._createChildren(parentNode, v) 42 | } 43 | default: super._createChildren(parentNode, modelElement) 44 | } 45 | // if (modelElement instanceof Member) { 46 | // val member = modelElement as Member 47 | // if (!(member.value instanceof EString)) 48 | // _createChildren(parentNode, (modelElement as Member).value) 49 | // else {} 50 | // } else { 51 | // super._createChildren(parentNode, modelElement) 52 | // } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /com.typesafe.hocon.ui/src/com/typesafe/config/ui/quickfix/HoconQuickfixProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.ui.quickfix 5 | 6 | //import org.eclipse.xtext.ui.editor.quickfix.Fix 7 | //import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor 8 | //import org.eclipse.xtext.validation.Issue 9 | 10 | /** 11 | * Custom quickfixes. 12 | * 13 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#quick-fixes 14 | */ 15 | class HoconQuickfixProvider extends org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider { 16 | 17 | // @Fix(MyDslValidator::INVALID_NAME) 18 | // def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) { 19 | // acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [ 20 | // context | 21 | // val xtextDocument = context.xtextDocument 22 | // val firstLetter = xtextDocument.get(issue.offset, 1) 23 | // xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase) 24 | // ] 25 | // } 26 | } 27 | -------------------------------------------------------------------------------- /com.typesafe.hocon.updatesite/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.typesafe.hocon.updatesite/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | ../com.typesafe.hocon.releng/pom.xml 7 | com.typesafe.hocon 8 | parent 9 | 1.0.7-SNAPSHOT 10 | 11 | 12 | com.typesafe.hocon.updatesite 13 | eclipse-repository 14 | 15 | Typesafe Config Update Site 16 | 17 | 18 | 19 | 20 | org.eclipse.tycho 21 | tycho-p2-director-plugin 22 | ${tycho-version} 23 | 24 | 25 | materialize-products 26 | 27 | materialize-products 28 | 29 | 30 | 31 | archive-products 32 | 33 | archive-products 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /com.typesafe.hocon/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /com.typesafe.hocon/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.typesafe.hocon 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.xtext.ui.shared.xtextBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.xtext.ui.shared.xtextNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /com.typesafe.hocon/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: com.typesafe.hocon 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.7.qualifier 6 | Bundle-SymbolicName: com.typesafe.hocon;singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: org.eclipse.xtext;visibility:=reexport, 9 | org.eclipse.equinox.common;bundle-version="3.5.0", 10 | org.eclipse.xtext.util, 11 | org.eclipse.emf.ecore, 12 | org.eclipse.emf.common, 13 | org.eclipse.xtext.xbase.lib, 14 | org.antlr.runtime, 15 | org.eclipse.xtext.common.types;bundle-version="[2.8,3.0)", 16 | org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional 17 | Import-Package: org.apache.log4j 18 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 19 | Export-Package: com.typesafe.config, 20 | com.typesafe.config.services, 21 | com.typesafe.config.hocon, 22 | com.typesafe.config.hocon.impl, 23 | com.typesafe.config.hocon.util, 24 | com.typesafe.config.serializer, 25 | com.typesafe.config.parser.antlr, 26 | com.typesafe.config.parser.antlr.internal, 27 | com.typesafe.config.validation, 28 | com.typesafe.config.scoping, 29 | com.typesafe.config.generator, 30 | com.typesafe.config.formatting 31 | -------------------------------------------------------------------------------- /com.typesafe.hocon/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = model/,\ 5 | META-INF/,\ 6 | .,\ 7 | plugin.xml 8 | additional.bundles = org.eclipse.xtext.xbase,\ 9 | org.eclipse.xtext.generator,\ 10 | org.apache.commons.logging,\ 11 | org.eclipse.emf.codegen.ecore,\ 12 | org.eclipse.emf.mwe.utils,\ 13 | org.eclipse.emf.mwe2.launch,\ 14 | org.eclipse.xtext.common.types,\ 15 | org.objectweb.asm -------------------------------------------------------------------------------- /com.typesafe.hocon/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.typesafe.hocon/plugin.xml_gen: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.typesafe.hocon/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | ../com.typesafe.hocon.releng/pom.xml 7 | com.typesafe.hocon 8 | parent 9 | 1.0.7-SNAPSHOT 10 | 11 | 12 | com.typesafe.hocon 13 | eclipse-plugin 14 | 15 | Typesafe Config Core 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-clean-plugin 22 | 23 | 24 | gen-clean 25 | clean 26 | 27 | 28 | 29 | 30 | ${basedir}/src-gen/ 31 | 32 | 33 | ${basedir}/model/generated/ 34 | 35 | 36 | ${basedir}/../${project.artifactId}.ui/src-gen/ 37 | 38 | 39 | ${basedir}/../${project.artifactId}.tests/src-gen/ 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.codehaus.mojo 49 | exec-maven-plugin 50 | 1.2.1 51 | 52 | 53 | generate-sources 54 | 55 | java 56 | 57 | 58 | 59 | 60 | false 61 | true 62 | org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher 63 | 64 | file://${project.basedir}/src/com/typesafe/config/GenerateHocon.mwe2 65 | 66 | -p 67 | 68 | 69 | runtimeProject=/${project.basedir} 70 | 71 | 72 | 73 | 74 | 75 | org.eclipse.xtext 76 | org.eclipse.xtext.xtext 77 | ${xtext.version} 78 | 79 | 80 | org.eclipse.xtext 81 | org.eclipse.xtext.xbase 82 | ${xtext.version} 83 | 84 | 85 | org.eclipse.equinox 86 | common 87 | 3.6.200-v20130402-1505 88 | 89 | 90 | 91 | 92 | org.eclipse.xtend 93 | xtend-maven-plugin 94 | 95 | 96 | 97 | 98 | 100 | 101 | org.eclipse.m2e 102 | lifecycle-mapping 103 | 1.0.0 104 | 105 | 106 | 107 | 108 | 109 | 110 | org.codehaus.mojo 111 | 112 | 113 | exec-maven-plugin 114 | 115 | 116 | [1.2.1,) 117 | 118 | 119 | java 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/GenerateHocon.mwe2: -------------------------------------------------------------------------------- 1 | module com.typesafe.config.GenerateHocon 2 | 3 | import org.eclipse.emf.mwe.utils.* 4 | import org.eclipse.xtext.generator.* 5 | import org.eclipse.xtext.ui.generator.* 6 | 7 | var projectName = "com.typesafe.hocon" 8 | 9 | // grammarURI has to be platform:/resource as it is not on the classpath 10 | var grammarURI = "platform:/resource/${projectName}/src/com/typesafe/config/Hocon.xtext" 11 | var fileExtensions = "conf" 12 | var runtimeProject = "../${projectName}" 13 | var generateXtendStub = true 14 | var encoding = "UTF-8" 15 | 16 | Workflow { 17 | bean = StandaloneSetup { 18 | // use an XtextResourceset throughout the process, which is able to resolve classpath:/ URIs. 19 | resourceSet = org.eclipse.xtext.resource.XtextResourceSet:theResourceSet {} 20 | 21 | // add mappings from platform:/resource to classpath:/ 22 | uriMap = { 23 | from = "platform:/resource/org.eclipse.xtext.xbase/" 24 | to = "classpath:/" 25 | } 26 | uriMap = { 27 | from = "platform:/resource/org.eclipse.xtext.common.types/" 28 | to = "classpath:/" 29 | } 30 | 31 | // register current projects and its siblings for platform URI map, as they are not on the classpath. 32 | platformUri = "${runtimeProject}/.." 33 | 34 | scanClassPath = true 35 | // The following two lines can be removed, if Xbase is not used. 36 | registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage" 37 | registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel" 38 | } 39 | 40 | component = DirectoryCleaner { 41 | directory = "${runtimeProject}/src-gen" 42 | } 43 | 44 | component = DirectoryCleaner { 45 | directory = "${runtimeProject}/model/generated" 46 | } 47 | 48 | component = DirectoryCleaner { 49 | directory = "${runtimeProject}.ui/src-gen" 50 | } 51 | 52 | component = DirectoryCleaner { 53 | directory = "${runtimeProject}.tests/src-gen" 54 | } 55 | 56 | component = Generator { 57 | pathRtProject = runtimeProject 58 | pathUiProject = "${runtimeProject}.ui" 59 | pathTestProject = "${runtimeProject}.tests" 60 | projectNameRt = projectName 61 | projectNameUi = "${projectName}.ui" 62 | encoding = encoding 63 | language = auto-inject { 64 | // make sure we use the resourceSet created during standalone setup. 65 | forcedResourceSet = theResourceSet 66 | 67 | uri = grammarURI 68 | 69 | // Java API to access grammar elements (required by several other fragments) 70 | fragment = grammarAccess.GrammarAccessFragment auto-inject {} 71 | 72 | // generates Java API for the generated EPackages 73 | fragment = ecore.EMFGeneratorFragment auto-inject { 74 | javaModelDirectory = "/${projectName}/src-gen" 75 | } 76 | 77 | // the old serialization component 78 | // fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {} 79 | 80 | // serializer 2.0 81 | fragment = serializer.SerializerFragment auto-inject { 82 | generateStub = false 83 | } 84 | 85 | // a custom ResourceFactory for use with EMF 86 | fragment = resourceFactory.ResourceFactoryFragment auto-inject {} 87 | 88 | // The antlr parser generator fragment. 89 | fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject { 90 | // options = { 91 | // backtrack = true 92 | // } 93 | } 94 | 95 | // Xtend-based API for validation 96 | fragment = validation.ValidatorFragment auto-inject { 97 | // composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" 98 | // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 99 | } 100 | 101 | // old scoping and exporting API 102 | // fragment = scoping.ImportURIScopingFragment auto-inject {} 103 | // fragment = exporting.SimpleNamesFragment auto-inject {} 104 | 105 | // scoping and exporting API 106 | fragment = scoping.ImportNamespacesScopingFragment auto-inject {} 107 | fragment = exporting.QualifiedNamesFragment auto-inject {} 108 | fragment = builder.BuilderIntegrationFragment auto-inject {} 109 | 110 | // generator API 111 | fragment = generator.GeneratorFragment auto-inject {} 112 | 113 | // formatter API 114 | fragment = formatting.FormatterFragment auto-inject {} 115 | 116 | // labeling API 117 | fragment = labeling.LabelProviderFragment auto-inject {} 118 | 119 | // outline API 120 | fragment = outline.OutlineTreeProviderFragment auto-inject {} 121 | fragment = outline.QuickOutlineFragment auto-inject {} 122 | 123 | // quickfix API 124 | fragment = quickfix.QuickfixProviderFragment auto-inject {} 125 | 126 | // content assist API 127 | fragment = contentAssist.ContentAssistFragment auto-inject {} 128 | 129 | // generates a more lightweight Antlr parser and lexer tailored for content assist 130 | fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {} 131 | 132 | // generates junit test support classes into Generator#pathTestProject 133 | fragment = junit.Junit4Fragment auto-inject {} 134 | 135 | // rename refactoring 136 | fragment = refactoring.RefactorElementNameFragment auto-inject {} 137 | 138 | // provides the necessary bindings for java types integration 139 | fragment = types.TypesGeneratorFragment auto-inject {} 140 | 141 | // generates the required bindings only if the grammar inherits from Xbase 142 | fragment = xbase.XbaseGeneratorFragment auto-inject {} 143 | 144 | // generates the required bindings only if the grammar inherits from Xtype 145 | fragment = xbase.XtypeGeneratorFragment auto-inject {} 146 | 147 | // provides a preference page for template proposals 148 | fragment = templates.CodetemplatesGeneratorFragment auto-inject {} 149 | 150 | // provides a compare view 151 | fragment = compare.CompareFragment auto-inject {} 152 | } 153 | } 154 | } 155 | 156 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/Hocon.xtext: -------------------------------------------------------------------------------- 1 | grammar com.typesafe.config.Hocon 2 | 3 | hidden (SL_COMMENT, ML_COMMENT, SPACE) 4 | 5 | import "http://www.eclipse.org/emf/2002/Ecore" as ecore 6 | 7 | generate hocon "http://www.typesafe.com/config/Hocon" 8 | 9 | Root: 10 | NL* 11 | ( 12 | Object 13 | | members += Member 14 | ( (',' | NL) NL* members += Member )* 15 | )? 16 | NL* 17 | ; 18 | 19 | Object: 20 | '{' NL* 21 | ( members+=Member ','? NL* )* 22 | '}'; 23 | 24 | 25 | Member: 26 | name = StringLiteral (':' NL* | '+'? '=' NL*)? memberValue=Literal 27 | ; 28 | 29 | Literal: 30 | (simpleLiterals += SimpleLiteral)+ | Object | (arrays += Array)+ ; 31 | 32 | SimpleLiteral returns EString: 33 | (StringLiteral | name = Boolean | Null | Number | Substitution) 34 | ; 35 | 36 | Array: 37 | ('[' NL* 38 | (arrayValues+=Literal) 39 | ((',' | NL) NL* arrayValues+=Literal)* 40 | NL* 41 | ']') | (arrayValues+=Substitution) | ( '[' NL* ']' ) 42 | ; 43 | 44 | Boolean: 45 | 'true' | 'false' | 'on' | 'off' 46 | ; 47 | 48 | Null: 49 | {Null} 'null'; 50 | 51 | 52 | StringLiteral returns EString: 53 | (name = STRING | name = UNQUOTED_STRING) 54 | ; 55 | 56 | Substitution returns EString: 57 | '${' ('?')? UNQUOTED_STRING '}' 58 | ; 59 | 60 | Number: 61 | '-'? INT ('.' INT)? (('E'|'e') '-'? INT)?; 62 | 63 | terminal INT returns ecore::EInt: ('0'..'9')+; 64 | 65 | terminal UNQUOTED_STRING: 66 | ( !(' ' | '\n' |'\t' | '\\' | '"' | '$' | 67 | '{' | '}' | '[' | ']' | ':' | '=' | 68 | '|' | '+' | '#' | '`' | '^' | '?' | 69 | '!' | '@' | '*' | '&' | '//'| ',' 70 | ) )+ 71 | ; 72 | 73 | terminal STRING : 74 | '"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'"') )* '"' | 75 | "'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|"'") )* "'" 76 | ; 77 | 78 | terminal ML_COMMENT : '/*' -> '*/'; 79 | // The single line comment won't include the EOL character at the end. That will be returned 80 | // as a separate NL token. This way comments can be used as separators at the end of a meaningful 81 | // line, like # this is a comment that separates two members 82 | terminal SL_COMMENT : ('//'|'#') !('\n'|'\r')*; 83 | 84 | terminal SPACE: 85 | (' ' | '\t')+ 86 | ; 87 | 88 | terminal NL: 89 | ('\r'|'\n')+ 90 | ; 91 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/HoconRuntimeModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config; 5 | 6 | /** 7 | * Use this class to register components to be used at runtime / without the Equinox extension registry. 8 | */ 9 | public class HoconRuntimeModule extends com.typesafe.config.AbstractHoconRuntimeModule { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/HoconStandaloneSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config; 5 | 6 | /** 7 | * Initialization support for running Xtext languages 8 | * without equinox extension registry 9 | */ 10 | public class HoconStandaloneSetup extends HoconStandaloneSetupGenerated{ 11 | 12 | public static void doSetup() { 13 | new HoconStandaloneSetup().createInjectorAndDoEMFRegistration(); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/formatting/HoconFormatter.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.formatting 5 | 6 | import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter 7 | import org.eclipse.xtext.formatting.impl.FormattingConfig 8 | // import com.google.inject.Inject; 9 | // import com.typesafe.config.services.HoconGrammarAccess 10 | 11 | /** 12 | * This class contains custom formatting declarations. 13 | * 14 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#formatting 15 | * on how and when to use it. 16 | * 17 | * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example 18 | */ 19 | class HoconFormatter extends AbstractDeclarativeFormatter { 20 | 21 | // @Inject extension HoconGrammarAccess 22 | 23 | override protected void configureFormatting(FormattingConfig c) { 24 | // It's usually a good idea to activate the following three statements. 25 | // They will add and preserve newlines around comments 26 | // c.setLinewrap(0, 1, 2).before(SL_COMMENTRule) 27 | // c.setLinewrap(0, 1, 2).before(ML_COMMENTRule) 28 | // c.setLinewrap(0, 1, 1).after(ML_COMMENTRule) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/generator/HoconGenerator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.generator 5 | 6 | import org.eclipse.emf.ecore.resource.Resource 7 | import org.eclipse.xtext.generator.IGenerator 8 | import org.eclipse.xtext.generator.IFileSystemAccess 9 | 10 | /** 11 | * Generates code from your model files on save. 12 | * 13 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation 14 | */ 15 | class HoconGenerator implements IGenerator { 16 | 17 | override void doGenerate(Resource resource, IFileSystemAccess fsa) { 18 | // fsa.generateFile('greetings.txt', 'People to greet: ' + 19 | // resource.allContents 20 | // .filter(typeof(Greeting)) 21 | // .map[name] 22 | // .join(', ')) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/scoping/HoconScopeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.scoping 5 | 6 | /** 7 | * This class contains custom scoping description. 8 | * 9 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping 10 | * on how and when to use it. 11 | * 12 | */ 13 | class HoconScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.typesafe.hocon/src/com/typesafe/config/validation/HoconValidator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package com.typesafe.config.validation 5 | 6 | //import org.eclipse.xtext.validation.Check 7 | 8 | /** 9 | * This class contains custom validation rules. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation 12 | */ 13 | class HoconValidator extends AbstractHoconValidator { 14 | 15 | // public static val INVALID_NAME = 'invalidName' 16 | // 17 | // @Check 18 | // def checkGreetingStartsWithCapital(Greeting greeting) { 19 | // if (!Character.isUpperCase(greeting.name.charAt(0))) { 20 | // warning('Name should start with a capital', 21 | // MyDslPackage.Literals.GREETING__NAME, 22 | // INVALID_NAME) 23 | // } 24 | // } 25 | } 26 | -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragos/typesafe-config-eclipse/ad3eb11fa338686e0aa028d2d13d0b3aa35fbf41/images/screenshot.png -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 2 ]; then 4 | echo "Usage: ./publish.sh " 5 | exit 1 6 | fi 7 | 8 | ./pushToBintray.sh dragos $1 dragos typesafe-config-eclipse typesafe-config-eclipse $2 com.typesafe.hocon.updatesite/target/repository 9 | -------------------------------------------------------------------------------- /pushToBintray.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Sample Usage: pushToBintray.sh username apikey owner repo package version pathToP2Repo 4 | 5 | # 6 | # Taken from https://github.com/vogellacompany/bintray-publish-p2-updatesite/ 7 | # 8 | 9 | 10 | API=https://api.bintray.com 11 | BINTRAY_USER=$1 12 | BINTRAY_API_KEY=$2 13 | BINTRAY_OWNER=$3 14 | BINTRAY_REPO=$4 15 | PCK_NAME=$5 16 | PCK_VERSION=$6 17 | PATH_TO_REPOSITORY=$7 18 | 19 | function main() { 20 | deploy_updatesite 21 | } 22 | 23 | function deploy_updatesite() { 24 | echo "${BINTRAY_USER}" 25 | echo "${BINTRAY_API_KEY}" 26 | echo "${BINTRAY_OWNER}" 27 | echo "${BINTRAY_REPO}" 28 | echo "${PCK_NAME}" 29 | echo "${PCK_VERSION}" 30 | echo "${PATH_TO_REPOSITORY}" 31 | 32 | if [ ! -z "$PATH_TO_REPOSITORY" ]; then 33 | cd $PATH_TO_REPOSITORY 34 | fi 35 | 36 | 37 | FILES=./* 38 | BINARYDIR=./binary/* 39 | PLUGINDIR=./plugins/* 40 | FEATUREDIR=./features/* 41 | 42 | for f in $FILES; 43 | do 44 | if [ ! -d $f ]; then 45 | echo "Processing $f file..." 46 | if [[ "$f" == *content.jar ]] || [[ "$f" == *artifacts.jar ]] 47 | then 48 | echo "Uploading p2 metadata file directly to the repository" 49 | curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/$f;publish=0 50 | else 51 | curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0 52 | fi 53 | echo "" 54 | fi 55 | done 56 | 57 | echo "Processing features dir $FEATUREDIR file..." 58 | for f in $FEATUREDIR; 59 | do 60 | echo "Processing feature: $f file..." 61 | curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0 62 | echo "" 63 | done 64 | 65 | echo "Processing plugin dir $PLUGINDIR file..." 66 | 67 | for f in $PLUGINDIR; 68 | do 69 | # take action on each file. $f store current file name 70 | echo "Processing plugin: $f file..." 71 | curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0 72 | echo "" 73 | done 74 | 75 | echo "Processing binary dir $BINARYDIR file..." 76 | for f in $BINARYDIR; 77 | do 78 | # take action on each file. $f store current file name 79 | echo "Processing binary: $f file..." 80 | curl -X PUT -T $f -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/$f;publish=0 81 | echo "" 82 | done 83 | 84 | 85 | 86 | 87 | echo "Publishing the new version" 88 | curl -X POST -u ${BINTRAY_USER}:${BINTRAY_API_KEY} https://api.bintray.com/content/${BINTRAY_OWNER}/${BINTRAY_REPO}/${PCK_NAME}/${PCK_VERSION}/publish -d "{ \"discard\": \"false\" }" 89 | 90 | } 91 | 92 | 93 | main "$@" --------------------------------------------------------------------------------