Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 08:13:38 -0400
committercletavernie2011-10-25 08:13:38 -0400
commit53e1f7c9887b09735e633233b454580dc8a6a40c (patch)
tree9b5b5da8a9b7d8db2aefafe11f99130b8cbd459f /plugins/views/documentation
parent565a800d0331ee6af75ef3333dd75a1bd56ddf62 (diff)
downloadorg.eclipse.papyrus-53e1f7c9887b09735e633233b454580dc8a6a40c.tar.gz
org.eclipse.papyrus-53e1f7c9887b09735e633233b454580dc8a6a40c.tar.xz
org.eclipse.papyrus-53e1f7c9887b09735e633233b454580dc8a6a40c.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/views/documentation')
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/.classpath7
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/.project28
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/META-INF/MANIFEST.MF20
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/about.html28
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/build.properties7
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableCol.pngbin0 -> 574 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableRow.pngbin0 -> 629 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableCol.pngbin0 -> 605 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableRow.pngbin0 -> 641 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextColor.gifbin0 -> 536 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextHighlight.gifbin0 -> 933 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/application_link.pngbin0 -> 749 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/documentation.gifbin0 -> 652 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/edit.gifbin0 -> 615 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/externalResource.gifbin0 -> 587 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/htmlEditor.gifbin0 -> 971 bytes
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.properties12
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.xml18
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/schema/documentationPartHandler.exsd102
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ArrayTreeContentProvider.java51
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/CommentsComposite.java456
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPage.java219
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPageComposite.java154
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocView.java232
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocViewPlugin.java175
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocumentionPartHandlerRegistry.java95
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/EmptyDocPage.java73
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ExternalResourceEditorInput.java200
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocPage.java27
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocumentationPartHandler.java63
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IText.java53
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/Messages.java63
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/PlainTextComposite.java92
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ResourcesComposite.java602
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextComposite.java199
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextEditorDialog.java228
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SelectResourceDialog.java342
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SpellingTextComposite.java455
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TextViewerAction.java41
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TypedResourcesSelectionDialog.java139
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/AddElementLinkAction.java83
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/CommandConstants.java24
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableColumnAction.java56
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableRowAction.java56
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableColumnAction.java55
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableRowAction.java56
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/NumberValidator.java40
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextColorAction.java62
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextHighlightAction.java68
-rw-r--r--plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/messages.properties25
50 files changed, 4706 insertions, 0 deletions
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.classpath b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.classpath
new file mode 100644
index 00000000000..9d5026e8ffd
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.project b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.project
new file mode 100644
index 00000000000..52a6f737c99
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.documentation.view</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/META-INF/MANIFEST.MF b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1c0d15ea564
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.documentation.view;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.documentation.view.DocViewPlugin
+Require-Bundle: org.eclipse.core.expressions;visibility:=reexport,
+ org.eclipse.ui.editors;visibility:=reexport,
+ org.eclipse.ui.ide;visibility:=reexport,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.epf.richtext,
+ org.eclipse.papyrus.documentation;bundle-version="0.7.3";visibility:=reexport
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.documentation.view
+Import-Package: org.eclipse.ui.views.contentoutline
+Bundle-Vendor: %providerName
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/about.html b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/build.properties b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/build.properties
new file mode 100644
index 00000000000..81e8b0935ca
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:51 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,icons/,plugin.properties,about.html,schema/
+output..=bin/
+src.includes=about.html,META-INF/,.,plugin.xml,icons/,plugin.properties,schema/
+source..=src/
+bin..=bin/
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableCol.png b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableCol.png
new file mode 100644
index 00000000000..2e154a377ab
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableCol.png
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableRow.png b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableRow.png
new file mode 100644
index 00000000000..54c69691ed3
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/DeleteTableRow.png
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableCol.png b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableCol.png
new file mode 100644
index 00000000000..70f6ab94964
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableCol.png
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableRow.png b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableRow.png
new file mode 100644
index 00000000000..ff5925efd43
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/InsertTableRow.png
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextColor.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextColor.gif
new file mode 100644
index 00000000000..2a4cd71bdbf
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextColor.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextHighlight.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextHighlight.gif
new file mode 100644
index 00000000000..3669e712af8
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/TextHighlight.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/application_link.png b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/application_link.png
new file mode 100644
index 00000000000..f3727d22e77
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/application_link.png
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/documentation.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/documentation.gif
new file mode 100644
index 00000000000..3d86636daa5
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/documentation.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/edit.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/edit.gif
new file mode 100644
index 00000000000..855dd5871db
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/edit.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/externalResource.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/externalResource.gif
new file mode 100644
index 00000000000..229c391c493
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/externalResource.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/htmlEditor.gif b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/htmlEditor.gif
new file mode 100644
index 00000000000..adf2410fa60
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/icons/htmlEditor.gif
Binary files differ
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.properties b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.properties
new file mode 100644
index 00000000000..cb6416737c0
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 Atos Origin.
+# 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:
+# Atos Origin - Initial API and Implementation
+##################################################################################
+pluginName=View for documentation support (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.xml b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.xml
new file mode 100644
index 00000000000..226f2162832
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="documentationPartHandler" name="documentationPartHandler" schema="schema/documentationPartHandler.exsd"/>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="false"
+ category="org.eclipse.papyrus.views.category"
+ class="org.eclipse.papyrus.documentation.view.DocView"
+ icon="icons/documentation.gif"
+ id="org.eclipse.papyrus.documentation.view.DocView"
+ name="Documentation"
+ restorable="true">
+ </view>
+ </extension>
+
+</plugin>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/schema/documentationPartHandler.exsd b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/schema/documentationPartHandler.exsd
new file mode 100644
index 00000000000..8c0e1bb1b99
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/schema/documentationPartHandler.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.documentation.view" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.documentation.view" id="documentationEditor" name="documentationEditor"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="documentationPartHandler" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="documentationPartHandler">
+ <complexType>
+ <attribute name="documentationPartHandler" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.documentation.view.IDocumentationPartHandler"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ArrayTreeContentProvider.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ArrayTreeContentProvider.java
new file mode 100644
index 00000000000..3ed22353e04
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ArrayTreeContentProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2005 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies),
+ * Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies),
+ * Thomas Friol (Anyware Technologies)
+ * - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * A class defining an adapter to use the predefined eclipse
+ * ArrayContentProvider in a TreeViewer. <br/> Creation : 12 oct. 2005
+ *
+ * @author <a href="mailto:thomas.friol@anyware-tech.com">Thomas FRIOL</a>
+ */
+public class ArrayTreeContentProvider extends ArrayContentProvider implements ITreeContentProvider
+{
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren(Object parentElement)
+ {
+ return new Object[0];
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ public Object getParent(Object element)
+ {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ public boolean hasChildren(Object element)
+ {
+ return false;
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/CommentsComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/CommentsComposite.java
new file mode 100644
index 00000000000..b11546f0afe
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/CommentsComposite.java
@@ -0,0 +1,456 @@
+/***********************************************************************
+ * Copyright (c) 2009 Anyware Technologies and others
+ *
+ * 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:
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ **********************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.DocumentationUnsupportedException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A class defining an composite used to edit the documentation related to a semantic element.<br>
+ * <br>
+ * Created : 11 August 2009<br>
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques LESCOT</a>
+ */
+public class CommentsComposite extends DocPageComposite
+{
+
+ /** A composite used to edit the documentation using a Rich Text editor */
+ private RichTextComposite richTextComposite;
+
+ /** A composite used to edit the documentation using a Plain Text editor */
+ private PlainTextComposite plainTextComposite;
+
+ private Button useRichTextEditorButton;
+
+ private Button editButton;
+
+ private Composite editorContainer;
+
+ private FocusListener focusListener;
+
+ private Text infoText;
+
+ private static String typeLabel = Messages.CommentsComposite_docCurrent;
+
+ private static boolean isRichTextEnabled = true;
+
+ /**
+ * Constructor.
+ *
+ * @param parent the parent composite
+ * @param style the composite style
+ * @param editingDomainProvider the provider of editing domain to execute commands
+ */
+ public CommentsComposite(Composite parent, int style)
+ {
+ super(parent, style);
+ }
+
+ /**
+ * @see org.topcased.modeler.documentation.DocPageComposite#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createContents(Composite parent)
+ {
+ boolean labelForTypeInformation = (getStyle() & DocPage.STYLE_TEXT_TYPE) != 0;
+ if (labelForTypeInformation)
+ {
+ infoText = new Text(parent, SWT.READ_ONLY);
+ }
+
+ parent.setLayout(new GridLayout(3, false));
+
+ editorContainer = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalSpan = 3;
+ editorContainer.setLayoutData(gData);
+ editorContainer.setLayout(new FillLayout());
+
+ if (isRichTextEnabled)
+ {
+ try
+ {
+ Browser browser = new Browser(editorContainer, SWT.NONE);
+ browser.dispose();
+ }
+ catch (SWTError swtError)
+ {
+ // TODO log
+// ModelerPlugin.log("None XULRunner installed. You can not use Rich Text Edition.", IStatus.WARNING);
+ isRichTextEnabled = false;
+ }
+ }
+
+ // Initialize Simple Text Editor by default
+ plainTextComposite = createPlainCommentsComposite();
+
+ useRichTextEditorButton = new Button(parent, SWT.CHECK | SWT.RIGHT);
+ useRichTextEditorButton.setText("Use HTML Editor");
+ useRichTextEditorButton.setImage(DocViewPlugin.getDefault().getImageRegistry().get("HTML_EDITOR"));
+ useRichTextEditorButton.setSelection(false);
+ useRichTextEditorButton.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ changeEditor();
+ }
+ });
+
+ Label emptyLbl = new Label(parent, SWT.NONE);
+ emptyLbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ editButton = new Button(parent, SWT.PUSH);
+ editButton.setImage(DocViewPlugin.getDefault().getImageRegistry().get("EDIT"));
+ editButton.setText("Edit");
+ editButton.setEnabled(useRichTextEditorButton.getSelection());
+ editButton.addSelectionListener(new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ RichTextEditorDialog dialog = new RichTextEditorDialog(getShell(), getDocumentationValueFromElement());
+ if (dialog.open() == Window.OK)
+ {
+ richTextComposite.setDocumentationValue(dialog.getDocumentationValue());
+ handleDocChanged();
+ }
+
+ }
+ });
+
+ if (infoText != null)
+ {
+ infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+ }
+
+ /**
+ * @see org.topcased.modeler.documentation.DocPageComposite#refresh()
+ */
+ protected void refresh()
+ {
+ EObject docElement = getDocumentedElement();
+ useRichTextEditorButton.setEnabled(docElement != null);
+ if (useRichTextEditorButton.getSelection())
+ {
+ richTextComposite.setDocumentationValue("");
+ if (docElement != null)
+ {
+ richTextComposite.setDocumentationValue(getDocumentationValueFromElement());
+ }
+ }
+ else
+ {
+ plainTextComposite.setDocumentationValue("");
+ plainTextComposite.getControl().setEnabled(docElement != null);
+ if (docElement != null)
+ {
+ plainTextComposite.setDocumentationValue(getDocumentationValueFromElement());
+ }
+ }
+ if (infoText != null) {
+ if (docElement != null) {
+ infoText.setText(typeLabel + docElement.eClass().getName());
+ } else {
+ infoText.setText("");
+ }
+ }
+ }
+
+ /**
+ * @return the richTextComposite
+ */
+ protected RichTextComposite getRichTextComposite()
+ {
+ return richTextComposite;
+ }
+
+ /**
+ * @return the plainTextComposite
+ */
+ public PlainTextComposite getPlainTextComposite()
+ {
+ return plainTextComposite;
+ }
+
+ /**
+ * Change comments editor between simple Text Editor to HTML Text Editor and
+ */
+ public void changeEditor()
+ {
+ if (!useRichTextEditorButton.getSelection())
+ {
+ String comment = richTextComposite.getDocumentationValue();
+ richTextComposite.dispose();
+ plainTextComposite = createPlainCommentsComposite();
+ plainTextComposite.setFocus();
+ plainTextComposite.setDocumentationValue(comment);
+ useRichTextEditorButton.setToolTipText("Use HTML Editor to edit documentation");
+ useRichTextEditorButton.setSelection(false);
+ editButton.setEnabled(false);
+ }
+ else
+ {
+ if (isRichTextEnabled)
+ {
+ String comment = plainTextComposite.getDocumentationValue();
+ plainTextComposite.getControl().removeFocusListener(focusListener);
+ plainTextComposite.dispose();
+ richTextComposite = createRichCommentsComposite();
+ richTextComposite.setDocumentationValue(comment);
+ useRichTextEditorButton.setToolTipText("Use Text Editor to edit documentation");
+ useRichTextEditorButton.setSelection(true);
+ editButton.setEnabled(true);
+ editButton.setFocus();
+ }
+ else
+ {
+ showMessageDialog();
+ useRichTextEditorButton.setSelection(false);
+ }
+ }
+ editorContainer.layout();
+ }
+
+ private void showMessageDialog()
+ {
+ MessageDialog dialog = new MessageDialog(getShell(), "Rich Text Edition unavailable", null,
+ "Your operating system does not support the SWT Browser component, thus you are not able to edit documentation using rich text capabilities.\n"
+ + "You should try installing XULRunner in your environment so that you can enable Rich Text Edition, and then restart your application.\n"
+ + "To install XulRunner, have a look at : <a>http://www.eclipse.org/atf/downloads/base_files/manualXulrunner_section.php</a>.", MessageDialog.WARNING,
+ new String[] {IDialogConstants.OK_LABEL}, 0)
+ {
+ @Override
+ protected Control createMessageArea(Composite composite)
+ {
+ Image image = getImage();
+ if (image != null)
+ {
+ imageLabel = new Label(composite, SWT.NULL);
+ image.setBackground(imageLabel.getBackground());
+ imageLabel.setImage(image);
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
+ }
+ // create message
+ if (message != null)
+ {
+ Link messageLink = new Link(composite, getMessageLabelStyle());
+ messageLink.setText(message);
+ messageLink.addListener(SWT.Selection, new Listener()
+ {
+ public void handleEvent(Event event)
+ {
+ try
+ {
+ PlatformUI.getWorkbench().getBrowserSupport().createBrowser(null).openURL(new URL(event.text));
+ okPressed();
+ }
+ catch (PartInitException e)
+ {
+ // TODO log
+ }
+ catch (MalformedURLException e)
+ {
+ // TODO log
+ }
+ }
+ });
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).applyTo(
+ messageLink);
+ }
+ return composite;
+ }
+ };
+ dialog.open();
+ }
+
+ /**
+ * Create the Composite used to render the Rich Text Editor
+ *
+ * @return RichTextCommentsComposite
+ */
+ protected RichTextComposite createRichCommentsComposite()
+ {
+ richTextComposite = new RichTextComposite(editorContainer, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ richTextComposite.setLayout(layout);
+
+ return richTextComposite;
+ }
+
+ /**
+ * Create the Composite used to render the Plain text editor
+ *
+ * @return PlainTextComposite
+ */
+ protected PlainTextComposite createPlainCommentsComposite()
+ {
+ plainTextComposite = new PlainTextComposite(editorContainer, SWT.NONE);
+ focusListener = new FocusAdapter()
+ {
+ private String previousComment;
+
+ public void focusGained(FocusEvent e)
+ {
+ previousComment = plainTextComposite.getDocumentationValue();
+ }
+
+ public void focusLost(FocusEvent e)
+ {
+ if (!plainTextComposite.getDocumentationValue().equals(previousComment))
+ {
+ handleDocChanged();
+ }
+ }
+ };
+
+ plainTextComposite.getTextControl().addFocusListener(focusListener);
+ return plainTextComposite;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Composite#setFocus()
+ */
+ public boolean setFocus()
+ {
+ if (useRichTextEditorButton == null)
+ {
+ return false;
+ }
+ if (useRichTextEditorButton.getSelection())
+ {
+ return editButton.setFocus();
+ }
+ if (plainTextComposite == null)
+ {
+ return false;
+ }
+ return plainTextComposite.setFocus();
+ }
+
+ /**
+ * Gets the checkbox allowing to use rich text edition
+ *
+ * @return the useRichTextEditorButton
+ */
+ protected Button getUseRichTextEditorButton()
+ {
+ return useRichTextEditorButton;
+ }
+
+ /**
+ * Gets the edit button
+ *
+ * @return the edit button
+ */
+ protected Button getEditButton()
+ {
+ return editButton;
+ }
+
+ /**
+ * Get the String value of the element to be edited.<br/>
+ *
+ * @return String the documentation text
+ */
+ protected String getDocumentationValueFromElement()
+ {
+ try {
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(getActivePart());
+ if (documentationPartHandler != null) {
+ EObject associatedDiagram = documentationPartHandler.getAssociatedDiagram(getActivePart(), getDocumentedElement());
+ EObject toDocument = associatedDiagram == null ? getDocumentedElement() : associatedDiagram;
+ return documentationPartHandler.getDocumentationManager().getDocumentation(toDocument);
+ }
+ } catch (DocumentationUnsupportedException e) {
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Update documentation text using a Command.
+ */
+ public void handleDocChanged()
+ {
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(getActivePart());
+ if (documentationPartHandler != null) {
+ String docValue = getUseRichTextEditorButton().getSelection() ? getRichTextComposite().getDocumentationValue() : getPlainTextComposite().getDocumentationValue();
+ Command cmd = documentationPartHandler.getDocumentationManager().getChangeDocumentationCommand(getDocumentedElement(), docValue);
+ documentationPartHandler.executeCommand(getActivePart(), cmd);
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enabled)
+ {
+ if (plainTextComposite != null)
+ {
+ plainTextComposite.setEnabled(enabled);
+ }
+ if (richTextComposite != null)
+ {
+ richTextComposite.setEnabled(enabled);
+ }
+ if (useRichTextEditorButton != null)
+ {
+ useRichTextEditorButton.setEnabled(enabled);
+ }
+ }
+
+ @Override
+ public void setForeground(Color color)
+ {
+ super.setForeground(color);
+ if (plainTextComposite != null)
+ {
+ plainTextComposite.setForeground(color);
+ }
+ if (richTextComposite != null)
+ {
+ richTextComposite.setForeground(color);
+ }
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPage.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPage.java
new file mode 100644
index 00000000000..e150bb937ea
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPage.java
@@ -0,0 +1,219 @@
+/***********************************************************************
+ * Copyright (c) 2009 Anyware Technologies and others
+ *
+ * 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:
+ * Jacques Lescot (Anyware Technologies) - initial API and documentation
+ **********************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.Page;
+
+/**
+ * This class defines a page used to edit a documentation text and some resources to be associated with a
+ * given model element<br>
+ *
+ * Created : 11 August 2009<br>
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques LESCOT</a>
+ */
+public class DocPage extends Page implements IDocPage
+{
+ private EObject documentedElement;
+
+ // SWT Widgets
+ private Composite mainComp;
+
+ protected CommentsComposite commentsComposite;
+
+ protected ResourcesComposite resourcesComposite;
+
+ private TabFolder tabFolder;
+
+ /**
+ * This constant is used to determine if the composite has to insert a text field
+ */
+ public static final int STYLE_TEXT_TYPE = 1 << 28;
+
+ /**
+ * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent)
+ {
+ mainComp = new Composite(parent, SWT.NONE);
+ mainComp.setLayout(new GridLayout());
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ tabFolder = new TabFolder(mainComp, SWT.TOP);
+ tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createCommentsTabItem(tabFolder);
+ createResourcesTabItem(tabFolder);
+ }
+
+ /**
+ * Create the content of the comments tab item. It contains a multi lines text field in order to edit the comments
+ * of the documentation.
+ *
+ * @param parent the parent tab folder
+ */
+ private void createCommentsTabItem(TabFolder parent)
+ {
+ TabItem tabItem = new TabItem(parent, SWT.NONE);
+ tabItem.setText(Messages.AbstractDocPage_commentsTitle);
+
+ Composite container = new Composite(parent, SWT.NONE);
+
+ GridLayout containerLayout = new GridLayout();
+ containerLayout.marginWidth = 0;
+ containerLayout.marginHeight = 0;
+ container.setLayout(containerLayout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ tabItem.setControl(container);
+
+ commentsComposite = createCommentsComposite(container);
+ commentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ /**
+ * Create the content of the resources tab item. It contains a list and three buttons in order to view, add, remove
+ * and edit linked resources.
+ *
+ * @param parent the parent tab folder
+ */
+ private void createResourcesTabItem(TabFolder parent)
+ {
+ TabItem tabItem = new TabItem(parent, SWT.NONE);
+ tabItem.setText(Messages.AbstractDocPage_resourcesTitle);
+
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout containerLayout = new GridLayout();
+ containerLayout.marginWidth = 0;
+ containerLayout.marginHeight = 0;
+ container.setLayout(containerLayout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ tabItem.setControl(container);
+
+ resourcesComposite = new ResourcesComposite(container, SWT.NONE);
+ resourcesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ /**
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
+ public Control getControl()
+ {
+ return mainComp;
+ }
+
+ /**
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection)
+ {
+ manageDocumentatedElement(part, selection, true);
+ }
+
+ protected void manageDocumentatedElement(IWorkbenchPart part, ISelection selection, boolean checkResources)
+ {
+ EObject elt = getSelectedModelElement(selection);
+ if (elt == null || elt != documentedElement)
+ {
+ documentedElement = elt;
+ if (commentsComposite != null && !commentsComposite.isDisposed())
+ {
+ commentsComposite.setActivePart(part);
+ commentsComposite.setDocumentedElement(documentedElement);
+ }
+ if (resourcesComposite != null && !resourcesComposite.isDisposed())
+ {
+ resourcesComposite.setActivePart(part);
+ resourcesComposite.setDocumentedElement(documentedElement);
+ }
+ if (documentedElement != null && checkResources)
+ {
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(part);
+ if (documentationPartHandler != null) {
+ boolean readOnly = documentationPartHandler.isReadOnly(part, documentedElement);
+ commentsComposite.setReadOnly(readOnly);
+ resourcesComposite.setReadOnly(readOnly);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.part.Page#setFocus()
+ */
+ @Override
+ public void setFocus()
+ {
+ if (commentsComposite != null && !commentsComposite.isDisposed())
+ {
+ commentsComposite.setFocus();
+ }
+ }
+
+ protected CommentsComposite createCommentsComposite(Composite parent)
+ {
+ return new CommentsComposite(parent, SWT.NONE | STYLE_TEXT_TYPE);
+ }
+
+ /**
+ * Return the model element on which the documentation will be attached. Default implementation works only for
+ * EModelElement elements. Subclasses may override this method in order to provide their own check on the selected
+ * element type.
+ *
+ * @param selection the initial selection
+ * @return the model element on which the documentation will be attached
+ */
+ protected EObject getSelectedModelElement(ISelection selection)
+ {
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1)
+ {
+ Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
+
+ if (selectedObject instanceof EObject)
+ {
+ return (EObject) selectedObject;
+ }
+ if (selectedObject instanceof IAdaptable)
+ {
+ Object adaptedObject = ((IAdaptable) selectedObject).getAdapter(EObject.class);
+ if (adaptedObject != null)
+ {
+ return (EObject) adaptedObject;
+ }
+ }
+
+ Object adaptedObject = Platform.getAdapterManager().getAdapter(selectedObject, EObject.class);
+ if (adaptedObject != null)
+ {
+ return (EObject) adaptedObject;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPageComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPageComposite.java
new file mode 100644
index 00000000000..1da226f6653
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocPageComposite.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies) - initial API and implementation
+ * Mathieu Garcia (Anyware Technologies) - initial API and implementation
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ * Thomas Friol (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.documentation.DocumentationManager;
+import org.eclipse.papyrus.documentation.IDocumentationChangedListener;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * A class defining an empty composite to use in an IDocPage. <br>
+ * Creation : 10 oct. 2005 <br>
+ *
+ * @author <a href="mailto:thomas.friol@anyware-tech.com">Thomas FRIOL</a>
+ */
+public abstract class DocPageComposite extends Composite implements IDocumentationChangedListener
+{
+ IWorkbenchPart activePart = null;
+
+ /** The model element to be documented */
+ private EObject documentedElement;
+
+ /**
+ * Construct a new empty DocPageComposite.
+ *
+ * @param parent the parent composite
+ * @param style the composite style
+ */
+ public DocPageComposite(Composite parent, int style)
+ {
+ super(parent, style);
+ setLayout(new GridLayout());
+
+ this.addDisposeListener(new DisposeListener()
+ {
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
+ */
+ public void widgetDisposed(DisposeEvent e)
+ {
+ handleDispose();
+ }
+ });
+
+ DocumentationManager.getInstance().registerDocumentationChangedListener(this);
+ createContents(this);
+ }
+
+ /**
+ * Change the edited object
+ *
+ * @param modelElement the edited object
+ */
+ public void setDocumentedElement(EObject modelElement)
+ {
+ if (modelElement == null || this.documentedElement != modelElement)
+ {
+ this.documentedElement = modelElement;
+ refresh();
+ }
+ }
+
+ /**
+ * Get the element to be documented
+ *
+ * @return EObject
+ */
+ public EObject getDocumentedElement()
+ {
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(getActivePart());
+ if (documentationPartHandler != null) {
+ EObject associatedDiagram = documentationPartHandler.getAssociatedDiagram(getActivePart(), documentedElement);
+ if (associatedDiagram != null) {
+ return associatedDiagram;
+ }
+ }
+ return documentedElement;
+ }
+
+ public void setActivePart(IWorkbenchPart part) {
+ activePart = part;
+ }
+
+ public IWorkbenchPart getActivePart() {
+ return activePart;
+ }
+
+ /**
+ * Called when the composite is disposed. <b>Subclasses must release local resources and listeners here.</b>
+ */
+ protected void handleDispose()
+ {
+ DocumentationManager.getInstance().unregisterDocumentationChangedListener(this);
+ }
+
+ /**
+ * Creates the content of this composite. Clients should override this method to create their own composite.
+ *
+ * @param parent the parent composite
+ */
+ protected abstract void createContents(Composite parent);
+
+ /**
+ * Informs this composite that it needs to be refresh.
+ */
+ protected void refresh()
+ {
+ // Do nothing
+ }
+
+ /**
+ * Set the composite read only
+ *
+ * @param readOnly
+ */
+ public void setReadOnly(boolean readOnly)
+ {
+ this.setEnabled(!readOnly);
+ }
+
+ public void documentationChanged(EObject eObject) {
+ // TODO don't refresh if not the documented element
+ if (Display.getCurrent() != Display.getDefault())
+ {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ refresh();
+ }
+ });
+ }
+ else
+ {
+ refresh();
+ }
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocView.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocView.java
new file mode 100644
index 00000000000..734a77130c8
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocView.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies), Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.IContributedContentsView;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.PageBookView;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+
+/**
+ * Generic view that display UI to comment objects from the model<br>
+ * Created : 3 June 2005<br>
+ * Updated : 11 August 2009<br>
+ *
+ * @author <a href="mailto:david@anyware-tech.com">David Sciamma</a>
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques LESCOT</a>
+ */
+public class DocView extends PageBookView implements ISelectionListener
+{
+
+ /** ID of the Documentation view */
+ public static final String VIEW_ID = "org.eclipse.papyrus.documentation.view.DocView"; //$NON-NLS-1$
+
+ /**
+ * The initial selection when the doc view opens
+ */
+ private ISelection bootstrapSelection;
+
+ /**
+ * Creates a documentation view.
+ */
+ public DocView()
+ {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
+ */
+ protected IPage createDefaultPage(PageBook book)
+ {
+ IDocPage page = new EmptyDocPage();
+ initPage(page);
+ page.createControl(book);
+ return page;
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPart#dispose()
+ */
+ public void dispose()
+ {
+ // run super.
+ super.dispose();
+
+ // remove ourselves as a selection listener
+ getSite().getPage().removeSelectionListener(this);
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
+ */
+ protected PageRec doCreatePage(IWorkbenchPart part)
+ {
+ // Try to get a custom doc page.
+ IDocPage page = (IDocPage) part.getAdapter(IDocPage.class);
+ if (page == null)
+ {
+ page = (IDocPage) Platform.getAdapterManager().loadAdapter(part, IDocPage.class.getName());
+ }
+ if (page == null)
+ {
+ if (DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(part) != null) {
+ page = new DocPage();
+ }
+ }
+ if (page != null)
+ {
+ initPage(page);
+ page.createControl(getPageBook());
+ return new PageRec(part, page);
+ }
+
+ // Use the default page
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.ui.part.PageBookView.PageRec)
+ */
+ protected void doDestroyPage(IWorkbenchPart part, PageRec rec)
+ {
+ IDocPage page = (IDocPage) rec.page;
+ page.dispose();
+ rec.dispose();
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
+ */
+ protected IWorkbenchPart getBootstrapPart()
+ {
+ IWorkbenchPage page = getSite().getPage();
+ if (page != null)
+ {
+ bootstrapSelection = page.getSelection();
+ return page.getActivePart();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite)
+ */
+ public void init(IViewSite site) throws PartInitException
+ {
+ site.getPage().addSelectionListener(this);
+ super.init(site);
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
+ */
+ protected boolean isImportant(IWorkbenchPart part)
+ {
+ return part instanceof IEditorPart || part instanceof IViewPart;
+ }
+
+ /**
+ * The <code>DocView</code> implementation of this <code>IPartListener</code> method first sees if the active part
+ * is an <code>IContributedContentsView</code> adapter and if so, asks it for its contributing part.
+ *
+ * @see org.eclipse.ui.part.PageBookView#partActivated(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partActivated(IWorkbenchPart part)
+ {
+ IContributedContentsView view = (IContributedContentsView) part.getAdapter(IContributedContentsView.class);
+ IWorkbenchPart source = null;
+ if (view != null)
+ {
+ source = view.getContributingPart();
+ }
+ if (source != null)
+ {
+ super.partActivated(source);
+ }
+ else
+ {
+ super.partActivated(part);
+ }
+
+ // When the view is first opened, pass the selection to the page
+ if (bootstrapSelection != null)
+ {
+ IDocPage page = (IDocPage) getCurrentPage();
+ if (page != null)
+ {
+ page.selectionChanged(part, bootstrapSelection);
+ }
+ bootstrapSelection = null;
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection sel)
+ {
+ // we only manage editor, outline and views selections
+ if (part instanceof IEditorPart || part instanceof ContentOutline || (part instanceof IViewPart && !(part instanceof DocView)))
+ {
+ // pass the selection to the page
+ IDocPage page = (IDocPage) getCurrentPage();
+ if (page != null)
+ {
+ page.selectionChanged(part, sel);
+ }
+ }
+ }
+
+ /**
+ * Returns the editor which contributed the current page to this view.
+ *
+ * @return the editor which contributed the current page or <code>null</code> if no editor contributed the current
+ * page
+ */
+ private IWorkbenchPart getContributingEditor()
+ {
+ return getCurrentContributingPart();
+ }
+
+ /**
+ * @see org.eclipse.ui.part.PageBookView#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class key)
+ {
+ if (key == IContributedContentsView.class)
+ {
+ return new IContributedContentsView()
+ {
+ public IWorkbenchPart getContributingPart()
+ {
+ return getContributingEditor();
+ }
+ };
+ }
+
+ return super.getAdapter(key);
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocViewPlugin.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocViewPlugin.java
new file mode 100644
index 00000000000..8a64a1ae142
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocViewPlugin.java
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.net.URL;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class DocViewPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.documentation.view"; //$NON-NLS-1$
+
+ // The shared instance
+ private static DocViewPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public DocViewPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ // load images in the registry
+ getImageRegistry().put("EDIT", imageDescriptorFromPlugin(PLUGIN_ID, "icons/edit.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("EXTERNAL_RESOURCE", imageDescriptorFromPlugin(PLUGIN_ID, "icons/externalResource.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("HTML_EDITOR", imageDescriptorFromPlugin(PLUGIN_ID, "icons/htmlEditor.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("MODEL_LINK", imageDescriptorFromPlugin(PLUGIN_ID, "icons/application_link.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("TEXT_COLOR", imageDescriptorFromPlugin(PLUGIN_ID, "icons/TextColor.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("TEXT_HIGHLIGHT", imageDescriptorFromPlugin(PLUGIN_ID, "icons/TextHighlight.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("INSERT_ROW", imageDescriptorFromPlugin(PLUGIN_ID, "icons/InsertTableRow.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("DELETE_ROW", imageDescriptorFromPlugin(PLUGIN_ID, "icons/DeleteTableRow.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("INSERT_COLUMN", imageDescriptorFromPlugin(PLUGIN_ID, "icons/InsertTableCol.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ getImageRegistry().put("DELETE_COLUMN", imageDescriptorFromPlugin(PLUGIN_ID, "icons/DeleteTableCol.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DocViewPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the active workbench shell
+ *
+ * @return the active workbench shell
+ */
+ public static Shell getActiveWorkbenchShell()
+ {
+ IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow();
+ if (workBenchWindow == null)
+ {
+ return null;
+ }
+ return workBenchWindow.getShell();
+ }
+
+ /**
+ * Returns the active workbench page or <code>null</code> if none.
+ *
+ * @return the active workbench page
+ */
+ public static IWorkbenchPage getActivePage()
+ {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null)
+ {
+ return window.getActivePage();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the active workbench window
+ *
+ * @return the active workbench window
+ */
+ public static IWorkbenchWindow getActiveWorkbenchWindow()
+ {
+ if (getDefault() == null)
+ {
+ return null;
+ }
+ IWorkbench workBench = getDefault().getWorkbench();
+ if (workBench == null)
+ {
+ return null;
+ }
+ return workBench.getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Returns the workspace instance.
+ *
+ * @return the current workspace
+ */
+ public static IWorkspace getWorkspace()
+ {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public static IEditorPart getActiveEditor() {
+ IWorkbenchPage page = getActivePage();
+ if (page != null) {
+ return page.getActiveEditor();
+ }
+ return null;
+ }
+
+ /**
+ * Open an url with the configured web browser in the preferences pages.
+ *
+ * @param url the url to open
+ */
+ public static void openURL(URL url)
+ {
+ try
+ {
+ IWorkbenchBrowserSupport support = getDefault().getWorkbench().getBrowserSupport();
+ IWebBrowser browser = support.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR
+ | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.STATUS, url.toString(), null,
+ null);
+ browser.openURL(url);
+ }
+ catch (PartInitException pie)
+ {
+
+ }
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocumentionPartHandlerRegistry.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocumentionPartHandlerRegistry.java
new file mode 100644
index 00000000000..f9cd16b48e4
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/DocumentionPartHandlerRegistry.java
@@ -0,0 +1,95 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.documentation.IDocumentationChangedListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+
+public class DocumentionPartHandlerRegistry {
+
+ private static class DocumentionPartHandlerRegistryHolder {
+
+ public static final DocumentionPartHandlerRegistry instance = new DocumentionPartHandlerRegistry();
+ }
+
+ public static DocumentionPartHandlerRegistry getInstance() {
+ return DocumentionPartHandlerRegistryHolder.instance;
+ }
+
+ private static final String DOCUMENTATIONPARTHANDLER_EXTENSION_ID = "org.eclipse.papyrus.documentation.view.documentationPartHandler"; //$NON-NLS-1$
+
+ private static final String DOCUMENTATIONPARTHANDLER_ID = "documentationPartHandler"; //$NON-NLS-1$
+
+
+ private Set<IDocumentationPartHandler> documentationPartHandlers = new HashSet<IDocumentationPartHandler>();
+
+ private Set<IDocumentationChangedListener> documentationChangedListeners = new HashSet<IDocumentationChangedListener>();
+
+ private DocumentionPartHandlerRegistry() {
+ initializeMap();
+ }
+
+ public IDocumentationPartHandler getDocumentationPartHandler(IWorkbenchPart part) {
+ for (IDocumentationPartHandler documentationPartHandler : documentationPartHandlers) {
+ if (documentationPartHandler.canHandlePart(part)) {
+ return documentationPartHandler;
+ }
+ }
+ return null;
+ }
+
+ private void initializeMap() {
+ // Reading data from plugins
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(DOCUMENTATIONPARTHANDLER_EXTENSION_ID);
+ for(int i = 0; i < configElements.length; i++) {
+ initializeOne(configElements[i]);
+ }
+ }
+
+ private void initializeOne(IConfigurationElement iConfigurationElement) {
+ try {
+ IDocumentationPartHandler documentationPartHandler = (IDocumentationPartHandler)iConfigurationElement.createExecutableExtension(DOCUMENTATIONPARTHANDLER_ID);
+ documentationPartHandlers.add(documentationPartHandler);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void registerDocumentationChangedListener(IDocumentationChangedListener listener) {
+ documentationChangedListeners.add(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void unregisterDocumentationChangedListener(IDocumentationChangedListener listener) {
+ documentationChangedListeners.remove(listener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Set<IDocumentationChangedListener> getRegisteredDocumentationChangedListeners() {
+ return documentationChangedListeners;
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/EmptyDocPage.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/EmptyDocPage.java
new file mode 100644
index 00000000000..6cbd51df0be
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/EmptyDocPage.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2005 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies), Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.Page;
+
+/**
+ * This doc page is used when no documentation can be defined on the current
+ * object.<br>
+ * creation : 3 juin 2005
+ *
+ * @author <a href="mailto:david@anyware-tech.com">David Sciamma</a>
+ */
+public class EmptyDocPage extends Page implements IDocPage
+{
+ private Composite mainComp;
+
+ /**
+ * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent)
+ {
+ mainComp = new Composite(parent, SWT.NONE);
+ mainComp.setLayout(new GridLayout());
+ mainComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label text = new Label(mainComp, SWT.NONE);
+ text.setText(Messages.EmptyDocPage_noDoc);
+ }
+
+ /**
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
+ public Control getControl()
+ {
+ return mainComp;
+ }
+
+ /**
+ * @see org.eclipse.ui.part.Page#setFocus()
+ */
+ public void setFocus()
+ {
+ // Do nothing
+ }
+
+ /**
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection)
+ {
+ // Do nothing
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ExternalResourceEditorInput.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ExternalResourceEditorInput.java
new file mode 100644
index 00000000000..3896cd710ac
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ExternalResourceEditorInput.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2005 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies),
+ * Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies),
+ * Thomas Friol (Anyware Technologies)
+ * - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IPathEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * A class defining an editor input in order to be able to visualize external
+ * resources in eclipse editors.</br> This class has been copied from
+ * org.eclipse.ui.internal.editors.text.JavaFileEditorInput.<br/> Creation : 11
+ * oct. 2005
+ *
+ * @author <a href="mailto:thomas.friol@anyware-tech.com">Thomas FRIOL</a>
+ */
+public class ExternalResourceEditorInput implements IPathEditorInput, ILocationProvider
+{
+
+ /**
+ * The workbench adapter which simply provides the label.
+ *
+ * @since 3.1
+ */
+ private class WorkbenchAdapter implements IWorkbenchAdapter
+ {
+ /*
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren(Object o)
+ {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object object)
+ {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o)
+ {
+ return ((ExternalResourceEditorInput) o).getName();
+ }
+
+ /*
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o)
+ {
+ return null;
+ }
+ }
+
+ private File fFile;
+
+ private WorkbenchAdapter fWorkbenchAdapter = new WorkbenchAdapter();
+
+ public ExternalResourceEditorInput(File file)
+ {
+ super();
+ fFile = file;
+ fWorkbenchAdapter = new WorkbenchAdapter();
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ public boolean exists()
+ {
+ return fFile.exists();
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ public ImageDescriptor getImageDescriptor()
+ {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ public String getName()
+ {
+ return fFile.getName();
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ public IPersistableElement getPersistable()
+ {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ public String getToolTipText()
+ {
+ return fFile.getAbsolutePath();
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter)
+ {
+ if (ILocationProvider.class.equals(adapter))
+ {
+ return this;
+ }
+ if (IWorkbenchAdapter.class.equals(adapter))
+ {
+ return fWorkbenchAdapter;
+ }
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /*
+ * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
+ */
+ public IPath getPath(Object element)
+ {
+ if (element instanceof ExternalResourceEditorInput)
+ {
+ ExternalResourceEditorInput input = (ExternalResourceEditorInput) element;
+ return Path.fromOSString(input.fFile.getAbsolutePath());
+ }
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.ui.IPathEditorInput#getPath()
+ * @since 3.1
+ */
+ public IPath getPath()
+ {
+ return Path.fromOSString(fFile.getAbsolutePath());
+ }
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+
+ if (o instanceof ExternalResourceEditorInput)
+ {
+ ExternalResourceEditorInput input = (ExternalResourceEditorInput) o;
+ return fFile.equals(input.fFile);
+ }
+
+ if (o instanceof IPathEditorInput)
+ {
+ IPathEditorInput input = (IPathEditorInput) o;
+ return getPath().equals(input.getPath());
+ }
+
+ return false;
+ }
+
+ /*
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return fFile.hashCode();
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocPage.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocPage.java
new file mode 100644
index 00000000000..6dbce15013e
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocPage.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2005 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies), Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+/**
+ * This interface is used to define a page where the documentation about the
+ * selected object can be filled.<br>
+ * creation : 3 juin 2005
+ *
+ * @author <a href="mailto:david@anyware-tech.com">David Sciamma</a>
+ */
+public interface IDocPage extends IPageBookViewPage, ISelectionListener
+{
+ // Just typed
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocumentationPartHandler.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocumentationPartHandler.java
new file mode 100644
index 00000000000..15fbd2eb39c
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IDocumentationPartHandler.java
@@ -0,0 +1,63 @@
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.documentation.IDocumentationManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * This interface specifies editor-specific behavior of the doc view
+ * @author mvelten
+ *
+ */
+public interface IDocumentationPartHandler {
+ /**
+ * Test if the part can be handled by the implementation
+ * @param part
+ * @return
+ */
+ public boolean canHandlePart(IWorkbenchPart part);
+
+ /**
+ * @return the documentation manager
+ */
+ public IDocumentationManager getDocumentationManager();
+
+ /**
+ * if an associated diagram exists its model element is returned
+ * @param part
+ * @param eObject
+ * @return the diagram element or null
+ */
+ public EObject getAssociatedDiagram(IWorkbenchPart part, EObject eObject);
+
+ /**
+ * Execute an EMF command
+ * @param part
+ * @param cmd
+ */
+ public void executeCommand(IWorkbenchPart part, Command cmd);
+
+ /**
+ * Open an element (understand one of its associated diagram if any) in the current editor
+ * @param part
+ * @param elementUri
+ */
+ public void openElement(IWorkbenchPart part, URI elementUri);
+
+ /**
+ * Open a dialog to select an element in the model of the editor
+ * @param part
+ * @return the selected element
+ */
+ public EObject openElementSelectionDialog(IWorkbenchPart part);
+
+ /**
+ * Check if the element can be edited in the editor.
+ * @param part
+ * @param eObject
+ * @return
+ */
+ public boolean isReadOnly(IWorkbenchPart part, EObject eObject);
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IText.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IText.java
new file mode 100644
index 00000000000..2aec214ee28
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/IText.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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:
+ * Jeremie Belmudes (Atos Origin) Jeremie.Belmudes@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Interface representing a text widget
+ * @author jbelmude
+ *
+ */
+public interface IText {
+
+ /** makes the widget editable or not */
+ void setEditable(boolean isChangeable);
+
+ /** makes the widget enable or not */
+ void setEnabled(boolean isChangeable);
+
+ /** set the layout data for the text widget */
+ void setLayoutData(Object layoutData);
+
+ /** get the global control for the widget */
+ Control getControl();
+
+ /** set a specific text to the widget */
+ void setText(String string);
+
+ /** get the text of the widget */
+ String getText();
+
+ /** changes the background color of the widget */
+ void setBackground(Color color);
+
+ /** changes the foreground color of the widget */
+ void setForeground(Color color);
+
+ /** get the control corresponding to the text for the widget */
+ Control getTextControl();
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/Messages.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/Messages.java
new file mode 100644
index 00000000000..43cf0f4b855
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/Messages.java
@@ -0,0 +1,63 @@
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.documentation.view.messages"; //$NON-NLS-1$
+
+ public static String AbstractDocPage_commentsTitle;
+
+ public static String AbstractDocPage_resourcesTitle;
+
+ public static String AddElementLinkAction_text;
+
+ public static String CommentsComposite_docCurrent;
+
+ public static String DeleteTableColumnAction_text;
+
+ public static String DeleteTableColumnAction_title;
+
+ public static String DeleteTableRowAction_text;
+
+ public static String DeleteTableRowAction_title;
+
+ public static String EmptyDocPage_noDoc;
+ public static String InsertTableColumnAction_text;
+
+ public static String InsertTableColumnAction_title;
+
+ public static String InsertTableRowAction_text;
+
+ public static String InsertTableRowAction_title;
+
+ public static String ResourcesComposite_add;
+
+ public static String ResourcesComposite_deleteResourcesConfirmation;
+
+ public static String ResourcesComposite_edit;
+
+ public static String ResourcesComposite_remove;
+
+ public static String ResourcesComposite_resourcesRemoving;
+
+ public static String RichTextEditorDialog_useRichText;
+ public static String SpellingTextComposite_copy;
+
+ public static String SpellingTextComposite_cut;
+
+ public static String SpellingTextComposite_paste;
+
+ public static String SpellingTextComposite_selectAll;
+
+ public static String TextColorAction_title;
+
+ public static String TextHighlightAction_title;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/PlainTextComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/PlainTextComposite.java
new file mode 100644
index 00000000000..22cff950249
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/PlainTextComposite.java
@@ -0,0 +1,92 @@
+/***********************************************************************
+ * Copyright (c) 2008 Anyware Technologies and others
+ *
+ * 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:
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ **********************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A SpellingText composite used to edit some documentation in a plain text mode.<br>
+ * Creation : 20 August 2008<br>
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques Lescot</a>
+ */
+public class PlainTextComposite extends SpellingTextComposite {
+
+
+ /**
+ * Menu id for the overview ruler context menu.
+ *
+ *
+ * @since 3.4
+ */
+ public final static String DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID = "#OverviewRulerContext"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent composite
+ * @param style
+ * the composite style
+ */
+ public PlainTextComposite(Composite parent, int style)
+ {
+ super(parent, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP, true);
+ }
+
+ /**
+ * Sets the given text into the <code>EAnnotationCommentsComposite</code>
+ *
+ * @param text
+ * text to put into the <code>EAnnotationCommentsComposite</code>
+ */
+ public void setDocumentationValue(String text) {
+ setText(text);
+ }
+
+ /**
+ * This method returns the text contained in the
+ * <code>EAnnotationCommentsComposite</code>
+ *
+ * @return the text contained in the
+ * <code>EAnnotationCommentsComposite</code>
+ */
+ public String getDocumentationValue() {
+ return getText();
+ }
+
+ /**
+ * @return true if the text area is selected, false else
+ *
+ * @see org.eclipse.swt.widgets.Composite#setFocus()
+ */
+ @Override
+ public boolean setFocus() {
+ if (document != null && !sourceViewer.getControl().isDisposed()) {
+ return sourceViewer.getControl().setFocus();
+ }
+ return false;
+ }
+
+ /**
+ * Enable or disable the text area
+ */
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed())
+ {
+ super.setEnabled(enabled);
+ }
+ }
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ResourcesComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ResourcesComposite.java
new file mode 100644
index 00000000000..41a335b92eb
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/ResourcesComposite.java
@@ -0,0 +1,602 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies) - initial API and implementation
+ * Mathieu Garcia (Anyware Technologies) - initial API and implementation
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ * Thomas Friol (Anyware Technologies) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.DocumentationUnsupportedException;
+import org.eclipse.papyrus.documentation.IDocumentationManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ResourceSelectionDialog;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * A class defining a composite to edit the resources of a EModelElement as an EAnnotation. <br>
+ * Creation : 10 oct. 2005
+ *
+ * @author <a href="mailto:thomas.friol@anyware-tech.com">Thomas FRIOL</a>
+ */
+public class ResourcesComposite extends DocPageComposite
+{
+ private TreeViewer resourcesList;
+
+ private Button addResourcesButton;
+
+ private Button removeResourcesButton;
+
+ private Button editResourceButton;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ private SelectionListener buttonSelectionListener;
+
+ private IDoubleClickListener listDoubleClickListener;
+
+ private KeyListener listKeyListener;
+
+ /**
+ * Constructor.
+ *
+ * @param parent the parent composite
+ * @param style the composite style
+ * @param editingDomainProvider the provider of editing domain to execute commands
+ */
+ public ResourcesComposite(Composite parent, int style)
+ {
+ super(parent, style);
+ }
+
+ /**
+ * @see org.topcased.modeler.documentation.DocPageComposite#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createContents(Composite parent)
+ {
+ selectionChangedListener = new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ handleResourcesListSelectionChanged();
+ }
+
+ };
+ buttonSelectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (e.getSource() == addResourcesButton)
+ {
+ handleAddResources();
+ }
+ else if (e.getSource() == removeResourcesButton)
+ {
+ handleRemoveResources();
+ }
+ else if (e.getSource() == editResourceButton)
+ {
+ handleEditResource();
+ }
+ }
+ };
+
+ listDoubleClickListener = new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ handleOpenResource();
+ }
+ };
+
+ listKeyListener = new KeyAdapter()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ if (e.keyCode == SWT.DEL)
+ {
+ handleRemoveResources();
+ }
+ }
+ };
+
+ resourcesList = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ resourcesList.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ resourcesList.setContentProvider(new ArrayTreeContentProvider());
+ resourcesList.setLabelProvider(new ResourcesLabelProvider());
+ resourcesList.addSelectionChangedListener(selectionChangedListener);
+ resourcesList.addDoubleClickListener(listDoubleClickListener);
+ resourcesList.getTree().addKeyListener(listKeyListener);
+
+ Composite actionsComp = new Composite(parent, SWT.NONE);
+ actionsComp.setLayout(new GridLayout(3, true));
+ actionsComp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
+
+ addResourcesButton = new Button(actionsComp, SWT.PUSH);
+ addResourcesButton.setText(Messages.ResourcesComposite_add);
+ addResourcesButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ addResourcesButton.addSelectionListener(buttonSelectionListener);
+
+ removeResourcesButton = new Button(actionsComp, SWT.PUSH);
+ removeResourcesButton.setText(Messages.ResourcesComposite_remove);
+ removeResourcesButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ removeResourcesButton.addSelectionListener(buttonSelectionListener);
+
+ editResourceButton = new Button(actionsComp, SWT.PUSH);
+ editResourceButton.setText(Messages.ResourcesComposite_edit);
+ editResourceButton.setLayoutData(new GridData(GridData.FILL_BOTH));
+ editResourceButton.addSelectionListener(buttonSelectionListener);
+ }
+
+ /**
+ * @see org.topcased.modeler.documentation.DocPageComposite#refresh()
+ */
+ protected void refresh()
+ {
+ resourcesList.setInput(null);
+ resourcesList.getTree().setEnabled(getDocumentedElement() != null);
+ addResourcesButton.setEnabled(getDocumentedElement() != null);
+ removeResourcesButton.setEnabled(false);
+ editResourceButton.setEnabled(false);
+ if (getDocumentedElement() != null)
+ {
+ IWorkbenchPart activePart = getActivePart();
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(activePart);
+ if (documentationPartHandler != null) {
+ try {
+ if (documentationPartHandler != null) {
+ EObject associatedDiagram = documentationPartHandler.getAssociatedDiagram(activePart, getDocumentedElement());
+ EObject toDocument = associatedDiagram == null ? getDocumentedElement() : associatedDiagram;
+ List<URI> resources = documentationPartHandler.getDocumentationManager().getAssociatedResources(toDocument);
+ resourcesList.setInput(resources);
+ }
+ } catch (DocumentationUnsupportedException e) {
+ }
+ }
+ }
+ }
+
+ protected IDocumentationPartHandler getDocumentationPartHandler(IWorkbenchPart part) {
+ if (getDocumentedElement() != null)
+ {
+ return DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(part);
+ }
+ return null;
+ }
+
+ protected Command getAddAssociatedResourceCommand(URI uriResource) {
+ IDocumentationPartHandler documentationPartHandler = getDocumentationPartHandler(getActivePart());
+ if (documentationPartHandler != null) {
+ EObject associatedDiagram = documentationPartHandler.getAssociatedDiagram(getActivePart(), getDocumentedElement());
+ EObject toDocument = associatedDiagram == null ? getDocumentedElement() : associatedDiagram;
+ IDocumentationManager documentationManager = documentationPartHandler.getDocumentationManager();
+ if (documentationManager != null) {
+ return documentationManager.getAddAssociatedResourceCommand(toDocument, uriResource);
+ }
+ }
+ return null;
+ }
+
+ protected Command getRemoveAssociatedResourceCommand(URI uriResource) {
+ IDocumentationPartHandler documentationPartHandler = getDocumentationPartHandler(getActivePart());
+ if (documentationPartHandler != null) {
+ EObject associatedDiagram = documentationPartHandler.getAssociatedDiagram(getActivePart(), getDocumentedElement());
+ EObject toDocument = associatedDiagram == null ? getDocumentedElement() : associatedDiagram;
+ IDocumentationManager documentationManager = documentationPartHandler.getDocumentationManager();
+ if (documentationManager != null) {
+ return documentationManager.getRemoveAssociatedResourceCommand(toDocument, uriResource);
+ }
+ }
+ return null;
+ }
+
+ private void executeCommand(CompoundCommand compoundCmd) {
+ IWorkbenchPart part = getActivePart();
+ if (getDocumentationPartHandler(part) != null) {
+ getDocumentationPartHandler(part).executeCommand(part, compoundCmd);
+ }
+ }
+
+ private void handleResourcesListSelectionChanged()
+ {
+ IStructuredSelection selection = (IStructuredSelection) resourcesList.getSelection();
+ removeResourcesButton.setEnabled(!selection.isEmpty());
+ editResourceButton.setEnabled(selection.size() == 1);
+ }
+
+ private void handleAddResources()
+ {
+ if (getDocumentedElement() != null)
+ {
+ // Get the map of resources to add
+ Set<URI> resourcesToAdd = new HashSet<URI>();
+
+ TypedResourcesSelectionDialog dialog = new TypedResourcesSelectionDialog(getShell());
+ int result = dialog.open();
+ if (result == Window.OK)
+ {
+ switch (dialog.getType())
+ {
+ case TypedResourcesSelectionDialog.REMOTE_RESOURCE:
+ RemoteResourceDialog rrDialog = new RemoteResourceDialog(getShell(), "http://"); //$NON-NLS-1$
+
+ if (rrDialog.open() == Window.OK)
+ {
+ resourcesToAdd.add(URI.createURI(rrDialog.getValue()));
+ }
+ break;
+
+ case TypedResourcesSelectionDialog.EXTERNAL_RESOURCE:
+ FileDialog erDialog = new FileDialog(getShell(), SWT.MULTI);
+ if (erDialog.open() != null)
+ {
+ String[] resources = erDialog.getFileNames();
+ for (int i = 0; i < resources.length; i++)
+ {
+ resourcesToAdd.add(URI.createFileURI(erDialog.getFilterPath() + File.separator + resources[i]));
+ }
+ }
+
+ break;
+
+ /* Default case : WORKSPACE_RESOURCE */
+ default:
+ WorkspaceResourceDialog wrDialog = new WorkspaceResourceDialog(getShell());
+ result = wrDialog.open();
+ if (result == Window.OK)
+ {
+ Object[] resources = wrDialog.getResult();
+ for (int i = 0; i < resources.length; i++)
+ {
+ if (resources[i] instanceof IFile)
+ {
+ resourcesToAdd.add(URI.createPlatformResourceURI(((IFile) resources[i]).getFullPath().toString(), true));
+ }
+ }
+ }
+
+ break;
+ }
+
+ // Execute the add resources command if there are some resources to add
+ CompoundCommand compoundCmd = new CompoundCommand();
+ for (URI uriResource : resourcesToAdd) {
+ compoundCmd.appendIfCanExecute(getAddAssociatedResourceCommand(uriResource));
+ }
+ executeCommand(compoundCmd);
+ }
+ }
+ }
+
+ private void handleRemoveResources()
+ {
+ if (getDocumentedElement() != null)
+ {
+ IStructuredSelection selection = (IStructuredSelection) resourcesList.getSelection();
+ List<URI> resourcesToRemove = (List<URI>)selection.toList();
+
+ // Execute the remove resources command if there are some resources to remove
+ if (!resourcesToRemove.isEmpty())
+ {
+ if (MessageDialog.openQuestion(getShell(), Messages.ResourcesComposite_resourcesRemoving, Messages.ResourcesComposite_deleteResourcesConfirmation))
+ {
+ CompoundCommand compoundCmd = new CompoundCommand();
+ for (URI uriResource : resourcesToRemove) {
+ compoundCmd.appendIfCanExecute(getRemoveAssociatedResourceCommand(uriResource));
+ }
+ executeCommand(compoundCmd);
+ }
+ }
+ }
+ }
+
+ private void handleEditResource()
+ {
+ IStructuredSelection selection = (IStructuredSelection) resourcesList.getSelection();
+ if (selection.size() == 1)
+ {
+ URI uri = (URI)selection.getFirstElement();
+ URI newUri = null;
+ if (uri != null) {
+ if (uri.isPlatform()) {
+ WorkspaceResourceDialog wrDialog = new WorkspaceResourceDialog(getShell());
+ wrDialog.setInitialSelections(new IFile[] {ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))),});
+ if (wrDialog.open() == Window.OK)
+ {
+ newUri = URI.createPlatformResourceURI(((IFile) wrDialog.getResult()[0]).getFullPath().toString(), true);
+ }
+ } else if (uri.isFile()) {
+ FileDialog erDialog = new FileDialog(getShell());
+ erDialog.setFileName(uri.toFileString());
+ newUri = URI.createFileURI(erDialog.open());
+ } else {
+ RemoteResourceDialog rrDialog = new RemoteResourceDialog(getShell(), uri.toString());
+ if (rrDialog.open() == Window.OK)
+ {
+ newUri = URI.createURI(rrDialog.getValue());
+ }
+ }
+
+ if (newUri != null)
+ {
+ CompoundCommand compoundCmd = new CompoundCommand();
+ compoundCmd.appendIfCanExecute(getRemoveAssociatedResourceCommand(uri));
+ compoundCmd.appendIfCanExecute(getAddAssociatedResourceCommand(uri));
+ executeCommand(compoundCmd);
+ }
+ }
+ }
+ }
+
+ private void handleOpenResource()
+ {
+ IStructuredSelection selection = (IStructuredSelection) resourcesList.getSelection();
+ if (selection.size() == 1)
+ {
+ URI uri = (URI)selection.getFirstElement();
+ if (uri.isPlatform()) {
+ String platformString = uri.toPlatformString(true);
+ IFile resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString));
+ try
+ {
+ IDE.openEditor(DocViewPlugin.getActivePage(), resource);
+ }
+ catch (PartInitException pie)
+ {
+ displayErrorDialog("Invalid workspace resource", "The workspace resource '" + platformString + "' cannot be opened.");
+ }
+ } else if (uri.isFile()) {
+ String fileString = uri.toFileString();
+ File resource = new File(fileString);
+ ExternalResourceEditorInput input = new ExternalResourceEditorInput(resource);
+ try
+ {
+ IDE.openEditor(DocViewPlugin.getActivePage(), input, getEditorId(resource));
+ }
+ catch (PartInitException pie)
+ {
+ displayErrorDialog("Invalid external resource", "The external resource '" + fileString + "' cannot be opened.");
+ }
+ } else {
+ String remoteString = uri.toString();
+ try {
+ DocViewPlugin.openURL(new URL(remoteString));
+ } catch (MalformedURLException e) {
+ displayErrorDialog("Invalid remote resource", "The remote resource '" + remoteString + "' cannot be opened.");
+ }
+ }
+ }
+ }
+
+ private void displayErrorDialog(final String title, final String message) {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ MessageDialog.openError(getShell(), (title == null) ? "Error" : title,
+ (message == null) ? "" : message); //$NON-NLS-1$
+ }
+ });
+ }
+
+ /**
+ * Get the editor id to use to open an external resource.<br>
+ * This method is copied from org.eclipse.ui.internal.editors.text.OpenExternalFileAction
+ *
+ * @param file the external resource file
+ * @return an editor id
+ */
+ private String getEditorId(File file)
+ {
+ IWorkbench workbench = DocViewPlugin.getDefault().getWorkbench();
+ IEditorRegistry editorRegistry = workbench.getEditorRegistry();
+ IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
+ if (descriptor != null)
+ {
+ return descriptor.getId();
+ }
+ return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled)
+ {
+ super.setEnabled(enabled);
+ if (resourcesList != null && resourcesList.getControl() != null)
+ {
+ resourcesList.getControl().setEnabled(enabled);
+ }
+ if (this.editResourceButton != null)
+ {
+ this.editResourceButton.setEnabled(enabled);
+ }
+ if (this.removeResourcesButton != null)
+ {
+ this.removeResourcesButton.setEnabled(enabled);
+ }
+ if (this.addResourcesButton != null)
+ {
+ this.addResourcesButton.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Return the content type of the given file.<br/>
+ * This method is copied from org.eclipse.ui.internal.editors.text.OpenExternalFileAction
+ *
+ * @param file a file
+ * @return a content type
+ */
+ private IContentType getContentType(File file)
+ {
+ if (file == null)
+ {
+ return null;
+ }
+
+ InputStream stream = null;
+ try
+ {
+ stream = new FileInputStream(file);
+ return Platform.getContentTypeManager().findContentTypeFor(stream, file.getName());
+ }
+ catch (IOException x)
+ {
+// ModelerPlugin.log(x);
+ return null;
+ }
+ finally
+ {
+ try
+ {
+ if (stream != null)
+ {
+ stream.close();
+ }
+ }
+ catch (IOException x)
+ {
+// ModelerPlugin.log(x);
+ }
+ }
+ }
+
+ /**
+ * A label provider used for the resources list viewer.
+ */
+ private class ResourcesLabelProvider extends LabelProvider
+ {
+ private WorkbenchLabelProvider wlp = new WorkbenchLabelProvider();
+
+ /**
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element)
+ {
+ if (element instanceof URI) {
+ URI uri = (URI)element;
+ if (uri.isPlatform()) {
+ return uri.toPlatformString(true);
+ } else if (uri.isFile()) {
+ return uri.toFileString();
+ } else {
+ return uri.toString();
+ }
+ }
+
+ return "Unknown resource";
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element)
+ {
+ if (element instanceof URI) {
+ URI uri = (URI)element;
+ if (uri.isPlatform()) {
+ IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
+ return wlp.getImage(iFile);
+ } else if (uri.isFile()) {
+ return DocViewPlugin.getDefault().getImageRegistry().get("EXTERNAL_RESOURCE");
+ } else {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+ }
+
+ return null;
+ }
+ }
+
+ /**
+ * A class defining a dialog to add or edit a worksapce resource.
+ */
+ private class WorkspaceResourceDialog extends ResourceSelectionDialog
+ {
+ /**
+ * Constructor
+ *
+ * @param parentShell
+ */
+ public WorkspaceResourceDialog(Shell parentShell)
+ {
+ super(parentShell, ResourcesPlugin.getWorkspace().getRoot(), "Please select the workspace resources to add to the documentation.");
+ }
+ }
+
+ /**
+ * A class defining a dialog to add or edit a remote resource.
+ */
+ private class RemoteResourceDialog extends InputDialog
+ {
+
+ /**
+ * Constructor
+ *
+ * @param parentShell
+ * @param initialValue
+ */
+ public RemoteResourceDialog(Shell parentShell, String initialValue)
+ {
+ super(parentShell, "Remote resource", "Please enter the URL of the remote resource.", initialValue, null);
+ }
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextComposite.java
new file mode 100644
index 00000000000..f5de64892cf
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextComposite.java
@@ -0,0 +1,199 @@
+/***********************************************************************
+ * Copyright (c) 2008 Anyware Technologies
+ *
+ * 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:
+ * Gilles Cannenterre (Anyware Technologies) - initial API and implementation
+ **********************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.epf.richtext.RichText;
+
+/**
+ * A class defining a composite support rich text edition.<br>
+ * creation : 12 juin 2008
+ *
+ * @author <a href="mailto:gilles.cannenterre@anyware-tech.com">Gilles Cannenterre</a>
+ */
+public class RichTextComposite extends Composite
+{
+ private RichText commentsText;
+
+ /**
+ * Constructor.
+ *
+ * @param parent the parent composite
+ * @param style the composite style
+ */
+ public RichTextComposite(Composite parent, int style)
+ {
+ super(parent, style);
+
+ Composite container = new Composite(this, SWT.BORDER);
+ GridLayout richTextLayout = new GridLayout();
+ richTextLayout.marginWidth = 0;
+ richTextLayout.marginHeight = 0;
+ container.setLayout(richTextLayout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ commentsText = new RichText(container, SWT.NONE);
+ commentsText.setEditable(false);
+ commentsText.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // the Rich Text control is a Browser for sure.
+ Browser browser = (Browser) commentsText.getControl();
+ browser.addLocationListener(new URLLocationListener());
+ }
+
+ /**
+ * This method returns the text contained in the <code>RichTextCommentsComposite</code>
+ *
+ * @return the text contained in the <code>RichTextCommentsComposite</code>
+ */
+ public String getDocumentationValue()
+ {
+ return commentsText.getText();
+ }
+
+ /**
+ * Sets the given text into the <code>RichTextCommentsComposite</code>
+ *
+ * @param text text to put into the <code>RichTextCommentsComposite</code>
+ */
+ public void setDocumentationValue(String text)
+ {
+ commentsText.setText(text);
+ }
+
+ /**
+ * A Location Listener that knows how to intercept OOBE action URLs. It also
+ * knows how to update UI navigation history.
+ */
+ private static class URLLocationListener extends LocationAdapter
+ {
+ @Override
+ public void changing(LocationEvent event)
+ {
+ String url = event.location;
+
+ if (url == null) return;
+
+ URLParser parser = new URLParser(url);
+ if (parser.isValidURI())
+ {
+ // stop URL first.
+ event.doit = false;
+
+ // execute the action embedded in the IntroURL
+ parser.runURL();
+ }
+ }
+ }
+ /**
+ * A parser that knows how to parser OOBE action URLs. If URL is a valid url,
+ * it will create an instance of the IntroURL class.
+ */
+ private static class URLParser
+ {
+ private static final String HTTP_PROTOCOL = "http"; //$NON-NLS-1$
+
+ private static final String PLATFORM_PROTOCOL = "platform"; //$NON-NLS-1$
+
+ private URI uri;
+
+ /**
+ * Constructor that create a URL instance, to validate the URL and create a correct URI.
+ */
+ private URLParser(String url)
+ {
+ parseUrl(url);
+ }
+
+ private void parseUrl(String url)
+ {
+ if (url == null) return;
+ this.uri = null;
+ try
+ {
+ // TODO check parsing url
+ // URL has some valid protocol.
+ // Check to see if it is a valid url.
+ URL url_inst = new URL(url);
+ String protocol2 = url_inst.getProtocol();
+ if (protocol2 != null)
+ {
+ // XXX : HACK Extreme hacking on...
+ // there should be a proper way to handle with spaces and URIs.
+ if (protocol2.equalsIgnoreCase(HTTP_PROTOCOL)) {
+ this.uri = URI.createURI(URI.decode(url.replace("http://platform", "platform:").replace("platform::/", "platform:/")));//.replaceAll("%20", " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ else if (protocol2.equalsIgnoreCase(PLATFORM_PROTOCOL)) {
+ this.uri = URI.createURI(URI.decode(url));
+ }
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ // not a valid URL. Just return.
+ }
+ }
+
+
+ /**
+ * @return Returns the isIntroUrl.
+ */
+ private boolean isValidURI()
+ {
+ return uri != null;
+ }
+
+ /**
+ * Fin the EObject with the given URL and try select it on the current Modeler.
+ */
+ private void runURL()
+ {
+ Display display = Display.getCurrent();
+ BusyIndicator.showWhile(display, new Runnable()
+ {
+ public void run()
+ {
+ IEditorPart activeEditor = DocViewPlugin.getActiveEditor();
+ IDocumentationPartHandler documentationEditor = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(activeEditor);
+ if (documentationEditor != null) {
+ documentationEditor.openElement(activeEditor, uri);
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enabled)
+ {
+ if (!isDisposed())
+ {
+ super.setEnabled(enabled);
+ if (commentsText != null && commentsText.getControl() != null)
+ {
+ commentsText.getControl().setEnabled(enabled);
+ }
+ }
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextEditorDialog.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextEditorDialog.java
new file mode 100644
index 00000000000..c1054292ea5
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/RichTextEditorDialog.java
@@ -0,0 +1,228 @@
+/***********************************************************************
+ * Copyright (c) 2008 Anyware Technologies and others
+ *
+ * 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:
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ **********************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.papyrus.documentation.view.actions.AddElementLinkAction;
+import org.eclipse.papyrus.documentation.view.actions.DeleteTableColumnAction;
+import org.eclipse.papyrus.documentation.view.actions.DeleteTableRowAction;
+import org.eclipse.papyrus.documentation.view.actions.InsertTableColumnAction;
+import org.eclipse.papyrus.documentation.view.actions.InsertTableRowAction;
+import org.eclipse.papyrus.documentation.view.actions.TextColorAction;
+import org.eclipse.papyrus.documentation.view.actions.TextHighlightAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.IRichTextToolBar;
+import org.eclipse.epf.richtext.RichText;
+import org.eclipse.epf.richtext.RichTextToolBar;
+import org.eclipse.epf.richtext.actions.AddImageAction;
+import org.eclipse.epf.richtext.actions.AddLinkAction;
+import org.eclipse.epf.richtext.actions.AddOrderedListAction;
+import org.eclipse.epf.richtext.actions.AddTableAction;
+import org.eclipse.epf.richtext.actions.AddUnorderedListAction;
+import org.eclipse.epf.richtext.actions.BoldAction;
+import org.eclipse.epf.richtext.actions.ClearContentAction;
+import org.eclipse.epf.richtext.actions.CopyAction;
+import org.eclipse.epf.richtext.actions.CutAction;
+import org.eclipse.epf.richtext.actions.FindReplaceAction;
+import org.eclipse.epf.richtext.actions.FontNameAction;
+import org.eclipse.epf.richtext.actions.FontSizeAction;
+import org.eclipse.epf.richtext.actions.FontStyleAction;
+import org.eclipse.epf.richtext.actions.IndentAction;
+import org.eclipse.epf.richtext.actions.ItalicAction;
+import org.eclipse.epf.richtext.actions.JustifyCenterAction;
+import org.eclipse.epf.richtext.actions.JustifyLeftAction;
+import org.eclipse.epf.richtext.actions.JustifyRightAction;
+import org.eclipse.epf.richtext.actions.OutdentAction;
+import org.eclipse.epf.richtext.actions.PasteAction;
+import org.eclipse.epf.richtext.actions.SubscriptAction;
+import org.eclipse.epf.richtext.actions.SuperscriptAction;
+import org.eclipse.epf.richtext.actions.TidyActionGroup;
+import org.eclipse.epf.richtext.actions.UnderlineAction;
+
+/**
+ * A dialog using a RichText and its Toolbar to change a documentation
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques Lescot</a>
+ */
+public class RichTextEditorDialog extends Dialog
+{
+ /** The minimum width of the dialog */
+ private static final int MINIMUM_DIALOG_WIDTH = 600;
+
+ /** The minimum height of the dialog */
+ private static final int MINIMUM_DIALOG_HEIGHT = 300;
+
+ private RichText commentsText;
+
+ private String initialValue;
+
+ private String newValue;
+
+ /**
+ * Constructor
+ *
+ * @param parentShell the parent Shell
+ * @param initialValue initial documentation value
+ */
+ public RichTextEditorDialog(Shell parentShell, String initialValue)
+ {
+ super(parentShell);
+
+ setBlockOnOpen(true);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+
+ this.initialValue = initialValue;
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell(Shell newShell)
+ {
+ newShell.setText(Messages.RichTextEditorDialog_useRichText);
+ newShell.setMinimumSize(MINIMUM_DIALOG_WIDTH, MINIMUM_DIALOG_HEIGHT);
+
+ super.configureShell(newShell);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite dialogComposite = (Composite) super.createDialogArea(parent);
+
+ RichTextToolBar toolBar = new RichTextToolBar(dialogComposite, SWT.NONE, commentsText);
+ Composite container = new Composite(dialogComposite, SWT.BORDER);
+ GridLayout richTextLayout = new GridLayout();
+ richTextLayout.marginWidth = 0;
+ richTextLayout.marginHeight = 0;
+ container.setLayout(richTextLayout);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ commentsText = new RichText(container, SWT.NONE);
+ commentsText.setLayoutData(new GridData(GridData.FILL_BOTH));
+ commentsText.setText(initialValue);
+ commentsText.setFocus();
+ fillToolBar(toolBar, commentsText);
+
+ return dialogComposite;
+ }
+
+ /**
+ * Populate actions in the Toolbar to link with the RichText
+ *
+ * @param toolBar The IRichTextToolBar
+ * @param richText The IRichText
+ */
+ private void fillToolBar(IRichTextToolBar toolBar, IRichText richText)
+ {
+ toolBar.addAction(new FontStyleAction(richText));
+ toolBar.addAction(new FontNameAction(richText));
+ toolBar.addAction(new FontSizeAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new CutAction(richText));
+ toolBar.addAction(new CopyAction(richText));
+ toolBar.addAction(new PasteAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new ClearContentAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new BoldAction(richText));
+ toolBar.addAction(new ItalicAction(richText));
+ toolBar.addAction(new UnderlineAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new TextColorAction(richText));
+ toolBar.addAction(new TextHighlightAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new SubscriptAction(richText));
+ toolBar.addAction(new SuperscriptAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new TidyActionGroup(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new AddOrderedListAction(richText));
+ toolBar.addAction(new AddUnorderedListAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new OutdentAction(richText));
+ toolBar.addAction(new IndentAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new JustifyLeftAction(richText));
+ toolBar.addAction(new JustifyCenterAction(richText));
+ toolBar.addAction(new JustifyRightAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new FindReplaceAction(richText)
+ {
+ /**
+ * @see org.eclipse.epf.richtext.actions.FindReplaceAction#execute(org.eclipse.epf.richtext.IRichText)
+ */
+ @Override
+ public void execute(IRichText rText)
+ {
+ rText.getFindReplaceAction().execute(rText);
+ }
+ });
+ toolBar.addSeparator();
+ toolBar.addAction(new AddLinkAction(richText));
+ toolBar.addAction(new AddElementLinkAction(richText));
+ toolBar.addAction(new AddImageAction(richText));
+ toolBar.addSeparator();
+ toolBar.addAction(new AddTableAction(richText));
+
+ // Only add these actions when IE is used to render the Browser
+ if (Platform.getOS().equals("win32")) { //$NON-NLS-1$
+ toolBar.addAction(new InsertTableColumnAction(richText));
+ toolBar.addAction(new DeleteTableColumnAction(richText));
+ toolBar.addAction(new InsertTableRowAction(richText));
+ toolBar.addAction(new DeleteTableRowAction(richText));
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed()
+ {
+ newValue = commentsText.getText();
+
+ super.okPressed();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /**
+ * This method returns the text contained in the <code>RichTextCommentsComposite</code>
+ *
+ * @return the text contained in the <code>RichTextCommentsComposite</code>
+ */
+ public String getDocumentationValue()
+ {
+ return newValue;
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SelectResourceDialog.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SelectResourceDialog.java
new file mode 100644
index 00000000000..9cf0652e8fa
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SelectResourceDialog.java
@@ -0,0 +1,342 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.views.navigator.ResourceComparator;
+
+/**
+ * This dialog displays a EMF files within the workspace. Each file will show its content as and EMF resource.
+ *
+ * Use the filters parameter on the factory method to hide elements.
+ *
+ * @author Alfredo
+ *
+ */
+public class SelectResourceDialog extends ElementTreeSelectionDialog
+{
+
+ public static Object openElementSelection(Object input, ISelectionStatusValidator validator, List<ViewerFilter> viewerFilters, boolean filterTree)
+ {
+
+ return openElementSelection(input, null, null, validator, viewerFilters, filterTree);
+ }
+
+ public static Object openElementSelection(Object input, ILabelProvider labelProvider, ITreeContentProvider contentProvider, ISelectionStatusValidator validator, List<ViewerFilter> viewerFilters, boolean filterTree)
+ {
+
+ if (contentProvider == null)
+ contentProvider = new SelectionContentProvider();
+
+ if (labelProvider == null)
+ labelProvider = new SelectionLabelProvider();
+
+ Shell parent = Display.getCurrent().getActiveShell();
+ SelectResourceDialog dialog = new SelectResourceDialog(parent, validator, labelProvider, contentProvider, filterTree);
+ dialog.setAllowMultiple(false);
+ dialog.setTitle("Import from model");
+ dialog.setMessage("Select the element to import\nWARNING: Stereotypes will not be retrieved from the import model");
+
+ dialog.addFilter(dialog.createDefaultViewerFilter(true));
+ if (viewerFilters != null)
+ {
+ for (ViewerFilter viewerFilter : viewerFilters)
+ {
+ dialog.addFilter(viewerFilter);
+ }
+ }
+
+ dialog.setInput(input);
+ return dialog.open() == Window.OK ? dialog.getSelection() : null;
+ }
+
+ private boolean hasFilteredTree = true;
+
+ private SelectResourceDialog(Shell parent, ISelectionStatusValidator validator, ILabelProvider labelProvider, ITreeContentProvider contentProvider, boolean hasFilteredTree)
+ {
+ super(parent, labelProvider, contentProvider);
+ setComparator(new ResourceComparator(ResourceComparator.NAME));
+ setValidator(validator);
+ this.hasFilteredTree = hasFilteredTree;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ @Override
+ protected TreeViewer doCreateTreeViewer(Composite parent, int style)
+ {
+ TreeViewer viewer;
+ if (hasFilteredTree)
+ {
+ FilteredTree tree = new FilteredTree(parent, style, new PatternFilter(), true);
+ viewer = tree.getViewer();
+ }
+ else
+ {
+ viewer = new TreeViewer(parent, style);
+ }
+ return viewer;
+ }
+
+ public Object getSelection()
+ {
+ Object[] result = getResult();
+ if (result.length == 1)
+ return result[0];
+ return null;
+ }
+
+ private ViewerFilter createDefaultViewerFilter(boolean showFiles)
+ {
+ return new ViewerFilter()
+ {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (element instanceof IResource)
+ {
+ IResource workspaceResource = (IResource) element;
+ return workspaceResource.isAccessible();
+ }
+ return true;
+ }
+ };
+ }
+
+ // Content provider for the selection dialog displaying a tree
+ public static class SelectionContentProvider implements ITreeContentProvider, IResourceChangeListener, IResourceDeltaVisitor
+ {
+
+ private WorkbenchContentProvider resourceContentProvider = new WorkbenchContentProvider();
+
+ private AdapterFactoryContentProvider adapterFactoryContentProvider = new AdapterFactoryContentProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
+
+ private ResourceSet resourceSet = new ResourceSetImpl();
+
+ private Viewer viewer;
+
+ public SelectionContentProvider()
+ {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
+ }
+
+ public Object[] getChildren(Object parentElement)
+ {
+ try
+ {
+ if (parentElement instanceof IFile)
+ {
+ String path = ((IFile) parentElement).getFullPath().toString();
+ URI uri = URI.createPlatformResourceURI(path, true);
+ parentElement = resourceSet.getResource(uri, true);
+ }
+ if (parentElement instanceof IResource)
+ {
+ return resourceContentProvider.getChildren(parentElement);
+ }
+ }
+ catch (Exception e)
+ {
+ return new Object[0];
+ }
+ return adapterFactoryContentProvider.getChildren(parentElement);
+ }
+
+ public Object getParent(Object element)
+ {
+
+ if (element instanceof IResource)
+ return resourceContentProvider.getParent(element);
+
+ return adapterFactoryContentProvider.getParent(element);
+ }
+
+ public boolean hasChildren(Object element)
+ {
+ if (element instanceof IFile)
+ return ((IFile) element).isAccessible() && !((IFile) element).isHidden();
+ if (element instanceof IResource)
+ return resourceContentProvider.hasChildren(element);
+ return adapterFactoryContentProvider.hasChildren(element);
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getChildren(inputElement);
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ this.viewer = viewer;
+ }
+
+ /**
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event)
+ {
+ IResourceDelta delta = event.getDelta();
+ try
+ {
+ delta.accept(this);
+ }
+ catch (CoreException e)
+ {
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose()
+ {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+
+ resourceContentProvider.dispose();
+ adapterFactoryContentProvider.dispose();
+ }
+
+ /**
+ * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta)
+ {
+ IResource source = delta.getResource();
+
+ switch (delta.getKind())
+ {
+ case IResourceDelta.ADDED:
+ // handle added resource
+ break;
+ case IResourceDelta.REMOVED:
+ // handle removed resource
+ break;
+ case IResourceDelta.CHANGED:
+ // handle changed resource
+ if (source instanceof IFile)
+ {
+ final IFile file = (IFile) source;
+ Resource oldResource = resourceSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), false);
+ if (oldResource != null)
+ {
+ oldResource.unload();
+ }
+ new UIJob("Update the Model in TopcasedViewer")
+ {
+ public IStatus runInUIThread(IProgressMonitor monitor)
+ {
+ if (viewer != null && !viewer.getControl().isDisposed())
+ ((StructuredViewer) viewer).refresh(file);
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
+ // Label provider for the dialog displaying a tree
+ private static class SelectionLabelProvider implements ILabelProvider
+ {
+
+ private WorkbenchLabelProvider resourceLabelProvider = new WorkbenchLabelProvider();
+
+ private AdapterFactoryLabelProvider adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
+
+ public Image getImage(Object element)
+ {
+
+ if (element instanceof IResource)
+ return resourceLabelProvider.getImage(element);
+ return adapterFactoryLabelProvider.getImage(element);
+ }
+
+ public String getText(Object element)
+ {
+ if (element instanceof IResource)
+ return resourceLabelProvider.getText(element);
+ return adapterFactoryLabelProvider.getText(element);
+ }
+
+ public void addListener(ILabelProviderListener listener)
+ {
+ resourceLabelProvider.addListener(listener);
+ adapterFactoryLabelProvider.addListener(listener);
+ }
+
+ public void dispose()
+ {
+ resourceLabelProvider.dispose();
+ adapterFactoryLabelProvider.dispose();
+
+ }
+
+ public boolean isLabelProperty(Object element, String property)
+ {
+ if (element instanceof IResource)
+ return resourceLabelProvider.isLabelProperty(element, property);
+ return adapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ public void removeListener(ILabelProviderListener listener)
+ {
+ resourceLabelProvider.removeListener(listener);
+ adapterFactoryLabelProvider.removeListener(listener);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SpellingTextComposite.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SpellingTextComposite.java
new file mode 100644
index 00000000000..e03dc985aef
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/SpellingTextComposite.java
@@ -0,0 +1,455 @@
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * 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:
+ * Jeremie Belmudes (Atos Origin) Jeremie.Belmudes@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import java.util.Iterator;
+import java.util.Observable;
+import java.util.Observer;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubMenuManager;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ActiveShellExpression;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+
+/**
+ * A composite used to edit some documentation in a plain text mode working with the eclipse spell checking tool.<br>
+ * Creation : 2 july 2010<br>
+ *
+ * @author jbelmudes
+ */
+public class SpellingTextComposite extends Composite implements IText, Observer
+{
+
+ protected StyledText fTextField; // updated only by modify events
+
+ protected SourceViewer sourceViewer;
+
+ protected Document document;
+
+ protected final static String CURRENT_LINE = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE;
+
+ protected final static String CURRENT_LINE_COLOR = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
+
+ private IHandlerActivation quickFixhandlerActivation;
+
+ /**
+ * @param composite the parent of this Composite
+ */
+ public SpellingTextComposite(final Composite composite)
+ {
+ this(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, false);
+ }
+
+ /**
+ * @param composite the parent of this Composite
+ * @param style the style of the text control
+ */
+ public SpellingTextComposite(final Composite composite, int style)
+ {
+ this(composite, style, false);
+ }
+
+ /**
+ * @param composite the parent of this Composite
+ * @param style the style of the text control
+ * @param colored tells if the widget has a colored line where the cursor is set
+ */
+ public SpellingTextComposite(final Composite composite, int style, boolean colored)
+ {
+ super(composite, SWT.BORDER);
+ this.setLayout(new FillLayout());
+ AnnotationModel annotationModel = new AnnotationModel();
+ IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
+
+ sourceViewer = new SourceViewer(this, null, null, true, style);
+ fTextField = sourceViewer.getTextWidget();
+
+ final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceViewer, null, annotationAccess, EditorsUI.getSharedTextColors());
+ // display or not a colored line where the field is edited
+ if (colored)
+ {
+ support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
+ }
+ Iterator<?> e = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator();
+ while (e.hasNext())
+ support.setAnnotationPreference((AnnotationPreference) e.next());
+
+ support.install(EditorsUI.getPreferenceStore());
+
+ final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+
+ final ActionHandler quickFixActionHandler = createQuickFixActionHandler(sourceViewer);
+
+ final TextViewerAction cutAction = new TextViewerAction(sourceViewer, ITextOperationTarget.CUT);
+ cutAction.setText(Messages.SpellingTextComposite_cut);
+ cutAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
+
+ final TextViewerAction copyAction = new TextViewerAction(sourceViewer, ITextOperationTarget.COPY);
+ copyAction.setText(Messages.SpellingTextComposite_copy);
+ copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
+
+ final TextViewerAction pasteAction = new TextViewerAction(sourceViewer, ITextOperationTarget.PASTE);
+ pasteAction.setText(Messages.SpellingTextComposite_paste);
+ pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
+
+ final TextViewerAction selectAllAction = new TextViewerAction(sourceViewer, ITextOperationTarget.SELECT_ALL);
+ selectAllAction.setText(Messages.SpellingTextComposite_selectAll);
+ selectAllAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
+
+ final MenuManager contextMenu = new MenuManager();
+ contextMenu.add(cutAction);
+ contextMenu.add(copyAction);
+ contextMenu.add(pasteAction);
+ contextMenu.add(selectAllAction);
+ contextMenu.add(new Separator());
+ final SubMenuManager quickFixMenu = new SubMenuManager(contextMenu);
+ quickFixMenu.setVisible(true);
+ quickFixMenu.addMenuListener(new IMenuListener()
+ {
+
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ quickFixMenu.removeAll();
+ if (fTextField != null && fTextField.getEditable())
+ {
+ IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
+ Iterator<?> annotationIterator = annotationModel.getAnnotationIterator();
+ while (annotationIterator.hasNext())
+ {
+ Annotation annotation = (Annotation) annotationIterator.next();
+ if (!annotation.isMarkedDeleted() && includes(annotationModel.getPosition(annotation), sourceViewer.getTextWidget().getCaretOffset())
+ && sourceViewer.getQuickAssistAssistant().canFix(annotation))
+ {
+ ICompletionProposal[] computeQuickAssistProposals = sourceViewer.getQuickAssistAssistant().getQuickAssistProcessor().computeQuickAssistProposals(
+ sourceViewer.getQuickAssistInvocationContext());
+ for (int i = 0; i < computeQuickAssistProposals.length; i++)
+ {
+ final ICompletionProposal proposal = computeQuickAssistProposals[i];
+ quickFixMenu.add(new Action(proposal.getDisplayString())
+ {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ proposal.apply(sourceViewer.getDocument());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#getImageDescriptor()
+ */
+ public ImageDescriptor getImageDescriptor()
+ {
+ if (proposal.getImage() != null)
+ {
+ return ImageDescriptor.createFromImage(proposal.getImage());
+ }
+ return null;
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
+ });
+
+ fTextField.addFocusListener(new FocusListener()
+ {
+ private IHandlerActivation cutHandlerActivation;
+ private IHandlerActivation copyHandlerActivation;
+ private IHandlerActivation pasteHandlerActivation;
+ private IHandlerActivation selectAllHandlerActivation;
+ public void focusGained(FocusEvent e)
+ {
+ cutAction.update();
+ copyAction.update();
+ IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ this.cutHandlerActivation = service.activateHandler(IWorkbenchCommandConstants.EDIT_CUT, new ActionHandler(cutAction), new ActiveShellExpression(getShell()));
+ this.copyHandlerActivation = service.activateHandler(IWorkbenchCommandConstants.EDIT_COPY, new ActionHandler(copyAction), new ActiveShellExpression(getShell()));
+ this.pasteHandlerActivation = service.activateHandler(IWorkbenchCommandConstants.EDIT_PASTE, new ActionHandler(pasteAction), new ActiveShellExpression(getShell()));
+ this.selectAllHandlerActivation = service.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL, new ActionHandler(selectAllAction), new ActiveShellExpression(getShell()));
+ quickFixhandlerActivation = installQuickFixActionHandler(handlerService, sourceViewer, quickFixActionHandler);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
+ public void focusLost(FocusEvent e)
+ {
+ IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ if (quickFixhandlerActivation != null)
+ {
+ service.deactivateHandler(quickFixhandlerActivation);
+ }
+
+ if (cutHandlerActivation != null) {
+ service.deactivateHandler(cutHandlerActivation);
+ }
+
+ if (copyHandlerActivation != null) {
+ service.deactivateHandler(copyHandlerActivation);
+ }
+
+ if (pasteHandlerActivation != null) {
+ service.deactivateHandler(pasteHandlerActivation);
+ }
+
+ if (selectAllHandlerActivation != null) {
+ service.deactivateHandler(selectAllHandlerActivation);
+ }
+ }
+
+ });
+
+ sourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ cutAction.update();
+ copyAction.update();
+ }
+
+ });
+
+ sourceViewer.getTextWidget().addDisposeListener(new DisposeListener()
+ {
+
+ public void widgetDisposed(DisposeEvent e)
+ {
+ support.uninstall();
+ if (quickFixhandlerActivation != null)
+ {
+ handlerService.deactivateHandler(quickFixhandlerActivation);
+ }
+ }
+
+ });
+
+ document = new Document();
+
+ // NOTE: Configuration must be applied before the document is set in order for
+ // Hyperlink coloring to work. (Presenter needs document object up front)
+ sourceViewer.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore()));
+ sourceViewer.setDocument(document, annotationModel);
+ fTextField.setMenu(contextMenu.createContextMenu(fTextField));
+ }
+
+ protected boolean includes(Position position, int caretOffset)
+ {
+ return position.includes(caretOffset) || (position.offset + position.length) == caretOffset;
+ }
+
+ /**
+ * Set the color of the texte area background
+ */
+ public void setBackground(Color object)
+ {
+ fTextField.setBackground(object);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Control#setForeground(org.eclipse.swt.graphics.Color)
+ */
+ public void setForeground(Color color)
+ {
+ fTextField.setForeground(color);
+ }
+
+ /**
+ * Installs the quick fix action handler and returns the handler activation.
+ *
+ * @param handlerService the handler service
+ * @param sourceViewer the source viewer
+ * @param createQuickFixActionHandler
+ * @return the handler activation
+ * @since 3.4
+ */
+ private IHandlerActivation installQuickFixActionHandler(IHandlerService handlerService, SourceViewer sourceViewer, IHandler createQuickFixActionHandler)
+ {
+
+ return handlerService.activateHandler(ITextEditorActionDefinitionIds.QUICK_ASSIST, createQuickFixActionHandler, AlwaysTrue.INSTANCE
+ /*
+ * ,/*, new ActiveShellExpression(sourceViewer.getTextWidget().getShell())
+ */);
+ }
+
+ /**
+ * Creates and returns a quick fix action handler.
+ *
+ * @param textOperationTarget the target for text operations
+ * @since 3.4
+ */
+ private ActionHandler createQuickFixActionHandler(final ITextOperationTarget textOperationTarget)
+ {
+ Action quickFixAction = new Action()
+ {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST);
+ }
+ };
+ quickFixAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST);
+ return new ActionHandler(quickFixAction);
+ }
+
+ public void setEnabled(boolean enabled)
+ {
+ fTextField.setEditable(enabled);
+ if (!enabled)
+ {
+ fTextField.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
+ }
+ else
+ {
+ fTextField.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
+ }
+ }
+
+ public void update(Observable o, Object arg)
+ {
+ if (arg instanceof String)
+ {
+ setText((String) arg); // triggers a modify event
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.topcased.tabbedproperties.sections.widgets.IText#getText()
+ */
+ public String getText()
+ {
+ return document.get();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.topcased.tabbedproperties.sections.widgets.IText#getControl()
+ */
+ public Control getControl()
+ {
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.topcased.tabbedproperties.sections.widgets.IText#getTextControl()
+ */
+ public Control getTextControl()
+ {
+ return fTextField;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.topcased.tabbedproperties.sections.widgets.IText#setEditable(boolean)
+ */
+ public void setEditable(boolean isChangeable)
+ {
+ fTextField.setEditable(isChangeable);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.topcased.tabbedproperties.sections.widgets.IText#setText(java.lang.String)
+ */
+ public void setText(String string)
+ {
+ document.set(string);
+ }
+
+ private static class AlwaysTrue extends Expression
+ {
+ public static final AlwaysTrue INSTANCE = new AlwaysTrue();
+ private AlwaysTrue ()
+ {
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException
+ {
+ return EvaluationResult.TRUE;
+ }
+
+ }
+
+
+
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TextViewerAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TextViewerAction.java
new file mode 100644
index 00000000000..bc43378b94b
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TextViewerAction.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.ui.texteditor.IUpdate;
+
+public class TextViewerAction extends Action implements IUpdate {
+ private int operationCode = -1;
+ private ITextOperationTarget operationTarget;
+
+ public TextViewerAction(ITextViewer viewer, int operationCode) {
+ this.operationCode = operationCode;
+ operationTarget = viewer.getTextOperationTarget();
+ update();
+ }
+ public void update() {
+ boolean wasEnabled = isEnabled();
+ boolean isEnabled = (operationTarget != null && operationTarget.canDoOperation(operationCode));
+ setEnabled(isEnabled);
+ if (wasEnabled != isEnabled) {
+ firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+ }
+ public void run() {
+ if (operationCode != -1 && operationTarget != null) {
+ operationTarget.doOperation(operationCode);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TypedResourcesSelectionDialog.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TypedResourcesSelectionDialog.java
new file mode 100644
index 00000000000..11889b0fda1
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/TypedResourcesSelectionDialog.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2005 AIRBUS FRANCE.
+ * 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:
+ * David Sciamma (Anyware Technologies),
+ * Mathieu Garcia (Anyware Technologies),
+ * Jacques Lescot (Anyware Technologies),
+ * Thomas Friol (Anyware Technologies)
+ * - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.documentation.view;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This class is a JFace dialog in which you can select different type of
+ * resources. You can select workspace, external and remote resources. The
+ * result is a type of resources. <br/> Creation : 10 oct. 2005
+ *
+ * @author <a href="mailto:thomas.friol@anyware-tech.com">Thomas FRIOL</a>
+ */
+public class TypedResourcesSelectionDialog extends Dialog
+{
+ /**
+ * Constant defining the workspace resource type.
+ */
+ public static final int WORKSPACE_RESOURCE = 0;
+
+ /**
+ * Constant defining the external resource type.
+ */
+ public static final int EXTERNAL_RESOURCE = 1;
+
+ /**
+ * Constant defining the remote resource type.
+ */
+ public static final int REMOTE_RESOURCE = 2;
+
+ private int selectedType = WORKSPACE_RESOURCE;
+
+ private Button workspaceTypeButton;
+
+ private Button externalTypeButton;
+
+ private Button remoteTypeButton;
+
+ private SelectionListener selectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (e.getSource() == remoteTypeButton)
+ {
+ selectedType = REMOTE_RESOURCE;
+ }
+ else if (e.getSource() == externalTypeButton)
+ {
+ selectedType = EXTERNAL_RESOURCE;
+ }
+ else
+ {
+ selectedType = WORKSPACE_RESOURCE;
+ }
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell the parent shell
+ */
+ public TypedResourcesSelectionDialog(Shell parentShell)
+ {
+ super(parentShell);
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText("Resource type selection");
+ }
+
+ /**
+ * Return the selected resource type.
+ *
+ * @return the selected resource type
+ */
+ public int getType()
+ {
+ return selectedType;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite container = (Composite) super.createDialogArea(parent);
+
+ Label label = new Label(container, SWT.NONE);
+ label.setText("Please choose the type of resource to select.");
+
+ Composite typeComposite = new Composite(container, SWT.NONE);
+ typeComposite.setLayout(new GridLayout(3, true));
+ typeComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
+
+ workspaceTypeButton = new Button(typeComposite, SWT.RADIO);
+ workspaceTypeButton.setText("Workspace");
+ workspaceTypeButton.addSelectionListener(selectionListener);
+ workspaceTypeButton.setSelection(true);
+
+ externalTypeButton = new Button(typeComposite, SWT.RADIO);
+ externalTypeButton.setText("External");
+ externalTypeButton.addSelectionListener(selectionListener);
+
+ remoteTypeButton = new Button(typeComposite, SWT.RADIO);
+ remoteTypeButton.setText("Remote");
+ remoteTypeButton.addSelectionListener(selectionListener);
+
+ return container;
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/AddElementLinkAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/AddElementLinkAction.java
new file mode 100644
index 00000000000..4a16209ae58
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/AddElementLinkAction.java
@@ -0,0 +1,83 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.RichTextCommand;
+import org.eclipse.epf.richtext.RichTextImages;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.DocumentionPartHandlerRegistry;
+import org.eclipse.papyrus.documentation.view.IDocumentationPartHandler;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Adds a link to a topcased model element.
+ *
+ * @author Jose Alfredo Serrano
+ */
+public class AddElementLinkAction extends RichTextAction {
+
+ /**
+ * Creates a new instance.
+ */
+ public AddElementLinkAction(IRichText richText) {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("MODEL_LINK")); //$NON-NLS-1$
+ setDisabledImageDescriptor(RichTextImages.DISABLED_IMG_DESC_ADD_LINK);
+ setToolTipText(Messages.AddElementLinkAction_text);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText)
+ {
+ if (richText != null)
+ {
+ String linkURL = createURL();
+ if (linkURL != null && linkURL.length() > 0) {
+ richText.executeCommand(RichTextCommand.ADD_LINK, linkURL);
+ }
+ }
+ }
+
+ public boolean disableInSourceMode() {
+ return false;
+ }
+
+ private String createURL()
+ {
+ EObject selection = null;
+ IEditorPart activeEditor = DocViewPlugin.getActiveEditor();
+ IDocumentationPartHandler documentationPartHandler = DocumentionPartHandlerRegistry.getInstance().getDocumentationPartHandler(activeEditor);
+ if (documentationPartHandler != null) {
+ selection = documentationPartHandler.openElementSelectionDialog(activeEditor);
+ }
+
+ if (selection != null)
+ {
+ // XXX : HACK Extreme hacking on...
+ // there should be a proper way to handle with spaces and URIs.
+ String uri = EcoreUtil.getURI(selection).toString();
+ return "http://" + uri.replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/CommandConstants.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/CommandConstants.java
new file mode 100644
index 00000000000..f6b8c458fcd
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/CommandConstants.java
@@ -0,0 +1,24 @@
+package org.eclipse.papyrus.documentation.view.actions;
+
+
+public class CommandConstants {
+ /**
+ * Insert a new row to the selected table.
+ */
+ public static final String INSERT_TABLE_ROW = "insertRow"; //$NON-NLS-1$
+
+ /**
+ * Delete a row from the selected table.
+ */
+ public static final String DELETE_TABLE_ROW = "deleteRow"; //$NON-NLS-1$
+
+ /**
+ * Insert a new column to the selected table.
+ */
+ public static final String INSERT_TABLE_COL = "insertColumn"; //$NON-NLS-1$
+
+ /**
+ * Delete a column from the selected table.
+ */
+ public static final String DELETE_TABLE_COL = "deleteColumn"; //$NON-NLS-1$
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableColumnAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableColumnAction.java
new file mode 100644
index 00000000000..6944d08a067
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableColumnAction.java
@@ -0,0 +1,56 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Delete a column from the selected table in the rich text control.
+ *
+ * @author Jose Alfredo Serrano (Anyware Technologies)
+ * @author Jacques LESCOT (Anyware Technologies)
+ */
+public class DeleteTableColumnAction extends RichTextAction {
+
+ /**
+ * Creates a new instance.
+ */
+ public DeleteTableColumnAction(IRichText richText) {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("DELETE_COLUMN")); //$NON-NLS-1$
+ setToolTipText(Messages.DeleteTableColumnAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText) {
+ if (richText != null) {
+ Shell parent = Display.getCurrent().getActiveShell();
+ InputDialog dialog = new InputDialog(parent, "Delete Column", Messages.DeleteTableColumnAction_text, "0", new NumberValidator()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (dialog.open() == Window.OK) {
+ richText.executeCommand(CommandConstants.DELETE_TABLE_COL, dialog.getValue());
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableRowAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableRowAction.java
new file mode 100644
index 00000000000..318c87d2338
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/DeleteTableRowAction.java
@@ -0,0 +1,56 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Delete a row from the selected table in the rich text control.
+ *
+ * @author Jose Alfredo Serrano (Anyware Technologies)
+ * @author Jacques LESCOT (Anyware Technologies)
+ */
+public class DeleteTableRowAction extends RichTextAction {
+
+ /**
+ * Creates a new instance.
+ */
+ public DeleteTableRowAction(IRichText richText) {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("DELETE_ROW")); //$NON-NLS-1$
+ setToolTipText(Messages.DeleteTableRowAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText) {
+ if (richText != null) {
+ Shell parent = Display.getCurrent().getActiveShell();
+ InputDialog dialog = new InputDialog(parent, "Delete Row", Messages.DeleteTableRowAction_text, "0", new NumberValidator()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (dialog.open() == Window.OK) {
+ richText.executeCommand(CommandConstants.DELETE_TABLE_ROW, dialog.getValue());
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableColumnAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableColumnAction.java
new file mode 100644
index 00000000000..fe7c195ca7f
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableColumnAction.java
@@ -0,0 +1,55 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Insert a column to the selected table in the rich text control.
+ *
+ * @author Jose Alfredo Serrano (Anyware Technologies)
+ * @author Jacques LESCOT (Anyware Technologies)
+ */
+public class InsertTableColumnAction extends RichTextAction {
+
+ /**
+ * Creates a new instance.
+ */
+ public InsertTableColumnAction(IRichText richText) {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("INSERT_COLUMN")); //$NON-NLS-1$
+ setToolTipText(Messages.InsertTableColumnAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText) {
+ if (richText != null) {
+ Shell parent = Display.getCurrent().getActiveShell();
+ InputDialog dialog = new InputDialog(parent, "Insert Row", Messages.InsertTableColumnAction_text, "0", new NumberValidator()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (dialog.open() == Window.OK) {
+ richText.executeCommand(CommandConstants.INSERT_TABLE_COL, dialog.getValue());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableRowAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableRowAction.java
new file mode 100644
index 00000000000..2384284bbfb
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/InsertTableRowAction.java
@@ -0,0 +1,56 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Insert a row to the selected table in the rich text control.
+ *
+ * @author Jose Alfredo Serrano (Anyware Technologies)
+ * @author Jacques LESCOT (Anyware Technologies)
+ */
+public class InsertTableRowAction extends RichTextAction {
+
+ /**
+ * Creates a new instance.
+ */
+ public InsertTableRowAction(IRichText richText) {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("INSERT_ROW")); //$NON-NLS-1$
+ setToolTipText(Messages.InsertTableRowAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText) {
+ if (richText != null) {
+ Shell parent = Display.getCurrent().getActiveShell();
+ InputDialog dialog = new InputDialog(parent, "Insert Row", Messages.InsertTableRowAction_text, "0", new NumberValidator()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (dialog.open() == Window.OK) {
+ richText.executeCommand(CommandConstants.INSERT_TABLE_ROW, dialog.getValue());
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/NumberValidator.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/NumberValidator.java
new file mode 100644
index 00000000000..c5335331625
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/NumberValidator.java
@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - initial API and implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * Validates whether the text found in the input field of the
+ * dialog forms a positive number.
+ */
+class NumberValidator implements IInputValidator {
+
+ /*
+ * @see IInputValidator#isValid(String)
+ */
+ public String isValid(String input) {
+
+ if (input == null || input.length() == 0)
+ return " "; //$NON-NLS-1$
+
+ try {
+ int i= Integer.parseInt(input);
+ if (i < 0)
+ return "Invalid number";
+
+ } catch (NumberFormatException x) {
+ return "Not a number";
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextColorAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextColorAction.java
new file mode 100644
index 00000000000..03a33e4144e
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextColorAction.java
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.RichTextCommand;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.ColorDialog;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Set the color attribute of the selected text in a rich text control.
+ *
+ * @author <a href="mailto:alfredo@anyware-tech.com">Jose Alfredo Serrano</a>
+ */
+public class TextColorAction extends RichTextAction
+{
+
+ private String command = RichTextCommand.FORGROUND_COLOR;
+
+ /**
+ * Creates a new instance.
+ */
+ public TextColorAction(final IRichText richText)
+ {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("TEXT_COLOR")); //$NON-NLS-1$
+ setToolTipText(Messages.TextColorAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText)
+ {
+ if (richText != null)
+ {
+ ColorDialog dialog = new ColorDialog(Display.getCurrent().getActiveShell());
+ RGB color = dialog.open();
+ if (color != null)
+ {
+ String rgb = "RGB(" + color.red + "," + color.green + "," + color.blue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ richText.executeCommand(command, rgb);
+ }
+ }
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextHighlightAction.java b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextHighlightAction.java
new file mode 100644
index 00000000000..8f998b2ab9d
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/actions/TextHighlightAction.java
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2009 Anyware Technologies and others
+// 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:
+// Anyware Technologies - implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.documentation.view.actions;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.RichTextCommand;
+import org.eclipse.epf.richtext.actions.RichTextAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.papyrus.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.documentation.view.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.ColorDialog;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Highlight selected text in a rich text control.
+ *
+ * @author <a href="mailto:alfredo@anyware-tech.com">Jose Alfredo Serrano</a>
+ */
+public class TextHighlightAction extends RichTextAction
+{
+
+ /**
+ * Creates a new instance.
+ */
+ public TextHighlightAction(final IRichText richText)
+ {
+ super(richText, IAction.AS_PUSH_BUTTON);
+ setImageDescriptor(DocViewPlugin.getDefault().getImageRegistry().getDescriptor("TEXT_HIGHLIGHT")); //$NON-NLS-1$
+ setToolTipText(Messages.TextHighlightAction_title);
+ }
+
+ /**
+ * Executes the action.
+ *
+ * @param richText
+ * a rich text control
+ */
+ public void execute(IRichText richText)
+ {
+ if (richText != null)
+ {
+ ColorDialog dialog = new ColorDialog(Display.getCurrent().getActiveShell());
+ RGB color = dialog.open();
+ if (color != null)
+ {
+ String rgb = "RGB(" + color.red + "," + color.green + "," + color.blue + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String command = RichTextCommand.BACKGROUND_COLOR;
+ String platform = SWT.getPlatform ();
+ if ("motif".equals (platform) || "gtk".equals(platform)) { //$NON-NLS-1$ //$NON-NLS-2$
+ // for this kind of graphical libs a Mozilla browser is created.
+ // a different command should be created
+ command = "mozillaBackColor"; //$NON-NLS-1$
+ }
+ richText.executeCommand(command, rgb);
+ }
+ }
+ }
+}
diff --git a/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/messages.properties b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/messages.properties
new file mode 100644
index 00000000000..3e42c335ec9
--- /dev/null
+++ b/plugins/views/documentation/org.eclipse.papyrus.documentation.view/src/org/eclipse/papyrus/documentation/view/messages.properties
@@ -0,0 +1,25 @@
+AbstractDocPage_commentsTitle=Comments
+AbstractDocPage_resourcesTitle=Resources
+AddElementLinkAction_text=Link to Element
+CommentsComposite_docCurrent=Documentation for current
+DeleteTableColumnAction_text=Enter column position to delete {0..*}
+DeleteTableColumnAction_title=Delete Column
+DeleteTableRowAction_text=Enter row position to delete {0..*}
+DeleteTableRowAction_title=Delete Row
+EmptyDocPage_noDoc=No documentation is available.
+InsertTableColumnAction_text=Enter new column position {0..*}
+InsertTableColumnAction_title=Insert Column
+InsertTableRowAction_text=Enter new row position {0..*}
+InsertTableRowAction_title=Insert Row
+ResourcesComposite_add=Add
+ResourcesComposite_deleteResourcesConfirmation=Are you sure you want to delete the selected resource(s) ?
+ResourcesComposite_edit=Edit
+ResourcesComposite_remove=Remove
+ResourcesComposite_resourcesRemoving=Resources removing...
+RichTextEditorDialog_useRichText=Edit documentation using Rich Text
+SpellingTextComposite_copy=Copy
+SpellingTextComposite_cut=Cut
+SpellingTextComposite_paste=Paste
+SpellingTextComposite_selectAll=Select All
+TextColorAction_title=Text Color
+TextHighlightAction_title=Highlight Text

Back to the top