Bug 535380 - Provide a target platform for each example
diff --git a/org.eclipse.handly.examples.adapter/README b/org.eclipse.handly.examples.adapter/README.md
similarity index 96%
rename from org.eclipse.handly.examples.adapter/README
rename to org.eclipse.handly.examples.adapter/README.md
index 6c85514..df1aff8 100644
--- a/org.eclipse.handly.examples.adapter/README
+++ b/org.eclipse.handly.examples.adapter/README.md
@@ -7,7 +7,7 @@
 The adapter model is then used to implement an outline page for the Java editor.
 Notably, the Handly-based outline page re-uses content- and label providers
 supplied by JDT. This is made possible by the model adaptation facility
-(https://bugs.eclipse.org/472840).
+(<https://bugs.eclipse.org/472840>).
 
 To try it out, launch runtime Eclipse, open a Java compilation unit with the
 "Java Editor (Handly Adapter Example)", and play with the outline.
diff --git a/org.eclipse.handly.examples.adapter/build.properties b/org.eclipse.handly.examples.adapter/build.properties
index c2c8fa2..3c9373a 100644
--- a/org.eclipse.handly.examples.adapter/build.properties
+++ b/org.eclipse.handly.examples.adapter/build.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2015 1C-Soft LLC.
+# Copyright (c) 2015, 2018 1C-Soft LLC.
 #
 # This program and the accompanying materials are made available under
 # the terms of the Eclipse Public License 2.0 which is available at
@@ -18,5 +18,5 @@
                plugin.xml,\
                plugin.properties,\
                about.html,\
-               README
+               README.md
 src.includes = about.html
diff --git a/org.eclipse.handly.examples.adapter/example.target b/org.eclipse.handly.examples.adapter/example.target
new file mode 100644
index 0000000..4f37962
--- /dev/null
+++ b/org.eclipse.handly.examples.adapter/example.target
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+   Copyright (c) 2018 1C-Soft LLC.
+
+   This program and the accompanying materials are made available under
+   the terms of the Eclipse Public License 2.0 which is available at
+   https://www.eclipse.org/legal/epl-2.0/
+
+   SPDX-License-Identifier: EPL-2.0
+
+   Contributors:
+       Vladimir Piskarev (1C) - initial API and implementation
+-->
+<?pde version="3.8"?>
+<target name="Adapter Example">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/releases/photon"/>
+<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/handly/releases/1.0/repository"/>
+<unit id="org.eclipse.handly.ui" version="0.0.0"/>
+<unit id="org.eclipse.handly.junit" version="0.0.0"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.handly.examples.basic.ui/plugin.xml b/org.eclipse.handly.examples.basic.ui/plugin.xml
index 1df79f9..203df99 100644
--- a/org.eclipse.handly.examples.basic.ui/plugin.xml
+++ b/org.eclipse.handly.examples.basic.ui/plugin.xml
@@ -95,6 +95,10 @@
 
    <extension
          point="org.eclipse.ui.views">
+      <category
+            id="org.eclipse.handly.examples"
+            name="Handly Examples">
+      </category>
       <view
             id="org.eclipse.handly.examples.basic.ui.views.fooNavigator"
             name="Foo Navigator"
diff --git a/org.eclipse.handly.examples.basic/README b/org.eclipse.handly.examples.basic/README.md
similarity index 98%
rename from org.eclipse.handly.examples.basic/README
rename to org.eclipse.handly.examples.basic/README.md
index 2eb95f9..9188b4e 100644
--- a/org.eclipse.handly.examples.basic/README
+++ b/org.eclipse.handly.examples.basic/README.md
@@ -13,11 +13,13 @@
 must have the `.foo` extension. For example, create the `Module1.foo` file 
 with the following contents:
 
+```
 var x;
 var y;
 def f() {}
 def f(x) {}
 def f(x, y) {}
+```
 
 Play with the Handly-based Outline view a little.
 
diff --git a/org.eclipse.handly.examples.basic/build.properties b/org.eclipse.handly.examples.basic/build.properties
index fbd6072..009ab5b 100644
--- a/org.eclipse.handly.examples.basic/build.properties
+++ b/org.eclipse.handly.examples.basic/build.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2014 1C LLC.
+# Copyright (c) 2014, 2018 1C-Soft LLC and others.
 #
 # This program and the accompanying materials are made available under
 # the terms of the Eclipse Public License 2.0 which is available at
@@ -20,5 +20,5 @@
                plugin.xml,\
                plugin.properties,\
                about.html,\
-               README
+               README.md
 src.includes = about.html
diff --git a/org.eclipse.handly.examples.basic/example.p2f b/org.eclipse.handly.examples.basic/example.p2f
new file mode 100644
index 0000000..de78ad5
--- /dev/null
+++ b/org.eclipse.handly.examples.basic/example.p2f
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+   Copyright (c) 2018 1C-Soft LLC.
+
+   This program and the accompanying materials are made available under
+   the terms of the Eclipse Public License 2.0 which is available at
+   https://www.eclipse.org/legal/epl-2.0/
+
+   SPDX-License-Identifier: EPL-2.0
+
+   Contributors:
+       Vladimir Piskarev (1C) - initial API and implementation
+-->
+<?p2f version='1.0.0'?>
+<p2f version='1.0.0'>
+  <ius size='1'>
+    <iu id='org.eclipse.xtext.sdk.feature.group' version='2.14.0.v20180523-0937'>
+      <repositories size='1'>
+        <repository location='http://download.eclipse.org/releases/photon'/>
+      </repositories>
+    </iu>
+  </ius>
+</p2f>
diff --git a/org.eclipse.handly.examples.basic/example.target b/org.eclipse.handly.examples.basic/example.target
new file mode 100644
index 0000000..6396493
--- /dev/null
+++ b/org.eclipse.handly.examples.basic/example.target
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+   Copyright (c) 2018 1C-Soft LLC.
+
+   This program and the accompanying materials are made available under
+   the terms of the Eclipse Public License 2.0 which is available at
+   https://www.eclipse.org/legal/epl-2.0/
+
+   SPDX-License-Identifier: EPL-2.0
+
+   Contributors:
+       Vladimir Piskarev (1C) - initial API and implementation
+-->
+<?pde version="3.8"?>
+<target name="Basic Example">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/releases/photon"/>
+<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/handly/releases/1.0/repository"/>
+<unit id="org.eclipse.handly.xtext.ui" version="0.0.0"/>
+<unit id="org.eclipse.handly.junit" version="0.0.0"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.handly.examples.jmodel.ui/plugin.xml b/org.eclipse.handly.examples.jmodel.ui/plugin.xml
index c350b21..d9146aa 100644
--- a/org.eclipse.handly.examples.jmodel.ui/plugin.xml
+++ b/org.eclipse.handly.examples.jmodel.ui/plugin.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-Copyright (c) 2015, 2017 Codasip Ltd and others.
+Copyright (c) 2015, 2018 Codasip Ltd and others.
 
 This program and the accompanying materials are made available under
 the terms of the Eclipse Public License 2.0 which is available at
@@ -16,10 +16,14 @@
 <plugin>
    <extension
          point="org.eclipse.ui.views">
+      <category
+            id="org.eclipse.handly.examples"
+            name="Handly Examples">
+      </category>
       <view
             id="org.eclipse.handly.examples.jmodel.ui.views.JavaNavigator"
             category="org.eclipse.handly.examples"
-            name="JNavigator (Handly)"
+            name="JNavigator"
             icon="icons/eview16/package.gif"
             class="org.eclipse.handly.internal.examples.jmodel.ui.navigator.JavaNavigator"
             restorable="true">
diff --git a/org.eclipse.handly.examples.jmodel/README b/org.eclipse.handly.examples.jmodel/README.md
similarity index 89%
rename from org.eclipse.handly.examples.jmodel/README
rename to org.eclipse.handly.examples.jmodel/README.md
index e72f43a..fff6fa2 100644
--- a/org.eclipse.handly.examples.jmodel/README
+++ b/org.eclipse.handly.examples.jmodel/README.md
@@ -7,7 +7,7 @@
 As one would expect from an example, the model is somewhat contrived.
 In particular:
 
-* Only classpath entries of kind CPE_SOURCE, with paths of length 1
+* Only classpath entries of kind `CPE_SOURCE`, with paths of length 1
 are considered (i.e. only source folders that are direct children
 of the project resource);
 
@@ -27,7 +27,7 @@
 
 * Example Java navigator view (kindly contributed by Ondrej Ilcik, Codasip).
 
-To try it out, launch runtime Eclipse and open the `JNavigator (Handly)` view (in
+To try it out, launch runtime Eclipse and open the `JNavigator` view (in
 the `Handly Examples` category). The view shows the elements of the underlying
 example model for Java. You can navigate the structure of the projects in your
 workspace down to types, methods, and fields in Java source files. Select
@@ -50,8 +50,8 @@
 and will be useful to Handly adopters. Feedback is most welcome
 and can be directed to the project's forum:
 
-    http://eclipse.org/forums/eclipse.handly
+- <http://eclipse.org/forums/eclipse.handly>
 
 or right to the developer mailing list:
 
-    https://dev.eclipse.org/mailman/listinfo/handly-dev
+- <https://dev.eclipse.org/mailman/listinfo/handly-dev>
diff --git a/org.eclipse.handly.examples.jmodel/build.properties b/org.eclipse.handly.examples.jmodel/build.properties
index 038cf31..3927828 100644
--- a/org.eclipse.handly.examples.jmodel/build.properties
+++ b/org.eclipse.handly.examples.jmodel/build.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2015 1C-Soft LLC.
+# Copyright (c) 2015, 2018 1C-Soft LLC.
 #
 # This program and the accompanying materials are made available under
 # the terms of the Eclipse Public License 2.0 which is available at
@@ -17,5 +17,5 @@
                .,\
                plugin.properties,\
                about.html,\
-               README
+               README.md
 src.includes = about.html
diff --git a/org.eclipse.handly.examples.jmodel/example.target b/org.eclipse.handly.examples.jmodel/example.target
new file mode 100644
index 0000000..b6192c7
--- /dev/null
+++ b/org.eclipse.handly.examples.jmodel/example.target
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+   Copyright (c) 2018 1C-Soft LLC.
+
+   This program and the accompanying materials are made available under
+   the terms of the Eclipse Public License 2.0 which is available at
+   https://www.eclipse.org/legal/epl-2.0/
+
+   SPDX-License-Identifier: EPL-2.0
+
+   Contributors:
+       Vladimir Piskarev (1C) - initial API and implementation
+-->
+<?pde version="3.8"?>
+<target name="JModel Example">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/releases/photon"/>
+<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/handly/releases/1.0/repository"/>
+<unit id="org.eclipse.handly.ui" version="0.0.0"/>
+<unit id="org.eclipse.handly.junit" version="0.0.0"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.handly.examples.lsp/README b/org.eclipse.handly.examples.lsp/README.md
similarity index 100%
rename from org.eclipse.handly.examples.lsp/README
rename to org.eclipse.handly.examples.lsp/README.md
diff --git a/org.eclipse.handly.examples.lsp/build.properties b/org.eclipse.handly.examples.lsp/build.properties
index 4ac241e..1d4592f 100644
--- a/org.eclipse.handly.examples.lsp/build.properties
+++ b/org.eclipse.handly.examples.lsp/build.properties
@@ -18,6 +18,6 @@
                plugin.xml,\
                plugin.properties,\
                about.html,\
-               README
+               README.md
 src.includes = about.html,\
                schema/
diff --git a/org.eclipse.handly.examples.lsp/example.target b/org.eclipse.handly.examples.lsp/example.target
new file mode 100644
index 0000000..0fb66b4
--- /dev/null
+++ b/org.eclipse.handly.examples.lsp/example.target
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+   Copyright (c) 2018 1C-Soft LLC.
+
+   This program and the accompanying materials are made available under
+   the terms of the Eclipse Public License 2.0 which is available at
+   https://www.eclipse.org/legal/epl-2.0/
+
+   SPDX-License-Identifier: EPL-2.0
+
+   Contributors:
+       Vladimir Piskarev (1C) - initial API and implementation
+-->
+<?pde version="3.8"?>
+<target name="LSP Example">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/releases/photon"/>
+<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/handly/releases/1.0/repository"/>
+<unit id="org.eclipse.handly.ui" version="0.0.0"/>
+<unit id="org.eclipse.handly.junit" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/lsp4j/updates/releases/0.3.1"/>
+<unit id="org.eclipse.lsp4j.jsonrpc" version="0.0.0"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+<repository location="http://download.eclipse.org/lsp4e/releases/0.4.0"/>
+<unit id="org.eclipse.lsp4e" version="0.0.0"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.handly.examples/README b/org.eclipse.handly.examples/README
deleted file mode 100644
index cab173e..0000000
--- a/org.eclipse.handly.examples/README
+++ /dev/null
@@ -1,21 +0,0 @@
-Handly Examples
-===============
-
-Some examples of Handly usage are provided in bundles under the 
-common `org.eclipse.handly.examples` namespace. Each example has its own 
-namespace (e.g., `o.e.handly.examples.basic`) and the corresponding 
-set of bundles. The root bundle for every example contains the 
-accompanying `README` file. There are predefined launch configurations
-for launching runtime Eclipse and plug-in tests.
-
-You might want to clone the project's Git repository and set up 
-a developer workspace to be able to play with the examples most 
-productively. Please see the project's Developer Resources for 
-information on setting things up.
-
-- https://projects.eclipse.org/projects/technology.handly/developer
-
-Another option is to materialize example projects in your workspace using
-wizards under the `Handly Examples` category. Make sure that you have the
-`org.eclipse.handly.examples` feature installed, then use `File -> New ->
-Example...` to select the appropriate wizard.
diff --git a/org.eclipse.handly.examples/README.md b/org.eclipse.handly.examples/README.md
new file mode 100644
index 0000000..26ceb89
--- /dev/null
+++ b/org.eclipse.handly.examples/README.md
@@ -0,0 +1,26 @@
+Handly Examples
+===============
+
+Some examples of Handly usage are provided in bundles under the 
+common `org.eclipse.handly.examples` namespace. Each example has its own 
+namespace (e.g., `o.e.handly.examples.basic`) and the corresponding 
+set of bundles. The root bundle for every example contains the 
+accompanying `README.md` file. There are predefined launch configurations
+for launching runtime Eclipse and plug-in tests.
+
+You might want to clone the project's Git repository and set up 
+a developer workspace to be able to play with the examples most 
+productively. Please see the project's Developer Resources for 
+information on setting things up.
+
+- <https://projects.eclipse.org/projects/technology.handly/developer>
+
+Another option is to materialize example projects in your workspace using
+wizards under the `Handly Examples` category. Make sure that you have the
+`org.eclipse.handly.examples` feature installed, then use `File -> New ->
+Example...` to select the appropriate wizard. The root project for every
+example contains the accompanying `example.target` file you can use to easily
+set a target platform for the example. Where necessary, the `example.p2f`
+file is also provided that describes software items you need to have installed
+in your IDE to be able to play with the example most productively. To install it,
+use `File -> Import... -> Install Software Items From File`.
diff --git a/org.eclipse.handly.examples/build.properties b/org.eclipse.handly.examples/build.properties
index a4f81f3..7368336 100644
--- a/org.eclipse.handly.examples/build.properties
+++ b/org.eclipse.handly.examples/build.properties
@@ -19,5 +19,5 @@
                about.html,\
                about.ini,\
                about.properties,\
-               README
+               README.md
 src.includes = about.html
diff --git a/org.eclipse.handly.examples/plugin.xml b/org.eclipse.handly.examples/plugin.xml
index 7fdccff..da01bbb 100644
--- a/org.eclipse.handly.examples/plugin.xml
+++ b/org.eclipse.handly.examples/plugin.xml
@@ -123,12 +123,4 @@
       </example>
    </extension>
 
-   <extension
-         point="org.eclipse.ui.views">
-      <category
-            id="org.eclipse.handly.examples"
-            name="Handly Examples">
-      </category>
-   </extension>
-
 </plugin>