Generate Wiki support.
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/icons/full/obj16/FLibrary.gif b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/icons/full/obj16/FLibrary.gif
new file mode 100644
index 0000000..1a3906e
--- /dev/null
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/icons/full/obj16/FLibrary.gif
Binary files differ
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/plugin.xml b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/plugin.xml
index 3170dbc..658f275 100644
--- a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/plugin.xml
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/plugin.xml
@@ -5,7 +5,7 @@
  <copyright>
  </copyright>
 
- $Id: plugin.xml,v 1.2 2009/09/19 01:25:49 mparker Exp $
+ $Id: plugin.xml,v 1.3 2010/04/10 03:42:42 mparker Exp $
 -->
 
 <plugin>
@@ -24,6 +24,10 @@
        <handler
              class="org.eclipse.amp.amf.gen.ext.GenerateTestCaseHandler"
              commandId="org.eclipse.amp.amf.gen.testcase">
+       </handler>
+       <handler
+             class="org.eclipse.amp.amf.gen.ext.GenerateFunctionLibraryHandler"
+             commandId="org.eclipse.amp.amf.gen.functiondocs">
        </handler>

     </extension>

     <extension

@@ -42,17 +46,21 @@
              categoryId="org.eclipse.amp.amf.gen.category"
              id="org.eclipse.amp.amf.gen.testcase"
              name="Generate Test Case">
+       </command>
+       <command
+             categoryId="org.eclipse.amp.amf.gen.category"
+             id="org.eclipse.amp.amf.gen.functiondocs"
+             name="Generate Function Docs">
        </command>

     </extension>

     <extension

           point="org.eclipse.ui.menus">

        <menuContribution

-             locationURI="popup:org.eclipse.amp.amf.ide.generateMenuID">
+             locationURI="popup:org.eclipse.amp.amf.ide.generateMenuID?after=additions">
           <command
                 commandId="org.eclipse.amp.amf.gen.graphickey"
                 icon="icons/full/obj16/Graphics.gif"
-                label="Graphic Legends"
-                style="push"
+            style="push"
                 tooltip="Generate a table for each agent showing states for graphics.">
              <visibleWhen
                    checkEnabled="false">
@@ -61,7 +69,20 @@
                 </reference>
              </visibleWhen>
           </command>
+     
           <command
+                commandId="org.eclipse.amp.amf.gen.functiondocs"
+                icon="icons/full/obj16/FLibrary.gif"
+                label="Function Docs (Wiki)"
+                style="push"
+                tooltip="Generate Wiki text for a function library">
+             <visibleWhen
+                   checkEnabled="false">
+                <reference
+                      definitionId="org.metaabm.metaABMFile">
+                </reference>
+             </visibleWhen>
+          </command>   <command
                 commandId="org.eclipse.amp.amf.gen.text"
                 icon="icons/full/obj16/Text.gif"
                 label="Text Documentation"
@@ -75,6 +96,19 @@
              </visibleWhen>
           </command>
           <command
+                commandId="org.eclipse.amp.amf.gen.functiondocs"
+                id="Generate Function Docs"
+                label="Funciton Lib"
+                style="push"
+                tooltip="Generate Wiki text for the funciton library">
+             <visibleWhen
+                   checkEnabled="false">
+                <reference
+                      definitionId="org.metaabm.metaABMFile">
+                </reference>
+             </visibleWhen>
+          </command>
+          <command
                 commandId="org.eclipse.amp.amf.gen.testcase"
                 icon="icons/full/obj16/junit.gif"
                 id="GenerateTestCase"
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/metaabm/ext/tmpl/WikiText.xpt b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/metaabm/ext/tmpl/WikiText.xpt
new file mode 100644
index 0000000..1b8345a
--- /dev/null
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/metaabm/ext/tmpl/WikiText.xpt
@@ -0,0 +1,65 @@
+«IMPORT metaabm»

+«IMPORT metaabm::act»

+«IMPORT metaabm::function»

+

+«EXTENSION metaabm::tmpl::infer» 

+«EXTENSION metaabm::tmpl::util»

+«EXTENSION metaabm::tmpl::names»

+«EXTENSION metaabm::tmpl::types»

+«EXTENSION metaabm::tmpl::projections»

