Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-06-04 17:47:30 +0000
committerEric Williams2019-06-10 17:24:11 +0000
commit641d7ea7e7a4137c53b7d08adfc360cc4f6aa69f (patch)
tree6df471ec5be9f66e07eae2c309d071d4d601f0c8
parenta4938743e4a8061dce698d5f6c3850bb2a4930c7 (diff)
downloadeclipse.platform.swt-641d7ea7e7a4137c53b7d08adfc360cc4f6aa69f.tar.gz
eclipse.platform.swt-641d7ea7e7a4137c53b7d08adfc360cc4f6aa69f.tar.xz
eclipse.platform.swt-641d7ea7e7a4137c53b7d08adfc360cc4f6aa69f.zip
Bug 547938 - [Snippets] Add recommendations to Snippet Readme
Change-Id: I72e8edb930817c26f9b010d331691f3fe54c5624 Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--examples/org.eclipse.swt.snippets/Readme.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/Readme.md b/examples/org.eclipse.swt.snippets/Readme.md
index 81ec1e1dd8..2ee17fd79a 100644
--- a/examples/org.eclipse.swt.snippets/Readme.md
+++ b/examples/org.eclipse.swt.snippets/Readme.md
@@ -16,3 +16,22 @@ For this, rename one of the following files to `.classpath`:
To see these files, you may have to remove the filter for ".* resources":
* In the Project Explorer: view menu > Customize View... > Filters
* In the Package Explorer: view menu > Filters...
+
+
+Tips for writing Snippets:
+--------------------------
+
+* Every Snippet should set a window title (`Shell#setText(title)`) even if it's only a generic "Snippet &lt;number&gt;".
+* Snippets should never use `System.exit()`. This can interfere the operation of SnippetLauncher or SnippetExplorer.
+* Snippets should always use `new Display()` to create the display and not create `Display` or `Shell` in a static initializer.
+ This can interfere the operation of SnippetExplorer and sometimes SnippetLauncher. Especially the SnippetExplorer can run
+ Snippets multiple times without reloading the Snippet class. A static initialized shell is disposed after the first run and
+ might not reinitialized on following launches.
+* If a Snippet is started through SnippetLauncher or SnippetExplorer there is no guarantee a thread started with `setDaemon(true)`
+ is stopped immediately when the Snippet ends. At best a Snippet stops all threads on exit.
+* To find the new Snippet easily you should add it to the SWT Snippet website.
+ * Website: https://www.eclipse.org/swt/snippets/
+ * Source: https://git.eclipse.org/c/www.eclipse.org/swt.git/tree/snippets/index.php
+* If appropriate create a preview image for the Snippet. (used by SnippetExplorer and on the Snippet website)
+* The Snippet explanation comment should not be placed above the imports (as many existing Snippets do). Eclipse's organize
+ imports feature may place new imports above the comment and therefore hide the explanation when imports are collapsed.

Back to the top