[bugzilla 372463] HTML Export for the Intent Documentation (Step 2)

- improving the way Intent declares its menu so that the Export Action
can properly be contributed
diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/META-INF/MANIFEST.MF b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/META-INF/MANIFEST.MF
index 8bd3ccf..d618720 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/META-INF/MANIFEST.MF
@@ -15,11 +15,12 @@
  org.eclipse.mylyn.docs.intent.client.compiler,

  org.eclipse.mylyn.docs.intent.client.indexer,

  org.eclipse.mylyn.docs.intent.client.synchronizer,

- org.eclipse.ui.navigator;bundle-version="3.5.0",

- org.eclipse.ui.navigator.resources;bundle-version="3.4.200",

+ org.eclipse.ui.navigator,

+ org.eclipse.ui.navigator.resources,

  org.eclipse.core.resources;visibility:=reexport,

  org.eclipse.ui.ide;visibility:=reexport,

- org.eclipse.jface.text;visibility:=reexport

+ org.eclipse.jface.text;visibility:=reexport,

+ org.eclipse.core.expressions

 Bundle-ActivationPolicy: lazy

 Bundle-RequiredExecutionEnvironment: J2SE-1.5

 Import-Package: com.google.common.base,

diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/plugin.xml b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/plugin.xml
index 61cc919..9ea54c4 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/plugin.xml
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/plugin.xml
@@ -1,179 +1,258 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-
-<!--
-Copyright (c) 2011 Obeo.
-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:
-    Obeo - initial API and implementation
--->
-
-<plugin>
-     <extension-point id="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension" name="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension" schema="schema/org.eclipse.mylyn.docs.intent.client.ui.ide.template.exsd"/>
-     
-   <!-- EXTENSIONS OF THE PROJECT EXPLORER -->
-    <extension
-          point="org.eclipse.ui.navigator.viewer">
-        <viewer
-              helpContext="org.eclipse.ui.navigator.ProjectExplorer.help"
-              inheritBindingsFromViewer="org.eclipse.ui.navigator.ProjectExplorer"
-              viewerId="org.eclipse.ui.navigator.ProjectExplorer">
-       </viewer>
-       <viewerContentBinding
-             viewerId="org.eclipse.ui.navigator.ProjectExplorer">
-          <includes>
-             <contentExtension
-                   isRoot="false"
-                   pattern="org.eclipse.mylyn.docs.intent.client.ui.ide.RepositoryContent">
-             </contentExtension>
-          </includes>
-       </viewerContentBinding>
-     
-    </extension>
-    <extension
-          point="org.eclipse.ui.navigator.navigatorContent">
-       <navigatorContent
-             activeByDefault="true"
-             contentProvider="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryContentProvider"
-             icon="icon/ide/workspaceicon.gif"
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide.RepositoryContent"
-             labelProvider="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryLabelProvider"
-             name="Repository Content"
-             priority="highest"
-             providesSaveables="false">
-          <triggerPoints>
- 			<or>
-            	<adapt type="org.eclipse.core.resources.IProject">
-                	<and>
-                    	<test
-                        	property="org.eclipse.core.resources.projectNature"
-                            value="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">
-                        </test>
-                    </and>
-                </adapt>                
-            </or>
-          </triggerPoints>
- 		<possibleChildren>
-        	<or>
-            <instanceof
-                  value="org.eclipse.mylyn.docs.intent.core.indexer.IntentIndex">
-            </instanceof>
-            <instanceof
-                  value="org.eclipse.mylyn.docs.intent.core.indexer.IntentIndexEntry">
-            </instanceof>         
-        	</or>
-     	</possibleChildren>
-          <actionProvider
-                class="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryActionProvider">
-          </actionProvider>
-       </navigatorContent>
-    </extension>
-    <extension
-          point="org.eclipse.ui.popupMenus">
-       <objectContribution
-             adaptable="true"
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide.contribution1"
-             nameFilter="*"
-             objectClass="org.eclipse.core.resources.IProject">
-          <action
-                class="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.ToggleNatureAction"
-                enablesFor="+"
-                icon="icon/ide/toggle_nature.gif"
-                id="org.eclipse.mylyn.docs.intent.client.ui.ide.addRemoveNatureAction"
-                label="Add/Remove Intent Nature"
-                menubarPath="additions">
-          </action>
-       </objectContribution>
-    </extension>
-    <extension
-          id="intentBuilder"
-          name="Intent Project Builder"
-          point="org.eclipse.core.resources.builders">
-       <builder
-             hasNature="true">
-          <run
-                class="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.IntentBuilder">
-          </run>
-       </builder>
-    </extension>
-    <extension
-          id="intentNature"
-          name="Intent Project Nature"
-          point="org.eclipse.core.resources.natures">
-       <runtime>
-          <run
-                class="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.IntentNature">
-          </run>
-       </runtime>
-       <builder
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide.intentBuilder">
-       </builder>
-    </extension>
-    <extension
-          id="xmlProblem"
-          name="XML Problem"
-          point="org.eclipse.core.resources.markers">
-       <super
-             type="org.eclipse.core.resources.problemmarker">
-       </super>
-       <persistent
-             value="true">
-       </persistent>
-    </extension>
-    <extension
-          point="org.eclipse.ui.ide.projectNatureImages">
-       <image
-             icon="icon/ide/nature.gif"
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNatureImage"
-             natureId="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">
-       </image>
-    </extension>
-    <extension
-          point="org.eclipse.ui.newWizards">
-       <category
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide"
-             name="Intent">
-       </category>
-       <wizard
-             category="org.eclipse.mylyn.docs.intent.client.ui.ide"
-             class="org.eclipse.mylyn.docs.intent.client.ui.ide.wizards.NewIntentProjectWizard"
-             icon="icon/ide/toggle_nature.gif"
-             id="org.eclipse.mylyn.docs.intent.client.ui.ide.wizards.NewIntentProjectWizard"
-             name="Intent project"
-             project="true">
-       </wizard>
-    </extension>
-    <extension
-          point="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension">
-       <IntentDocumentTemplate
-             description="A simple Intent document."
-             name="Default template"
-             template="templates/default.intent">
-       </IntentDocumentTemplate>
-    </extension>
-    <extension
-          point="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension">
-       <IntentDocumentTemplate
-             description="This templates helps initializing a documentation of a standard software."
-             name="Standard Software Template"
-             template="templates/software.intent">
-       </IntentDocumentTemplate>
-    </extension>
-    <extension
-          point="org.eclipse.mylyn.docs.intent.collab.repository.extension">
-       <Repository
-             id="org.eclipse.mylyn.docs.intent.collab.ide.repository"
-             repositoryCreatorClass="org.eclipse.mylyn.docs.intent.client.ui.ide.repository.IntentWorkspaceRepositoryCreator"
-             repositoryStructurerClass="org.eclipse.mylyn.docs.intent.client.ui.ide.repository.IntentWorkspaceRepositoryStructurer">
-       </Repository>
-    </extension>
-   
-   
-   
-   
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>