+

+«DEFINE Usage FOR FOperator-»

+«IF arity==0-»

+«symbol»

+«ELSEIF arity==1-»

+«symbol»X

+«ELSEIF arity==2-»

+X«symbol»Y

+«ENDIF-»

+«ENDDEFINE»

+

+«DEFINE Usage FOR FGenericFunction-»

+«IF inputPrototypes.size > 0-»

+«FOREACH inputPrototypes AS input» «input.typeName()» «input.descrText()»

+«ENDFOREACH-»

+«ENDIF-»

+«ENDDEFINE»

+

+«DEFINE Usage FOR FFunction-»«ENDDEFINE»

+

+«DEFINE LibraryTable FOR FLibrary-»

+	«IF !subs.isEmpty-»

+		«FOREACH subs AS sub-»

+|-

+|colspan="3" style="color:white; background-color:black;" | «sub.label»

+			«EXPAND LibraryTable FOR sub-»

+		«ENDFOREACH-»

+	«ENDIF-»

+	«IF !functions.isEmpty-»

+	«FOREACH functions AS function-»

+|-

+| «function.label» 

+| «function.descrText().replaceAll("\r\n","")»

+«EXPAND Usage FOR function-»

+	«ENDFOREACH-»

+	«ENDIF-»

+«ENDDEFINE»

+«DEFINE LibraryTable FOR IArtifact-»

+«ENDDEFINE»

+

+«DEFINE LibraryTable FOR SContext-»

+«IF !library.isEmpty»

+==Function Library==

+{| border="1" cellpadding="2" cellspacing="0"

+|-

+! Name !! Description

+	«EXPAND LibraryTable FOREACH library-»

+|}

+«ENDIF-»

+«ENDDEFINE»

+

+«DEFINE Model FOR SContext-»

+	«FILE ("doc/" + implementation.className + ".mediawiki") -»

+		«EXPAND LibraryTable-»

+	«ENDFILE»

+«ENDDEFINE»
\ No newline at end of file
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_text_docs.mwe b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_text_docs.mwe
index e5c6417..1296128 100644
--- a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_text_docs.mwe
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_text_docs.mwe
@@ -4,34 +4,19 @@
 	<property name="modelPath" value="test/"/>
 	<property name="modelFile" value="TestGeneration.metaabm"/>
     <property name="srcDir" value="srcgen"/>

-	<property name="testing" value="false"/>
-    <property name="buildProject" value="undefined.project"/>

-    <property name="packageModifier" value=""/>

 	
-	<bean class="org.eclipse.emf.Setup">
-      <uriMap to="model/core_library.metaabm" from="http://metaabm.org/core_library.metaabm" />
-      <uriMap to="model/metaabm.xsd" from="http://metaabm.org/structure" />

-      <uriMap to="model/metaabm.act.xsd" from="http://metaabm.org/act" />

-      <uriMap to="model/metaabm.function.xsd" from="http://metaabm.org/function" />

-   	</bean> 
+
+    <bean id="metaabm" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
    
-    <bean id="metaabm" class="org.openarchitectureware.type.emf.EmfMetaModel">

-          <metaModelPackage value="org.metaabm.MetaABMPackage"/> 

-    </bean>

+	<component id="xmiParser" class="org.eclipse.emf.mwe.utils.Reader">
+        <uri value="${modelPath}"/>
+        <modelSlot value="model"/>
+  	</component>
 	
-	<component id="xmiParser" class="org.openarchitectureware.emf.XmiReader">
-		<modelFile value="${modelPath}${modelFile}"/>
-		<metaModelPackage value="org.metaabm.MetaABMPackage"/> 
-		<outputSlot value="model"/>
-	</component>
-	
-	<component id="textGenerator" class="org.openarchitectureware.xpand2.Generator" skipOnErrors="true" fileEncoding="iso-8859-1">
+	<component id="textGenerator" class="org.eclipse.xpand2.Generator" skipOnErrors="true" fileEncoding="iso-8859-1">
 		<metaModel idRef="metaabm"/>
 		<expand value="metaabm::ext::tmpl::TextDoc::Model FOR model"/>
 	    <outlet path="${outputPath}" overwrite="true"/> 
