Added html documentation
authorJakub Nesveda <jakubnesveda@seznam.cz>
Sun, 08 Feb 2015 20:36:46 +0100
changeset 820 899b9a25d0c6
parent 819 796b50c1bb64
child 821 ce462903d43b
Added html documentation
docs/online/README.txt
docs/online/english/programming/refactoring_custom-getting-started.html
docs/online/english/programming/refactoring_custom-installation.html
docs/online/english/programming/refactoring_custom.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/online/README.txt	Sun Feb 08 20:36:46 2015 +0100
@@ -0,0 +1,3 @@
+This directory contains html documentation which
+is inpired by Smalltalk/X 'online' docs found here
+  http://live.exept.de/doc/online/english/TOP.html
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/online/english/programming/refactoring_custom-getting-started.html	Sun Feb 08 20:36:46 2015 +0100
@@ -0,0 +1,149 @@
+<HTML>
+
+<HEAD>
+<TITLE>Smalltalk/X Programmers guide - API for custom code generators and refactorings - getting started</Title>
+</HEAD>
+
+<BODY>
+
+<A NOPRINT HREF="refactoring_custom-installation.html">   <IMG SRC="../../icons/DocsLeftArrow.gif" ALT="[prev]"></A>
+<A NOPRINT HREF="refactoring_custom.html">   <IMG SRC="../../icons/DocsUpArrow.gif" ALT="[up]"></A>
+<A NOPRINT HREF="#">  <IMG SRC="../../icons/DocsRightArrow.gif" ALT="[next]"></A>
+
+<H1>API for custom code generators and refactorings - getting started</H1>
+
+<p>
+This page describes how to create new code generator class.
+Further documentation can be found inside classes and methods comments.
+Existing code generator/refactoring classes has class (static) method "description"
+which should reveal the class purpose.
+</p>
+
+
+<h2>How to create new code generator class</h2>
+
+<p>
+Right-click somewhere in the class list within system browser and click
+on "Generate - Custom -&gt; New Code Generator". Insert some class name
+and click on Ok button. Now you should have new class created with generated
+method stubs containg "self shouldImplement".
+</p> 
+
+<h2>Implement required methods</h2>
+
+<p>
+Here we show a few examples how required methods can be implemented.
+Each method has documentation comment which describes its purpose.
+</p>
+
+<h3>Class (static) methods</h3>
+
+<pre class="code-snippet">
+label
+    "Returns show label describing the receiver. This label
+     is used in UI as menu item/tree item label."
+
+    ^ 'Mark class as abstract'
+    
+description
+    "Returns more detailed description of the receiver"
+
+    ^ 'Mark class as abstract (by implementing class method #isAbstract)'
+
+availableInContext:aCustomContext
+    "Returns true if the generator/refactoring is available in given
+     context, false otherwise.
+     
+     Called by the UI to figure out what generators / refactorings
+     are available at given point. See class CustomContext for details."
+
+    ^ aCustomContext selectedClasses notEmptyOrNil
+
+availableInPerspective:aCustomPerspective
+    "Returns true if the generator/refactoring is available in given
+     perspective, false otherwise.
+     
+     Called by the UI to figure out what generators / refactorings
+     to show"
+
+    "Allows to locate generator in class/method/package/... context sub-menu.
+    See class CustomPerspective and its subclasses."
+    ^ aCustomPerspective isClassPerspective
+</pre>
+
+<h3>Instance methods</h3>
+
+<pre class="code-snippet">
+buildInContext: aCustomContext
+    "Creates a method isAbstract for selected classes"
+    
+    | classes |
+
+    classes := aCustomContext selectedClasses.
+    classes do: [ :class |
+        | metaclass className |
+
+        metaclass := class theMetaclass.
+        className := class theNonMetaclass name.
+
+        (metaclass includesSelector: #isAbstract) ifFalse:[  
+            self compile: ('isAbstract
+    ^ self == %1' bindWith: className) forClass: metaclass inCategory: 'testing'
+        ].   
+    ]
+    
+configureInContext:aCustomContext
+    "Optional method which is called only in interactive mode.
+    Allows to open the dialog-box in which an user can enter custom values.
+    This particular dialog asks for test method name."
+
+    aCustomContext selectedMethods do:[:selectedMethod |
+        | selector |
+
+        selector := selectedMethod selector asSymbol.
+        (testMethodSelectors includesKey: selector) ifFalse: [ 
+            testMethodSelectors 
+                at: selector 
+                put: (self createTestMethodSelectorFor: selector).
+        ].
+
+        dialog 
+            addSelectorNameEntryOn:(DictionaryAdaptor new
+                                        subject:testMethodSelectors; 
+                                        aspect:selector)
+            labeled:selector asString
+            validateBy:nil.
+    ].
+
+    dialog addButtons.
+    dialog open.
+</pre>
+
+<h2>How to create new refactoring class</h2>
+
+<p>
+The process is same as described for code generator class, but you need to
+select "Generate -&gt; New Refactoring" in context menu instead.
+Code example below uses code expression replacements which is
+well documented in
+<a href="http://live.exept.de/doc/online/english/help/Browser/RBSearchPatterns.html">Code Search Patterns</a>.
+</p>
+
+<pre class="code-snippet">
+buildInContext: aCustomContext
+    "Performs a refactoring within given context scope.
+    This code replaces selected code in code editor with
+    translation call."
+
+    refactoryBuilder 
+          replace:'`@expression'
+          with:'(resources string: (`@expression))'
+          inContext:aCustomContext
+</pre>
+
+<HR>
+<P>
+<IMG NOPRINT ALIGN=middle SRC="../../icons/stx.gif">
+
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/online/english/programming/refactoring_custom-installation.html	Sun Feb 08 20:36:46 2015 +0100
@@ -0,0 +1,78 @@
+<HTML>
+
+<HEAD>
+<TITLE>Smalltalk/X Programmers guide - API for custom code generators and refactorings - installation</TITLE>
+</HEAD>
+
+<BODY>
+
+<A NOPRINT HREF="refactoring_custom.html">   <IMG SRC="../../icons/DocsLeftArrow.gif" ALT="[prev]"></A>
+<A NOPRINT HREF="refactoring_custom.html">   <IMG SRC="../../icons/DocsUpArrow.gif" ALT="[up]"></A>
+<A NOPRINT HREF="refactoring_custom-getting-started.html">  <IMG SRC="../../icons/DocsRightArrow.gif" ALT="[next]"></A>
+
+<H1>API for custom code generators and refactorings - installation</H1>
+
+<h2>Requirements</h2>
+
+<p>
+<b>1. Smalltalk/X</b><br>
+You need recent <a href="http://swing.fit.cvut.cz/projects/stx-goodies/wiki/SmalltalkX">Smalltalk/X jv-branch</a> downloaded and 
+installed on your computer. Package is not tested and maintained on official eXept
+Smalltalk/X distribution downloaded from <a href="http://www.exept.de">http://www.exept.de</a>.
+</p>
+
+<p>
+<b>2. Package source files</b><br>
+
+You need to download package from Bitbucket repository
+<a href="https://bitbucket.org/jnesveda/refactoring_custom">jnesveda/refactoring_custom</a>.
+You can download it via
+<a href="http://mercurial.selenic.com/">Mercurial</a>
+command "hg clone url/from/the/link/above" or by clicking on cloud icon in the
+left bar titled with "Downloads".
+</p>
+
+<h2>Installation</h2>
+
+<p>
+Add downloaded source files to folder named "jn/refactoring_custom" which needs
+to be located under your package path (easiest is to put it just in lib/smalltalkx/6.2.5/packages
+where 6.2.5 is STX version). Now run STX, open system browser and click on
+top menu items named "View -&gt; Package". You should see new package named
+jn/refactoring_custom. Right-click on it and select "Load".
+<pre class="code-snippet">
+"To see whats you package path write following line somewhere in STX
+(code editor,launcher text-box), select it, rigt-click and choose Inspect."
+Smalltalk packagePath.
+"This will add a folder as package path"
+Smalltalk packagePath add: 'C:\path\to\your\packages'.
+</pre>
+</p>
+
+<p>
+If everything went well then you can select some class in the system browser,
+right-click on it and now you should see 2 new menu items "Refactor - Custom",
+"Generate - Custom". However, many troubles can happen during package loading.
+Subpackage "patches" has to also properly loaded, but can happen that it wont
+load with described procedure. There are many other possibilities how to load
+classes. You can try one of these if regular way fails (you will see classes marked
+as unloaded or you wont see them):
+<ul>
+	<li>Load classes one-by-one by double clicking on them</li>
+	<li>Click on View -&gt; Category in the system browser, select category,
+	right-click on it and click on "Special -&gt; Load"</li>
+	<li>Open file browser, locate the source files, select them, right-click
+	on it and click on FileIn</li>
+</ul>
+Finally you can run tests using test runner from launcher to see if everything
+works as expected. You can check the test results against the newest STX-JV branch version
+in <a href="https://swing.fit.cvut.cz/jenkins/job/custom_refactorings_reports/">Jenkins job</a>,
+but this will be most probably removed when this project will be outdated.
+</p>
+
+<HR>
+<P>
+<IMG NOPRINT ALIGN=middle SRC="../../icons/stx.gif">
+
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/online/english/programming/refactoring_custom.html	Sun Feb 08 20:36:46 2015 +0100
@@ -0,0 +1,48 @@
+<HTML>
+
+<HEAD>
+<TITLE>Smalltalk/X Programmers guide - API for custom code generators and refactorings</TITLE>
+</HEAD>
+
+<BODY>
+
+<A NOPRINT HREF="tdv.html">     <IMG SRC="../../icons/DocsLeftArrow.gif" ALT="[prev]"></A>
+<A NOPRINT HREF="TOP.html">   <IMG SRC="../../icons/DocsUpArrow.gif" ALT="[up]"></A>
+<A NOPRINT HREF="refactoring_custom-installation.html">   <IMG SRC="../../icons/DocsRightArrow.gif" ALT="[next]"></A>
+
+<H1>API for custom code generators and refactorings</H1>
+
+<H2>Overview</H2>
+
+<p>
+API for programmers who would like to create their own code generators
+or refactorings in Smalltalk/X environment. This API is intended to be
+more user-friendly than existing possibilities in STX version 6.2.5 .
+The documentation here is not very detailed and further reading can be
+found in <A HREF="https://bitbucket.org/jnesveda/refactoring_custom_thesis">bachelor's thesis text</A>
+(BP_Nesveda_Jakub_2015.pdf), especially chapter "API in a nutshell" describes
+how to write code generators or refactoring.
+</p>
+
+<H2>Contents</H2>
+
+<OL>
+    <LI><A HREF="refactoring_custom-installation.html">Installation</A></LI>
+    <LI><A HREF="refactoring_custom-getting-started.html">Getting started</A></LI>
+</OL>
+
+<H2>Origin/Authors</H2>
+Authors:
+<BR>
+<UL>
+  <LI>Jan Vrany (eXept, SWING Research Group, Czech Technical University in Prague)</LI>
+  <LI>Jakub Nesveda (Czech Technical University in Prague, Faculty of Information Technology, Department of Software Engineering)</LI>
+</UL>
+
+<HR>
+<P>
+<IMG NOPRINT ALIGN=middle SRC="../../icons/stx.gif">
+
+
+</BODY>
+</HTML>