+<?eclipse version="3.4"?>

+

+<!--

+Copyright (c) 2011 Obeo.

+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:

+    Obeo - initial API and implementation

+-->

+

+<plugin>

+     <extension-point id="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension" name="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension" schema="schema/org.eclipse.mylyn.docs.intent.client.ui.ide.template.exsd"/>

+     

+   <!-- EXTENSIONS OF THE PROJECT EXPLORER -->

+    <extension

+          point="org.eclipse.ui.navigator.viewer">

+        <viewer

+              helpContext="org.eclipse.ui.navigator.ProjectExplorer.help"

+              inheritBindingsFromViewer="org.eclipse.ui.navigator.ProjectExplorer"

+              viewerId="org.eclipse.ui.navigator.ProjectExplorer">

+       </viewer>

+       <viewerContentBinding

+             viewerId="org.eclipse.ui.navigator.ProjectExplorer">

+          <includes>

+             <contentExtension

+                   isRoot="false"

+                   pattern="org.eclipse.mylyn.docs.intent.client.ui.ide.RepositoryContent">

+             </contentExtension>

+          </includes>

+       </viewerContentBinding>

+     

+    </extension>

+    <extension

+          point="org.eclipse.ui.navigator.navigatorContent">

+       <navigatorContent

+             activeByDefault="true"