-		<globalVarDef name="testing" value="${testing}"/> 
-        <globalVarDef name="buildProject" value="'${buildProject}'"/> 
-        <globalVarDef name="packageModifier" value="'${packageModifier}'"/> 
-        <exceptionHandler class="org.eclipse.amp.amf.gen.mweExceptionHandler"/>
+		<fileEncoding value="ISO-8859-1"/> 
 	</component>    
 </workflow>
\ No newline at end of file
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_wiki_function_docs.mwe b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_wiki_function_docs.mwe
new file mode 100644
index 0000000..25485a6
--- /dev/null
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/model/generate_wiki_function_docs.mwe
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<workflow>	
+	<property name="outputPath" value="./"/>
+	<property name="modelPath" value="test/"/>
+	<property name="modelFile" value="TestGeneration.metaabm"/>
+    <property name="srcDir" value="srcgen"/>

+	
+
+    <bean id="metaabm" class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
+   
+	<component id="xmiParser" class="org.eclipse.emf.mwe.utils.Reader">
+        <uri value="${modelPath}"/>
+        <modelSlot value="model"/>
+  	</component>
+	
+	<component id="textGenerator" class="org.eclipse.xpand2.Generator" skipOnErrors="true" fileEncoding="iso-8859-1">
+		<metaModel idRef="metaabm"/>
+		<expand value="metaabm::ext::tmpl::WikiText::Model FOR model"/>
+	    <outlet path="${outputPath}" overwrite="true"/> 
+		<fileEncoding value="ISO-8859-1"/> 
+	</component>    
+</workflow>
\ No newline at end of file
diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/GenerateFunctionLibraryHandler.java b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/GenerateFunctionLibraryHandler.java
new file mode 100644
index 0000000..b78facb
--- /dev/null
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/GenerateFunctionLibraryHandler.java
@@ -0,0 +1,45 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2007-2009 Metascape, LLC
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Metascape - Initial development and maintenance
+ *
+ * </copyright>
+ */
+package org.eclipse.amp.amf.gen.ext;

+

+import org.eclipse.amp.amf.gen.ide.ResourceJobHandler;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.statushandlers.StatusManager;
+

+

+public class GenerateFunctionLibraryHandler extends ResourceJobHandler {

+

+    protected ClassLoader mainLoader;

+    protected ClassLoader delegateLoader;

+

+    @Override

+    public void execute(IResource resource) throws ExecutionException {

+        try {

+            IProject modelProject = resource.getProject();

+            modelProject.open(null);

+            LibraryDocsBuilder.getLibaryDocsDefault().handleModifiedResource(resource);

+            resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);

+        } catch (CoreException e) {

+            IStatus ioStatus = new Status(Status.WARNING, "org.eclipse.amp.amf.gen.ext", "Problem Generating "

+                + resource + " Wiki", e);

+            StatusManager.getManager().handle(ioStatus);

+        }

+    }

+}

diff --git a/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/LibraryDocsBuilder.java b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/LibraryDocsBuilder.java
new file mode 100644
index 0000000..e28a6a2
--- /dev/null
+++ b/org.eclipse.amp.amf/plugins/org.eclipse.amp.amf.gen.extras/src/org/eclipse/amp/amf/gen/ext/LibraryDocsBuilder.java
@@ -0,0 +1,42 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2007-2009 Metascape, LLC
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *   Metascape - Initial development and maintenance
+ *
+ * </copyright>
+ */
+package org.eclipse.amp.amf.gen.ext;
+
+import org.eclipse.amp.amf.gen.ide.MetaABMBuilder;
+
+
+public class LibraryDocsBuilder extends MetaABMBuilder {
+
+    public final static String FUNCTION_BUILDER_ID = "wikiFunctionBuilder";
+
+    private static MetaABMBuilder functionBuilder;
+
+    public LibraryDocsBuilder() {
+        super("Generating Text Documentation", "org.eclipse.amp.amf.gen.ext", "model/generate_wiki_function_docs.mwe",
+              true);
+    }
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static MetaABMBuilder getLibaryDocsDefault() {
+        if (functionBuilder == null) {
+            functionBuilder = new LibraryDocsBuilder();
+        }
+        return functionBuilder;
+    }
+}