+             contentProvider="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryContentProvider"

+             icon="icon/ide/workspaceicon.gif"

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.RepositoryContent"

+             labelProvider="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryLabelProvider"

+             name="Repository Content"

+             priority="highest"

+             providesSaveables="false">

+          <triggerPoints>

+ 			<or>

+            	<adapt type="org.eclipse.core.resources.IProject">

+                	<and>

+                    	<test

+                        	property="org.eclipse.core.resources.projectNature"

+                            value="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">

+                        </test>

+                    </and>

+                </adapt>                

+            </or>

+          </triggerPoints>

+ 		<possibleChildren>

+        	<or>

+            <instanceof

+                  value="org.eclipse.mylyn.docs.intent.core.indexer.IntentIndex">

+            </instanceof>

+            <instanceof

+                  value="org.eclipse.mylyn.docs.intent.core.indexer.IntentIndexEntry">

+            </instanceof>         

+        	</or>

+     	</possibleChildren>

+          <actionProvider

+                class="org.eclipse.mylyn.docs.intent.client.ui.ide.navigator.RepositoryActionProvider">

+          </actionProvider>

+       </navigatorContent>

+    </extension>

+    <extension

+          id="intentBuilder"

+          name="Intent Project Builder"

+          point="org.eclipse.core.resources.builders">

+       <builder

+             hasNature="true">

+          <run

+                class="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.IntentBuilder">

+          </run>

+       </builder>

+    </extension>

+    <extension

+          id="intentNature"

+          name="Intent Project Nature"

+          point="org.eclipse.core.resources.natures">

+       <runtime>

+          <run

+                class="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.IntentNature">

+          </run>

+       </runtime>

+       <builder

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.intentBuilder">

+       </builder>

+    </extension>

+    <extension

+          id="xmlProblem"

+          name="XML Problem"

+          point="org.eclipse.core.resources.markers">

+       <super

+             type="org.eclipse.core.resources.problemmarker">

+       </super>

+       <persistent

+             value="true">

+       </persistent>

+    </extension>

+    <extension

+          point="org.eclipse.ui.ide.projectNatureImages">

+       <image

+             icon="icon/ide/nature.gif"

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNatureImage"

+             natureId="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">

+       </image>

+    </extension>

+    <extension

+          point="org.eclipse.ui.newWizards">

+       <category

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide"

+             name="Intent">

+       </category>

+       <wizard

+             category="org.eclipse.mylyn.docs.intent.client.ui.ide"

+             class="org.eclipse.mylyn.docs.intent.client.ui.ide.wizards.NewIntentProjectWizard"

+             icon="icon/ide/toggle_nature.gif"

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.wizards.NewIntentProjectWizard"

+             name="Intent project"

+             project="true">

+       </wizard>

+    </extension>

+    <extension

+          point="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension">

+       <IntentDocumentTemplate

+             description="A simple Intent document."

+             name="Default template"

+             template="templates/default.intent">

+       </IntentDocumentTemplate>

+    </extension>

+    <extension

+          point="org.eclipse.mylyn.docs.intent.client.ui.ide.template.extension">

+       <IntentDocumentTemplate

+             description="This templates helps initializing a documentation of a standard software."

+             name="Standard Software Template"

+             template="templates/software.intent">

+       </IntentDocumentTemplate>

+    </extension>

+    <extension

+          point="org.eclipse.mylyn.docs.intent.collab.repository.extension">

+       <Repository

+             id="org.eclipse.mylyn.docs.intent.collab.ide.repository"

+             repositoryCreatorClass="org.eclipse.mylyn.docs.intent.client.ui.ide.repository.IntentWorkspaceRepositoryCreator"

+             repositoryStructurerClass="org.eclipse.mylyn.docs.intent.client.ui.ide.repository.IntentWorkspaceRepositoryStructurer">

+       </Repository>

+    </extension>

+    <extension

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

+       <menuContribution

+             allPopups="false"

+             locationURI="popup:org.eclipse.ui.popup.any?after=additions">

+          <menu

+                icon="icon/ide/toggle_nature.gif"

+                id="org.eclipse.mylyn.docs.intent.client.ui.ide.menu"

+                label="Intent">

+             <visibleWhen

+                   checkEnabled="true">

+             </visibleWhen>

+          </menu>

+       </menuContribution>

+       <menuContribution

+             allPopups="false"

+             locationURI="popup:org.eclipse.ui.projectConfigure?after=additions">

+          <command

+                commandId="org.eclipse.mylyn.docs.intent.client.ui.ide.addNatureCommand"

+                icon="icon/ide/toggle_nature.gif"

+                label="Add Intent Nature"

+                style="push"

+                tooltip="Toggle the Intent Nature on the selected project">

+             <visibleWhen

+                   checkEnabled="false">

+                <iterate>

+                   <adapt

+                         type="org.eclipse.core.resources.IProject">

+                      <and>

+                         <not>

+                            <test

+                                  property="org.eclipse.core.resources.projectNature"

+                                  value="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">

+                            </test>

+                         </not>

+                         <test

+                               property="org.eclipse.core.resources.open"

+                               value="true">

+                         </test>

+                      </and>

+                   </adapt>

+                </iterate>

+             </visibleWhen>

+          </command>

+          <command

+                commandId="org.eclipse.mylyn.docs.intent.client.ui.ide.removeNatureCommand"

+                icon="icon/ide/toggle_nature.gif"

+                label="Remove Intent Nature"

+                style="push"

+                tooltip="Toggle the Intent Nature on the selected project">

+             <visibleWhen

+                   checkEnabled="false">

+                <iterate>

+                   <adapt

+                         type="org.eclipse.core.resources.IProject">

+                      <and>

+                         <test

+                               property="org.eclipse.core.resources.open"

+                               value="true">

+                         </test>

+                         <test

+                               property="org.eclipse.core.resources.projectNature"

+                               value="org.eclipse.mylyn.docs.intent.client.ui.ide.intentNature">

+                         </test>

+                      </and>

+                   </adapt>

+                </iterate>

+             </visibleWhen>

+          </command>

+       </menuContribution>

+    </extension>

+    <extension

+          point="org.eclipse.ui.commands">

+       <command

+             categoryId="org.eclipse.ui.category.file"

+             defaultHandler="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.ToggleNatureAction"

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.addNatureCommand"

+             name="Add Intent Nature">

+       </command>

+       <command

+             categoryId="org.eclipse.ui.category.file"

+             defaultHandler="org.eclipse.mylyn.docs.intent.client.ui.ide.builder.ToggleNatureAction"

+             id="org.eclipse.mylyn.docs.intent.client.ui.ide.removeNatureCommand"

+             name="Remove Intent Nature">

+       </command>

+    </extension>

+    <extension

+          point="org.eclipse.core.expressions.propertyTesters">

+       <propertyTester

+             class="org.eclipse.mylyn.docs.intent.client.ui.ide.propertytester.IsAssociatedToIntentDocumentTester"

+             id="org.eclipse.mylyn.docs.intent.IntentPropertyTester"

+             namespace="org.eclipse.mylyn.docs.intent.client.ui.ide"

+             properties="isIntentDocument"

+             type="java.lang.Object">

+       </propertyTester>

+    </extension>

+   

+   

+   

+   

+

+</plugin>

diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/src/org/eclipse/mylyn/docs/intent/client/ui/ide/builder/ToggleNatureAction.java b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/src/org/eclipse/mylyn/docs/intent/client/ui/ide/builder/ToggleNatureAction.java
index 27cc872..4e01dbd 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/src/org/eclipse/mylyn/docs/intent/client/ui/ide/builder/ToggleNatureAction.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.ui.ide/src/org/eclipse/mylyn/docs/intent/client/ui/ide/builder/ToggleNatureAction.java
@@ -12,65 +12,23 @@
 
 import java.util.Iterator;
 
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
 
 /**
  * Allows to toggle intent nature on projects.
  * 
  * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a>
  */
-public class ToggleNatureAction implements IObjectActionDelegate {
-
-	private ISelection selection;
-
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
-	 */
-	public void run(IAction action) {
-		if (selection instanceof IStructuredSelection) {
-			for (Iterator it = ((IStructuredSelection)selection).iterator(); it.hasNext();) {
-				Object element = it.next();
-				IProject project = null;
-				if (element instanceof IProject) {
-					project = (IProject)element;
-				} else if (element instanceof IAdaptable) {
-					project = (IProject)((IAdaptable)element).getAdapter(IProject.class);
-				}
-				if (project != null) {
-					toggleNature(project);
-				}
-			}
-		}
-	}
-
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
-	 *      org.eclipse.jface.viewers.ISelection)
-	 */
-	public void selectionChanged(IAction action, ISelection currentSelection) {
-		this.selection = currentSelection;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
-	 *      org.eclipse.ui.IWorkbenchPart)
-	 */
-	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-	}
+public class ToggleNatureAction extends AbstractHandler {
 
 	/**
 	 * Toggles intent nature on a project.
@@ -106,4 +64,29 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+
+		if (currentSelection instanceof IStructuredSelection) {
+			for (Iterator it = ((IStructuredSelection)currentSelection).iterator(); it.hasNext();) {
+				Object element = it.next();
+				IProject project = null;
+				if (element instanceof IProject) {
+					project = (IProject)element;
+				} else if (element instanceof IAdaptable) {
+					project = (IProject)((IAdaptable)element).getAdapter(IProject.class);
+				}
+				if (project != null) {
+					toggleNature(project);
+				}
+			}
+		}
+		return null;
+	}
+
 }
diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/build.properties b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/build.properties
index 13132cc..0238b7b 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/build.properties
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/build.properties
@@ -5,10 +5,12 @@
                plugin.xml,\

                plugin.properties,\

                about.html,\

-               build.properties

+               build.properties,\

+               icon/

 src.includes = META-INF/,\

                about.html,\

                src/,\

                build.properties,\

                plugin.properties,\

-               plugin.xml

+               plugin.xml,\

+               icon/

diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/icon/html_tag_obj.gif b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/icon/html_tag_obj.gif
new file mode 100644
index 0000000..21fad22
--- /dev/null
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/icon/html_tag_obj.gif
Binary files differ
diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/plugin.xml b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/plugin.xml
index 563d286..755e147 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/plugin.xml
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/plugin.xml
@@ -1,19 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>

 <?eclipse version="3.4"?>

-<plugin>

+<plugin>
 <extension

-         point="org.eclipse.ui.popupMenus">

-      <objectContribution

-            adaptable="true"

-            id="org.eclipse.mylyn.docs.intentexport.ui"

-            objectClass="org.eclipse.core.resources.IProject"> <!-- Currently textile only -->

-         <action

-               label="Export Intent Documentation as HTML"

-               class="org.eclipse.mylyn.docs.intent.exporter.ui.popup.actions.ExportIntentDocumentationAction"

-               menubarPath="additions"

-               enablesFor="1"

-               id="org.eclipse.mylyn.docs.intent.exporter.ui.action.html">

-         </action>

-               </objectContribution>

-   </extension>
+      point="org.eclipse.ui.menus">

+   <menuContribution

+         locationURI="popup:org.eclipse.mylyn.docs.intent.client.ui.ide.menu">

+      <command

+            commandId="org.eclipse.mylyn.docs.intent.export.exportHTML"

+            icon="icon/html_tag_obj.gif"

+            label="Export Intent Documentation as HTML"

+            style="push">

+         <visibleWhen

+               checkEnabled="false">

+            <iterate

+                  operator="and">            <test

+                  forcePluginActivation="true"

+                  property="org.eclipse.mylyn.docs.intent.client.ui.ide.isIntentDocument">

+            </test></iterate>

+

+         </visibleWhen>

+      </command>

+   </menuContribution>

+</extension>

+<extension

+      point="org.eclipse.ui.commands">

+   <command

+         defaultHandler="org.eclipse.mylyn.docs.intent.exporter.ui.popup.actions.ExportIntentDocumentationAction"

+         id="org.eclipse.mylyn.docs.intent.export.exportHTML"

+         name="Export Intent Documentation as HTML">

+   </command>

+</extension>

 </plugin>

diff --git a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/src/org/eclipse/mylyn/docs/intent/exporter/ui/popup/actions/ExportIntentDocumentationAction.java b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/src/org/eclipse/mylyn/docs/intent/exporter/ui/popup/actions/ExportIntentDocumentationAction.java
index 46254d4..87ebc0e 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/src/org/eclipse/mylyn/docs/intent/exporter/ui/popup/actions/ExportIntentDocumentationAction.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.exporter.ui/src/org/eclipse/mylyn/docs/intent/exporter/ui/popup/actions/ExportIntentDocumentationAction.java
@@ -18,6 +18,9 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
@@ -29,7 +32,6 @@
 import org.eclipse.emf.common.util.BasicMonitor;
 import org.eclipse.emf.common.util.Monitor;
 import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.window.Window;
@@ -42,20 +44,23 @@
 import org.eclipse.mylyn.docs.intent.core.document.IntentDocument;
 import org.eclipse.mylyn.docs.intent.exporter.main.HTMLBootstrapGenDocument;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
 import org.osgi.framework.Bundle;
 
-public class ExportIntentDocumentationAction implements IObjectActionDelegate {
-
-	private ISelection selection;
+/**
+ * An handler allowing to export an intent document / Intent Project as an HTML Document.
+ * 
+ * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a>
+ */
+public class ExportIntentDocumentationAction extends AbstractHandler {
 
 	/**
 	 * {@inheritDoc}
 	 * 
-	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 	 */
-	public void run(IAction action) {
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
 		Object intentProject;
 		if (selection instanceof StructuredSelection
 				&& (intentProject = ((StructuredSelection)selection).getFirstElement()) instanceof IProject) {
@@ -63,7 +68,7 @@
 			// Step 1 : open the export dialog
 			ExportOptionsDialog exportOptionsDialog = new ExportOptionsDialog(Display.getCurrent()
 					.getActiveShell(), new File(((IProject)intentProject).getLocationURI()).getAbsolutePath()
-					+ "/export");
+					+ "/html");
 
 			if (Window.OK == exportOptionsDialog.open()) {
 				// Step 2: realize export
@@ -72,6 +77,7 @@
 						exportOptionsDialog.getExportedIntentDocumentName(), new BasicMonitor());
 			}
 		}
+		return null;
 	}
 
 	/**
@@ -198,25 +204,4 @@
 		}
 	}
 
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
-	 *      org.eclipse.jface.viewers.ISelection)
-	 */
-	public void selectionChanged(IAction action, ISelection selection) {
-		this.selection = selection;
-
-	}
-
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
-	 *      org.eclipse.ui.IWorkbenchPart)
-	 */
-	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-
-	}
-
 }