Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-09-27 11:26:47 +0000
committerCamille Letavernier2013-10-18 12:45:27 +0000
commit785fc1f3077098d68a4304e641883e551b7405ea (patch)
tree35193da441671fd9f77a387e764ba21d561ca374 /deprecated
parent25a3077ff27612139796ade985c28d542153433d (diff)
downloadorg.eclipse.papyrus-785fc1f3077098d68a4304e641883e551b7405ea.tar.gz
org.eclipse.papyrus-785fc1f3077098d68a4304e641883e551b7405ea.tar.xz
org.eclipse.papyrus-785fc1f3077098d68a4304e641883e551b7405ea.zip
[Releng] Move deprecated plug-ins to the deprecated folder
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/META-INF/MANIFEST.MF25
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/OSGI-INF/l10n/bundle.properties3
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/Activator.java69
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/adapter/IXtextAdapter.java49
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextEditorDialog.java70
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextValueFactory.java74
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/editor/ReferenceXtextEditor.java99
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedFoldingStructureProvider.java207
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextEditor.java761
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextResource.java33
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingHelper.java138
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingReconciler.java284
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/TextViewerAction.java64
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/ToggleSLCommentAction.java305
-rw-r--r--deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/XTextEditor.java53
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/META-INF/MANIFEST.MF16
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/plugin.xml23
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Activator.java45
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Messages.java32
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLAddOrRemoveAssociatedResourceCommand.java122
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLChangeDocumentationCommand.java193
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLDocumentationManager.java152
-rw-r--r--deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/messages.properties2
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF31
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/icons/ConsoleView.gifbin0 -> 582 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.xml34
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Activator.java54
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Messages.java34
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java180
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/messages.properties9
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentContentProvider.java41
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentFilter.java52
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentPropertySection.java113
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichText.java418
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextEditor.java210
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextFormToolkit.java115
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java789
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java113
-rw-r--r--deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichTextEditor.java61
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/.project17
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/build.properties6
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/epl-v10.html304
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/feature.properties139
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/feature.xml22
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.feature/license.html108
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF19
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.xml11
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java201
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java93
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/META-INF/MANIFEST.MF22
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableCol.pngbin0 -> 574 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableRow.pngbin0 -> 629 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableCol.pngbin0 -> 605 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableRow.pngbin0 -> 641 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextColor.gifbin0 -> 536 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextHighlight.gifbin0 -> 933 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/application_link.pngbin0 -> 749 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/documentation.gifbin0 -> 652 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/edit.gifbin0 -> 615 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/externalResource.gifbin0 -> 587 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/icons/htmlEditor.gifbin0 -> 971 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/plugin.xml18
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/schema/documentationPartHandler.exsd102
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ArrayTreeContentProvider.java51
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/CommentsComposite.java456
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPage.java219
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPageComposite.java154
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocView.java232
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocViewPlugin.java175
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocumentionPartHandlerRegistry.java95
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/EmptyDocPage.java73
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ExternalResourceEditorInput.java200
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocPage.java27
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocumentationPartHandler.java63
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IText.java53
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/Messages.java63
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/PlainTextComposite.java92
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ResourcesComposite.java602
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextComposite.java199
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextEditorDialog.java228
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SelectResourceDialog.java342
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SpellingTextComposite.java455
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TextViewerAction.java41
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TypedResourcesSelectionDialog.java139
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/AddElementLinkAction.java83
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/CommandConstants.java24
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableColumnAction.java56
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableRowAction.java56
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableColumnAction.java55
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableRowAction.java56
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/NumberValidator.java40
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextColorAction.java62
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextHighlightAction.java68
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/messages.properties25
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF17
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/plugin.properties12
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/plugin.xml6
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/schema/documentationManager.exsd100
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java43
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManager.java131
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManagerRegistry.java148
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationUnsupportedException.java27
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationChangedListener.java32
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationManager.java105
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Messages.java38
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/AddOrRemoveAssociatedResourceCommand.java152
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/ChangeEAnnotationCommand.java150
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/EAnnotationDocumentationManager.java161
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/IEAnnotationConstants.java28
-rw-r--r--deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/messages.properties5
140 files changed, 12258 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.classpath b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.project b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.project
new file mode 100644
index 00000000000..32731277245
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.xtext.widgets</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/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0afca153d7f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Jan 13 09:14:20 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..338823d28bb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.xtext.ui;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
+ org.eclipse.core.databinding;bundle-version="1.3.100",
+ org.eclipse.core.expressions;bundle-version="3.4.200",
+ org.eclipse.ui.navigator;bundle-version="3.5.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.emf.compare;bundle-version="1.1.1",
+ org.eclipse.emf.compare.match;bundle-version="1.1.1",
+ org.eclipse.emf.compare.diff;bundle-version="1.1.1"
+Export-Package: org.eclipse.papyrus.infra.xtext.widgets.adapter,
+ org.eclipse.papyrus.infra.xtext.widgets.creation,
+ org.eclipse.papyrus.infra.xtext.widgets.editor,
+ org.eclipse.papyrus.infra.xtext.widgets.embedded
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.widgets.xtext.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.xtext.widgets
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/OSGI-INF/l10n/bundle.properties b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..1737fc8d2e1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.infra.widgets.xtext
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Papyrus widgets Xtext (Incubation) \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/about.html b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/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/deprecated/org.eclipse.papyrus.infra.xtext.widgets/build.properties b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/build.properties
new file mode 100644
index 00000000000..f7bd3f61574
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:30:25 CEST 2011
+bin.includes=META-INF/,.,about.html,OSGI-INF/
+output..=bin/
+src.includes=META-INF/,.,about.html,OSGI-INF/
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/Activator.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/Activator.java
new file mode 100644
index 00000000000..020fcaedc82
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/Activator.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.xtext.widgets"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/adapter/IXtextAdapter.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/adapter/IXtextAdapter.java
new file mode 100644
index 00000000000..ff4a5b49673
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/adapter/IXtextAdapter.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.adapter;
+
+import org.eclipse.emf.ecore.EObject;
+
+import com.google.inject.Injector;
+
+
+public interface IXtextAdapter {
+
+ /**
+ * In some cases, the Xtext object is different from the model object
+ * This method is called when the modifications on the Xtext model are
+ * validated
+ *
+ * @param xtextObject
+ * The EObject generated by the compilation of the Xtext model
+ * @param sourceModelObject
+ * The current value for the reference being edited
+ * @return the Model object
+ * The new value for the reference being edited
+ */
+ public EObject reconcile(EObject sourceModelObject, EObject xtextObject);
+
+ /**
+ * Returns the Xtext String representing the given EObject
+ *
+ * @param modelObject
+ * The EObject being edited. May be null if the reference is unset.
+ * @return
+ * The Xtext String representing the given EObject
+ */
+ public String getText(EObject modelObject);
+
+ /**
+ * @return the Injector to initialize the Xtext editor
+ */
+ public Injector getInjector();
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextEditorDialog.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextEditorDialog.java
new file mode 100644
index 00000000000..fab008b62c3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextEditorDialog.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.creation;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.xtext.widgets.adapter.IXtextAdapter;
+import org.eclipse.papyrus.infra.xtext.widgets.embedded.EmbeddedXtextEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+
+public class XtextEditorDialog extends SelectionDialog {
+
+ protected IXtextAdapter adapter;
+
+ protected EObject currentValue;
+
+ protected EmbeddedXtextEditor editor;
+
+ public XtextEditorDialog(Shell shell, IXtextAdapter adapter, EObject currentValue) {
+ super(shell);
+ this.adapter = adapter;
+ this.currentValue = currentValue;
+ }
+
+ @Override
+ public void create() {
+ super.create();
+ editor = new EmbeddedXtextEditor(getDialogArea(), adapter.getInjector(), SWT.NONE);
+ editor.update(adapter.getText(currentValue));
+ getShell().pack();
+ }
+
+ @Override
+ protected void okPressed() {
+ Resource resource = editor.getResource();
+ if(resource != null) {
+ List<EObject> contents = resource.getContents();
+ if(!contents.isEmpty()) {
+ currentValue = adapter.reconcile(currentValue, contents.get(0));
+ setResult(contents);
+ }
+ }
+ super.okPressed();
+ }
+
+ public EObject getValue() {
+ return currentValue;
+ }
+
+ @Override
+ protected Composite getDialogArea() {
+ return (Composite)super.getDialogArea();
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextValueFactory.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextValueFactory.java
new file mode 100644
index 00000000000..009e90dd4a6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/creation/XtextValueFactory.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.creation;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.creation.ReferenceValueFactory;
+import org.eclipse.papyrus.infra.xtext.widgets.adapter.IXtextAdapter;
+import org.eclipse.swt.widgets.Control;
+
+//This factory should only be used for containment references, as there is no "CreateIn" parameter
+public class XtextValueFactory implements ReferenceValueFactory {
+
+ protected IXtextAdapter adapter;
+
+ public XtextValueFactory() {
+ }
+
+ public void setAdapter(IXtextAdapter adapter) {
+ this.adapter = adapter;
+ }
+
+ public IXtextAdapter getAdapter() {
+ return adapter;
+ }
+
+ public XtextValueFactory(IXtextAdapter adapter) {
+ this.adapter = adapter;
+ }
+
+ public Object createObject(Control widget) {
+ XtextEditorDialog dialog = new XtextEditorDialog(widget.getShell(), adapter, null);
+ int result = dialog.open();
+ if(result == Window.OK) {
+ return dialog.getValue();
+ }
+ return null;
+ }
+
+ public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
+ return objectsToValidate; //add the objects to the right resource
+ }
+
+ public boolean canEdit() {
+ return true; //Unsupported yet (We need a Write Transaction)
+ }
+
+ public Object edit(Control widget, Object object) {
+ if(object instanceof EObject) {
+ XtextEditorDialog dialog = new XtextEditorDialog(widget.getShell(), adapter, (EObject)object);
+ dialog.open();
+ } else {
+ Activator.log.warn("The XtextValueFactory can only edit EObjects"); //$NON-NLS-1$
+ }
+ return object;
+ }
+
+ public boolean canCreateObject() {
+ return true;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/editor/ReferenceXtextEditor.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/editor/ReferenceXtextEditor.java
new file mode 100644
index 00000000000..a374c357f14
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/editor/ReferenceXtextEditor.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.editor;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.infra.xtext.widgets.Activator;
+import org.eclipse.papyrus.infra.xtext.widgets.adapter.IXtextAdapter;
+import org.eclipse.papyrus.infra.xtext.widgets.embedded.EmbeddedXtextEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class ReferenceXtextEditor extends AbstractValueEditor implements IChangeListener {
+
+ protected EmbeddedXtextEditor editor;
+
+ protected String xtextAdapterClassName;
+
+ protected IXtextAdapter adapter;
+
+ public ReferenceXtextEditor(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public void setAdapter(String xtextAdapterClassName) {
+ this.xtextAdapterClassName = xtextAdapterClassName;
+ try {
+ Class<? extends IXtextAdapter> xtextAdapterClass = Class.forName(xtextAdapterClassName).asSubclass(IXtextAdapter.class);
+ IXtextAdapter xtextAdapter = xtextAdapterClass.newInstance();
+ editor = new EmbeddedXtextEditor(this, xtextAdapter.getInjector(), SWT.None);
+ } catch (ClassNotFoundException e) {
+ Activator.log.error(e);
+ } catch (InstantiationException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ public String getAdapter() {
+ return xtextAdapterClassName;
+ }
+
+ @Override
+ protected void doBinding() {
+ if(editor != null && modelProperty != null) {
+ modelProperty.addChangeListener(this);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ if(modelProperty != null) {
+ modelProperty.removeChangeListener(this);
+ }
+ }
+
+ @Override
+ public Object getValue() {
+ return editor.getResource().getContents().get(0);
+ }
+
+ @Override
+ public Object getEditableType() {
+ return EObject.class;
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ //TODO
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return false; //TODO
+ }
+
+ public void handleChange(ChangeEvent event) {
+ editor.update(adapter.getText((EObject)modelProperty.getValue()));
+ }
+
+ @Override
+ public void setToolTipText(String text) {
+ //TODO
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedFoldingStructureProvider.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedFoldingStructureProvider.java
new file mode 100644
index 00000000000..13f8ea1cbe0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedFoldingStructureProvider.java
@@ -0,0 +1,207 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.projection.IProjectionListener;
+import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
+import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextSyntaxDiagnostic;
+import org.eclipse.xtext.ui.editor.folding.IFoldingRegionProvider;
+import org.eclipse.xtext.ui.editor.model.IXtextModelListener;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.HashBiMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+
+/**
+ * Default implementation of interface {@link IFoldingStructureProvider}
+ *
+ * @author Michael Clay - Initial contribution and API
+ * @author Mikael Barbero - Dependant of Embedded XtextEditor
+ */
+public class EmbeddedFoldingStructureProvider implements IXtextModelListener {
+
+ @Inject
+ private IFoldingRegionProvider foldingRegionProvider;
+
+ private EmbeddedXtextEditor editor;
+
+ private ProjectionViewer viewer;
+
+ private ProjectionChangeListener projectionListener;
+
+ public void install(EmbeddedXtextEditor editor, ProjectionViewer viewer) {
+ Assert.isNotNull(editor);
+ Assert.isNotNull(viewer);
+ uninstall();
+ this.editor = editor;
+ this.viewer = viewer;
+ projectionListener = new ProjectionChangeListener(viewer);
+ }
+
+ public void initialize() {
+ calculateProjectionAnnotationModel(false);
+ }
+
+ public void uninstall() {
+ if(isInstalled()) {
+ handleProjectionDisabled();
+ projectionListener.dispose();
+ projectionListener = null;
+ editor = null;
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if the provider is installed, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the provider is installed, <code>false</code> otherwise
+ */
+ protected final boolean isInstalled() {
+ return editor != null;
+ }
+
+ /**
+ * @see org.eclipse.xtext.ui.editor.model.IXtextModelListener#modelChanged(org.eclipse.xtext.resource.XtextResource)
+ */
+ public void modelChanged(XtextResource resource) {
+ boolean existingSyntaxErrors = Iterables.any(resource.getErrors(), new Predicate<Diagnostic>() {
+
+ public boolean apply(Diagnostic diagnostic) {
+ return diagnostic instanceof XtextSyntaxDiagnostic;
+ }
+ });
+
+ if(!existingSyntaxErrors) {
+ calculateProjectionAnnotationModel(false);
+ }
+ }
+
+ protected void handleProjectionEnabled() {
+ handleProjectionDisabled();
+ if(isInstalled()) {
+ initialize();
+ editor.getDocument().addModelListener(this);
+ }
+ }
+
+ protected void handleProjectionDisabled() {
+ if(editor.getDocument() != null) {
+ editor.getDocument().removeModelListener(this);
+ }
+ }
+
+ protected void calculateProjectionAnnotationModel(boolean allowCollapse) {
+ ProjectionAnnotationModel projectionAnnotationModel = this.viewer.getProjectionAnnotationModel();
+ if(projectionAnnotationModel != null) {
+ List<IFoldingRegion> foldingRegions = foldingRegionProvider.getFoldingRegions(editor.getDocument());
+ HashBiMap<Position, IFoldingRegion> positionsMap = toPositionIndexedMap(foldingRegions);
+ Annotation[] newRegions = mergeFoldingRegions(positionsMap, projectionAnnotationModel);
+ updateFoldingRegions(allowCollapse, projectionAnnotationModel, positionsMap, newRegions);
+ }
+ }
+
+ protected HashBiMap<Position, IFoldingRegion> toPositionIndexedMap(List<IFoldingRegion> foldingRegions) {
+ HashBiMap<Position, IFoldingRegion> positionsMap = Maps.newHashBiMap();
+ for(IFoldingRegion foldingRegion : foldingRegions) {
+ positionsMap.put(foldingRegion.getPosition(), foldingRegion);
+ }
+ return positionsMap;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Annotation[] mergeFoldingRegions(HashBiMap<Position, IFoldingRegion> positionsMap, ProjectionAnnotationModel projectionAnnotationModel) {
+ List<Annotation> deletions = new ArrayList<Annotation>();
+ for(Iterator<Annotation> iterator = projectionAnnotationModel.getAnnotationIterator(); iterator.hasNext();) {
+ Annotation annotation = iterator.next();
+ if(annotation instanceof ProjectionAnnotation) {
+ Position position = projectionAnnotationModel.getPosition(annotation);
+ if(positionsMap.remove(position) == null) {
+ deletions.add(annotation);
+ }
+ }
+ }
+ return deletions.toArray(new Annotation[deletions.size()]);
+ }
+
+ protected void updateFoldingRegions(boolean allowCollapse, ProjectionAnnotationModel model, HashBiMap<Position, IFoldingRegion> positionsMap, Annotation[] deletions) {
+ Map<ProjectionAnnotation, Position> additionsMap = new HashMap<ProjectionAnnotation, Position>();
+ for(Iterator<IFoldingRegion> iterator = positionsMap.values().iterator(); iterator.hasNext();) {
+ IFoldingRegion foldingRegion = iterator.next();
+ addProjectionAnnotation(allowCollapse, foldingRegion, additionsMap);
+ }
+ if(deletions.length != 0 || additionsMap.size() != 0) {
+ model.modifyAnnotations(deletions, additionsMap, new Annotation[]{});
+ }
+ }
+
+ protected void addProjectionAnnotation(boolean allowCollapse, IFoldingRegion foldingRegion, Map<ProjectionAnnotation, Position> additionsMap) {
+ ProjectionAnnotation projectionAnnotation = createProjectionAnnotation(allowCollapse, foldingRegion);
+ additionsMap.put(projectionAnnotation, foldingRegion.getPosition());
+ }
+
+ protected ProjectionAnnotation createProjectionAnnotation(boolean allowCollapse, IFoldingRegion foldingRegion) {
+ return new StyledProjectionAnnotation(allowCollapse, foldingRegion.getAlias());
+ }
+
+ /**
+ * Internal projection listener.
+ */
+ public class ProjectionChangeListener implements IProjectionListener {
+
+ private ProjectionViewer projectionViewer;
+
+ /**
+ * Registers the listener with the viewer.
+ *
+ * @param viewer
+ * the viewer to register a listener with
+ */
+ public ProjectionChangeListener(ProjectionViewer viewer) {
+ Assert.isLegal(viewer != null);
+ projectionViewer = viewer;
+ projectionViewer.addProjectionListener(this);
+ }
+
+ /**
+ * Disposes of this listener and removes the projection listener from the viewer.
+ */
+ public void dispose() {
+ if(projectionViewer != null) {
+ projectionViewer.removeProjectionListener(this);
+ projectionViewer = null;
+ }
+ }
+
+ public void projectionEnabled() {
+ handleProjectionEnabled();
+ }
+
+ public void projectionDisabled() {
+ handleProjectionDisabled();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextEditor.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextEditor.java
new file mode 100644
index 00000000000..e8c5192fb9e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextEditor.java
@@ -0,0 +1,761 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.service.DiffService;
+import org.eclipse.emf.compare.match.MatchOptions;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.match.service.MatchService;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.action.IAction;
+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.commands.ActionHandler;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ISynchronizable;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationModel;
+import org.eclipse.jface.text.source.AnnotationPainter;
+import org.eclipse.jface.text.source.AnnotationRulerColumn;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.IOverviewRuler;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.jface.text.source.OverviewRuler;
+import org.eclipse.jface.text.source.projection.ProjectionSupport;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.ActiveShellExpression;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.internal.editors.text.EditorsPlugin;
+import org.eclipse.ui.navigator.ICommonMenuConstants;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.ui.texteditor.AnnotationPreference;
+import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.IUpdate;
+import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
+import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+import org.eclipse.xtext.Constants;
+import org.eclipse.xtext.IGrammarAccess;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextSourceViewer;
+import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration;
+import org.eclipse.xtext.ui.editor.bracketmatching.BracketMatchingPreferencesInitializer;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider;
+import org.eclipse.xtext.ui.editor.validation.AnnotationIssueProcessor;
+import org.eclipse.xtext.ui.editor.validation.IValidationIssueProcessor;
+import org.eclipse.xtext.ui.editor.validation.ValidationJob;
+import org.eclipse.xtext.ui.resource.IResourceSetProvider;
+import org.eclipse.xtext.util.StringInputStream;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.IResourceValidator;
+import org.eclipse.xtext.validation.Issue;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Provider;
+import com.google.inject.name.Named;
+
+public class EmbeddedXtextEditor {
+
+ private static final String XTEXT_UI_FORMAT_ACTION = "org.eclipse.xtext.ui.FormatAction"; //$NON-NLS-1$
+
+ private static final String XTEXT_UI_TOGGLE_SL_COMMENT_ACTION = "org.eclipse.xtext.ui.ToggleCommentAction"; //$NON-NLS-1$
+
+ private Composite fControl;
+
+ private int fStyle;
+
+ private XtextSourceViewer fSourceViewer;
+
+ private EmbeddedXtextResource fResource;
+
+ private XtextDocument fDocument;
+
+ @Inject
+ @Named(Constants.FILE_EXTENSIONS)
+ private String fFileExtension;
+
+ private XtextSourceViewerConfiguration fViewerConfiguration;
+
+ @Inject
+ private HighlightingHelper fHighlightingHelper;
+
+ @Inject
+ private IResourceSetProvider fResourceSetProvider;
+
+ @Inject
+ private IGrammarAccess fGrammarAccess;
+
+ @Inject
+ private XtextSourceViewer.Factory fSourceViewerFactory;
+
+ @Inject
+ private Provider<XtextSourceViewerConfiguration> fSourceViewerConfigurationProvider;
+
+ @Inject
+ private Provider<XtextDocument> fDocumentProvider;
+
+ @Inject
+ private Provider<EmbeddedXtextResource> fEmbeddedXtextResourceProvider;
+
+ @Inject
+ private IResourceValidator fResourceValidator;
+
+ @Inject
+ private IPreferenceStoreAccess fPreferenceStoreAccess;
+
+ @Inject
+ private CharacterPairMatcher characterPairMatcher;
+
+ @Inject(optional = true)
+ private AnnotationPainter.IDrawingStrategy projectionAnnotationDrawingStrategy;
+
+ private EmbeddedFoldingStructureProvider fFoldingStructureProvider;
+
+ private IOverviewRuler fOverviewRuler;
+
+ private IAnnotationAccess fAnnotationAccess;
+
+ /**
+ * Creates a new EmbeddedXtextEditor. It must have the SWT.V_SCROLL style at least not to
+ * throw NPE when computing overview ruler.
+ *
+ * @param control
+ * the parent composite that will contain the editor
+ * @param injector
+ * the Guice injector to get Xtext configuration elements
+ * @param job
+ * the synchronization job that will be scheduled/rescheduled at each
+ * modification of the editor text. It may be use to reconcile the content of
+ * the editor with something else.
+ * @param style
+ * the SWT style of the {@link SourceViewer} of this editor.
+ * @param fileExtension
+ * the file extension (without the DOT) of the textual DSL to edit
+ */
+ public EmbeddedXtextEditor(Composite control, Injector injector, int style) {
+ fControl = control;
+ fStyle = style;
+ fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
+ fFoldingStructureProvider = new EmbeddedFoldingStructureProvider();
+
+ injector.injectMembers(this);
+
+ createEditor(fControl);
+ }
+
+ /**
+ * Creates a new EmbeddedXtextEditor.
+ *
+ * Equivalent to EmbeddedXtextEditor(control, injector, job, fileExtension, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ *
+ * @param control
+ * the parent composite that will contain the editor
+ * @param injector
+ * the Guice injector to get Xtext configuration elements
+ * @param job
+ * the synchronization job that will be scheduled/rescheduled at each
+ * modification of the editor text. It may be use to reconcile the content of
+ * the editor with something else.
+ * @param fileExtension
+ * the file extension (without the DOT) of the textual DSL to edit
+ * @param fileExtension
+ */
+ public EmbeddedXtextEditor(Composite control, Injector injector) {
+ this(control, injector, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ }
+
+ public Composite getControl() {
+ return fControl;
+ }
+
+ public XtextSourceViewer getViewer() {
+ return fSourceViewer;
+ }
+
+ public XtextResource getResource() {
+ return fResource;
+ }
+
+ public IXtextDocument getDocument() {
+ return fDocument;
+ }
+
+ /**
+ * Should be called only once, during initialization.
+ *
+ * Then, you should call {@link #updateText(String, String, String)};
+ *
+ * @param document
+ * @param prefix
+ * @param text
+ * @param suffix
+ */
+ protected void setText(XtextDocument document, String text) {
+ document.set(text);
+ fResource = createResource(text);
+ document.setInput(fResource);
+ AnnotationModel annotationModel = new AnnotationModel();
+ if(document instanceof ISynchronizable) {
+ Object lock = ((ISynchronizable)document).getLockObject();
+ if(lock == null) {
+ lock = new Object();
+ ((ISynchronizable)document).setLockObject(lock);
+ }
+ ((ISynchronizable)annotationModel).setLockObject(lock);
+ }
+ fSourceViewer.setDocument(document, annotationModel);
+ }
+
+ private EmbeddedXtextResource createResource(String content) {
+ EmbeddedXtextResource result = createResource();
+ try {
+ result.load(new StringInputStream(content, result.getEncoding()), Collections.emptyMap());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return result;
+ }
+
+ private void createEditor(Composite parent) {
+ createViewer(parent);
+
+ Control control = fSourceViewer.getControl();
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ control.setLayoutData(data);
+
+ createActions();
+
+ MenuManager manager = new MenuManager(null, null);
+ manager.setRemoveAllWhenShown(true);
+ manager.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager mgr) {
+ EmbeddedXtextEditor.this.menuAboutToShow(mgr);
+ }
+ });
+
+ StyledText text = fSourceViewer.getTextWidget();
+ Menu menu = manager.createContextMenu(text);
+ text.setMenu(menu);
+ }
+
+ private void menuAboutToShow(IMenuManager menu) {
+ menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fActions.get(ITextEditorActionConstants.CUT));
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fActions.get(ITextEditorActionConstants.COPY));
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fActions.get(ITextEditorActionConstants.PASTE));
+
+ menu.add(new Separator(ICommonMenuConstants.GROUP_GENERATE));
+ menu.appendToGroup(ICommonMenuConstants.GROUP_GENERATE, fActions.get(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS));
+ }
+
+ private void createViewer(Composite parent) {
+ createSourceViewer(parent);
+ installFoldingSupport(fSourceViewer);
+ setText(fDocument, ""); //$NON-NLS-1$
+ fHighlightingHelper.install(fViewerConfiguration, fSourceViewer);
+ }
+
+ /**
+ * Creates the vertical ruler to be used by this editor.
+ * Subclasses may re-implement this method.
+ *
+ * @return the vertical ruler
+ */
+ private IVerticalRuler createVerticalRuler() {
+ return new CompositeRuler();
+ }
+
+ /** The editor's vertical ruler. */
+ private IVerticalRuler fVerticalRuler;
+
+ /**
+ * Creates the annotation ruler column. Subclasses may re-implement or extend.
+ *
+ * @param ruler
+ * the composite ruler that the column will be added
+ * @return an annotation ruler column
+ * @since 3.2
+ */
+ protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
+ return new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
+ }
+
+
+ private void createSourceViewer(Composite parent) {
+ fVerticalRuler = createVerticalRuler();
+ fSourceViewer = fSourceViewerFactory.createSourceViewer(parent, fVerticalRuler, getOverviewRuler(), true, fStyle);
+ fViewerConfiguration = fSourceViewerConfigurationProvider.get();
+ fSourceViewer.configure(fViewerConfiguration);
+
+ installProjectionSupport(fSourceViewer);
+
+ // make sure the source viewer decoration support is initialized
+ getSourceViewerDecorationSupport(fSourceViewer);
+
+ fSourceViewer.getTextWidget().addFocusListener(new SourceViewerFocusListener());
+
+ fSourceViewerDecorationSupport.install(fPreferenceStoreAccess.getPreferenceStore());
+ parent.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ fSourceViewerDecorationSupport.dispose();
+ }
+ });
+ fDocument = fDocumentProvider.get();
+ ValidationJob job = new ValidationJob(fResourceValidator, fDocument, new IValidationIssueProcessor() {
+
+ private AnnotationIssueProcessor annotationIssueProcessor;
+
+ public void processIssues(List<Issue> issues, IProgressMonitor monitor) {
+ if(annotationIssueProcessor == null) {
+ annotationIssueProcessor = new AnnotationIssueProcessor(fDocument, fSourceViewer.getAnnotationModel(), new IssueResolutionProvider.NullImpl());
+ }
+ if(annotationIssueProcessor != null)
+ annotationIssueProcessor.processIssues(issues, monitor);
+ }
+ }, CheckMode.FAST_ONLY);
+ fDocument.setValidationJob(job);
+
+ fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateSelectionDependentActions();
+ }
+ });
+ }
+
+ private static final String ERROR_ANNOTATION_TYPE = "org.eclipse.xtext.ui.editor.error"; //$NON-NLS-1$
+
+ private static final String WARNING_ANNOTATION_TYPE = "org.eclipse.xtext.ui.editor.warning"; //$NON-NLS-1$
+
+ private ProjectionSupport installProjectionSupport(ProjectionViewer projectionViewer) {
+ ProjectionSupport projectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
+ projectionSupport.addSummarizableAnnotationType(WARNING_ANNOTATION_TYPE);
+ projectionSupport.addSummarizableAnnotationType(ERROR_ANNOTATION_TYPE);
+ projectionSupport.setAnnotationPainterDrawingStrategy(projectionAnnotationDrawingStrategy);
+ projectionSupport.install();
+ return projectionSupport;
+ }
+
+ /**
+ * Helper for managing the decoration support of this editor's viewer.
+ *
+ * <p>
+ * This field should not be referenced by subclasses. It is <code>protected</code> for API compatibility reasons and will be made
+ * <code>private</code> soon. Use {@link #getSourceViewerDecorationSupport(ISourceViewer)} instead.
+ * </p>
+ */
+ private SourceViewerDecorationSupport fSourceViewerDecorationSupport;
+
+ private void installFoldingSupport(ProjectionViewer projectionViewer) {
+ fFoldingStructureProvider.install(this, projectionViewer);
+ projectionViewer.doOperation(ProjectionViewer.TOGGLE);
+ fFoldingStructureProvider.initialize();
+ }
+
+ /**
+ * Returns the source viewer decoration support.
+ *
+ * @param viewer
+ * the viewer for which to return a decoration support
+ * @return the source viewer decoration support
+ */
+ private SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
+ if(fSourceViewerDecorationSupport == null) {
+ fSourceViewerDecorationSupport = new SourceViewerDecorationSupport(viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors());
+ configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
+ }
+ return fSourceViewerDecorationSupport;
+ }
+
+ /**
+ * Configures the decoration support for this editor's source viewer. Subclasses may override this
+ * method, but should call their superclass' implementation at some point.
+ *
+ * @param support
+ * the decoration support to configure
+ */
+ private void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
+
+ Iterator<AnnotationPreference> e = Iterators.filter(fAnnotationPreferences.getAnnotationPreferences().iterator(), AnnotationPreference.class);
+ while(e.hasNext())
+ support.setAnnotationPreference(e.next());
+
+ support.setCursorLinePainterPreferenceKeys(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
+ support.setMarginPainterPreferenceKeys(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
+ // support.setSymbolicFontName(getFontPropertyPreferenceKey());
+
+ if(characterPairMatcher != null) {
+ support.setCharacterPairMatcher(characterPairMatcher);
+ support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY, BracketMatchingPreferencesInitializer.COLOR_KEY);
+ }
+ }
+
+ /**
+ * Returns the overview ruler.
+ *
+ * @return the overview ruler
+ */
+ private IOverviewRuler getOverviewRuler() {
+ if(fOverviewRuler == null && (fStyle & SWT.V_SCROLL) != 0)
+ fOverviewRuler = createOverviewRuler(getSharedColors());
+ return fOverviewRuler;
+ }
+
+ /** The width of the vertical ruler. */
+ private static final int VERTICAL_RULER_WIDTH = 12;
+
+ /**
+ * Returns the annotation access.
+ *
+ * @return the annotation access
+ */
+ private IAnnotationAccess getAnnotationAccess() {
+ if(fAnnotationAccess == null)
+ fAnnotationAccess = createAnnotationAccess();
+ return fAnnotationAccess;
+ }
+
+ /**
+ * Creates the annotation access for this editor.
+ *
+ * @return the created annotation access
+ */
+ private IAnnotationAccess createAnnotationAccess() {
+ return new DefaultMarkerAnnotationAccess() {
+
+ @Override
+ public int getLayer(Annotation annotation) {
+ if(annotation.isMarkedDeleted()) {
+ return IAnnotationAccessExtension.DEFAULT_LAYER;
+ }
+ return super.getLayer(annotation);
+ }
+ };
+ }
+
+ /**
+ * The annotation preferences.
+ */
+ private MarkerAnnotationPreferences fAnnotationPreferences;
+
+ private IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
+ IOverviewRuler ruler = new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors);
+
+ Iterator<?> e = fAnnotationPreferences.getAnnotationPreferences().iterator();
+ while(e.hasNext()) {
+ AnnotationPreference preference = (AnnotationPreference)e.next();
+ if(preference.contributesToHeader())
+ ruler.addHeaderAnnotationType(preference.getAnnotationType());
+ }
+ return ruler;
+ }
+
+ private ISharedTextColors getSharedColors() {
+ return EditorsUI.getSharedTextColors();
+ }
+
+ /**
+ * Updates the text of this editor with the given String
+ *
+ * @param text
+ */
+ public void update(String text) {
+ IDocument document = fSourceViewer.getDocument();
+
+ fSourceViewer.setRedraw(false);
+ document.set(text);
+ fSourceViewer.setVisibleRegion(0, text.length());
+ fSourceViewer.setRedraw(true);
+ }
+
+ /**
+ * Updates the text of this editor with the given String or the
+ * serialized form of the EObject if the semantic model of the
+ * String does not contain any error and is different from the
+ * given EObject.
+ *
+ * @param eObject
+ * @param asString
+ */
+ public void update(EObject eObject, String asString) {
+ if(eObject != null) {
+ fResource.setParentResource(eObject.eResource());
+ EObject asStringEObject = null;
+ // XtextResource asStringResource = (XtextResource) fResourceSetProvider.get(null).createResource(URI.createURI("asStringResource." + fFileExtension));
+ ResourceSet resourceSet = fResourceSetProvider.get(null);
+ EmbeddedXtextResource asStringResource = fEmbeddedXtextResourceProvider.get();
+ resourceSet.getResources().add(asStringResource);
+ // EmbeddedXtextResource asStringResource = new EmbeddedXtextResource();
+ asStringResource.setURI(URI.createURI("asStringResource." + fFileExtension)); //$NON-NLS-1$
+ asStringResource.setParentResource(eObject.eResource());
+ try {
+ asStringResource.load(new StringInputStream(asString), Collections.emptyMap());
+ if(!asStringResource.getContents().isEmpty()) {
+ asStringEObject = asStringResource.getContents().get(0);
+ }
+ } catch (IOException e) {
+ // ignore, will set the string to the serialization of the given eObject
+ }
+
+ try {
+ EcoreUtil.resolveAll(asStringResource);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ if(!asStringResource.getErrors().isEmpty() || (asStringResource.getParseResult() != null && !asStringResource.getParseResult().getParseErrors().isEmpty())) {
+ // if there are parsing errors in the saved string, then we update with it
+ update(asString);
+ } else if(asStringEObject != null) {
+ try {
+ // Resource copyResource = (XtextResource) fResourceSetProvider.get(null).createResource(URI.createURI("copyResource." + fFileExtension));
+ // EmbeddedXtextResource copyResource = (EmbeddedXtextResource) fResourceSetProvider.get(null).createResource(URI.createURI("copyResource." + fFileExtension));
+ EmbeddedXtextResource copyResource = fEmbeddedXtextResourceProvider.get();
+ // EmbeddedXtextResource copyResource = new EmbeddedXtextResource();
+ copyResource.setURI(URI.createURI("copyResource." + fFileExtension)); //$NON-NLS-1$
+ copyResource.setParentResource(eObject.eResource());
+ try {
+ EObject copyEObject = EcoreUtil.copy(eObject);
+ copyResource.getContents().add(copyEObject);
+ EcoreUtil.resolveAll(copyResource);
+ if(!equals(copyEObject, asStringEObject)) {
+ // String model = getResource().getSerializer().serialize(copyEObject, SaveOptions.newBuilder().noValidation().format().getOptions());
+ update(asString); // FIXME: should update with the serialized form of the copyEObject but throw RuntimeException!!!
+ } else {
+ // if there is no error and the content are equals, then we also update with the string
+ update(asString);
+ }
+ } catch (Exception e) {
+ update(asString);
+ }
+
+ copyResource.unload();
+ } catch (Exception e) {
+ update(asString);
+ }
+ } else {
+ update("");
+ }
+
+ asStringResource.unload();
+ asStringResource.getResourceSet().getResources().remove(asStringResource);
+ } else {
+ update("");
+ }
+ }
+
+ private void createActions() {
+ {
+ TextViewerAction action = new TextViewerAction(fSourceViewer, ITextOperationTarget.CUT);
+ action.setText("Cut");
+ setAction(ITextEditorActionConstants.CUT, action);
+ setAsSelectionDependantAction(action);
+ }
+
+ {
+ TextViewerAction action = new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY);
+ action.setText("Copy");
+ setAction(ITextEditorActionConstants.COPY, action);
+ setAsSelectionDependantAction(action);
+ }
+
+ {
+ TextViewerAction action = new TextViewerAction(fSourceViewer, ITextOperationTarget.PASTE);
+ action.setText("Paste");
+ setAction(ITextEditorActionConstants.PASTE, action);
+ setAsSelectionDependantAction(action);
+ }
+
+ {
+ TextViewerAction action = new TextViewerAction(fSourceViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
+ action.setText("Content Assist");
+ setAction(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, action);
+ setAsContextDependantAction(action);
+ }
+
+ if(fViewerConfiguration.getContentFormatter(fSourceViewer) != null) {
+ TextViewerAction action = new TextViewerAction(fSourceViewer, ISourceViewer.FORMAT);
+ action.setText("Format");
+ setAction(XTEXT_UI_FORMAT_ACTION, action);
+ setAsContextDependantAction(action);
+ }
+
+ {
+ ToggleSLCommentAction action = new ToggleSLCommentAction(fSourceViewer);
+ setAction(XTEXT_UI_TOGGLE_SL_COMMENT_ACTION, action);
+ setAsContextDependantAction(action);
+ action.configure(fSourceViewer, fViewerConfiguration);
+ }
+ }
+
+ private void setAction(String actionID, IAction action) {
+ if(action.getId() == null)
+ action.setId(actionID); // make sure the action ID has been set
+
+ fActions.put(actionID, action);
+ }
+
+ private void setAsContextDependantAction(IAction action) {
+ fActionHandlers.add(new ActionHandler(action));
+ }
+
+ private void setAsSelectionDependantAction(IAction action) {
+ fSelectionDependentActions.add(action);
+ }
+
+ private void updateSelectionDependentActions() {
+ for(IAction action : fSelectionDependentActions) {
+ if(action instanceof IUpdate) {
+ ((IUpdate)action).update();
+ }
+ }
+ }
+
+ protected void updateAction(IAction action) {
+ //Nothing
+ }
+
+ private Map<String, IAction> fActions = Maps.newHashMap();
+
+ private List<IAction> fSelectionDependentActions = Lists.newArrayList();
+
+ private List<ActionHandler> fActionHandlers = Lists.newArrayList();
+
+ /**
+ * Source viewer focus listener that activates/deactivates action handlers on focus state change.
+ *
+ * @author Mikaël Barbero
+ *
+ */
+ private final class SourceViewerFocusListener implements FocusListener {
+
+ private static final String EMBEDEDXTEXT_EDITOR_CONTEXT = "org.eclipselabs.xtfo.embededxtextEditor.context"; //$NON-NLS-1$
+
+ private final Expression fExpression;
+
+ private final List<IHandlerActivation> fHandlerActivations;
+
+ private IContextActivation fContextActivation;
+
+ public SourceViewerFocusListener() {
+ fExpression = new ActiveShellExpression(fSourceViewer.getControl().getShell());
+ fHandlerActivations = Lists.newArrayList();
+
+ fSourceViewer.getControl().addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
+ handlerService.deactivateHandlers(fHandlerActivations);
+ fHandlerActivations.clear();
+ }
+ });
+ }
+
+ public void focusLost(FocusEvent e) {
+ if(fContextActivation != null) {
+
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ if(activeEditor != null) {
+ IContextService contextService = (IContextService)activeEditor.getSite().getService(IContextService.class);
+
+ contextService.deactivateContext(fContextActivation);
+ }
+ }
+
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
+ handlerService.deactivateHandlers(fHandlerActivations);
+ }
+
+ public void focusGained(FocusEvent e) {
+ IContextService contextService = (IContextService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite().getService(IContextService.class);
+ fContextActivation = contextService.activateContext(EMBEDEDXTEXT_EDITOR_CONTEXT);
+
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
+
+ for(ActionHandler actionHandler : fActionHandlers) {
+ fHandlerActivations.add(handlerService.activateHandler(actionHandler.getAction().getId(), actionHandler, fExpression));
+ }
+ }
+ }
+
+ protected EmbeddedXtextResource createResource() {
+ ResourceSet resourceSet = fResourceSetProvider.get(null);
+ // XtextResource result = (XtextResource) resourceSet.createResource(
+ // URI.createURI(fGrammarAccess.getGrammar().getName() + "." + fFileExtension));
+ EmbeddedXtextResource result = fEmbeddedXtextResourceProvider.get();
+ result.setURI(URI.createURI(fGrammarAccess.getGrammar().getName() + "." + fFileExtension)); //$NON-NLS-1$
+ resourceSet.getResources().add(result);
+ return result;
+ }
+
+ private static boolean equals(EObject expected, EObject actual) {
+ Map<String, Object> options = ImmutableMap.<String, Object> builder().put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE).build();
+ MatchModel match = null;
+ try {
+ match = MatchService.doMatch(expected, actual, options);
+ DiffModel diff = DiffService.doDiff(match, false);
+ return diff.getDifferences().isEmpty();
+ } catch (InterruptedException e) {
+ throw new AssertionError(e);
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextResource.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextResource.java
new file mode 100644
index 00000000000..8a240da0d44
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/EmbeddedXtextResource.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xtext.linking.lazy.LazyLinkingResource;
+
+public class EmbeddedXtextResource extends LazyLinkingResource {
+
+ private Resource parentResource = null;
+
+ public Resource getParentResource() {
+ return parentResource;
+ }
+
+ public void setParentResource(Resource parentResource) {
+ this.parentResource = parentResource;
+ }
+
+ public EmbeddedXtextResource() {
+ super();
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingHelper.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingHelper.java
new file mode 100644
index 00000000000..425389c981e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingHelper.java
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.xtext.ui.editor.XtextPresentationReconciler;
+import org.eclipse.xtext.ui.editor.XtextSourceViewer;
+import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class HighlightingHelper implements IPropertyChangeListener {
+
+ @Inject
+ private Provider<HighlightingReconciler> reconcilerProvider;
+
+ @Inject
+ private Provider<HighlightingPresenter> presenterProvider;
+
+ @Inject
+ private IPreferenceStoreAccess preferenceStoreAccessor;
+
+ /** Highlighting presenter */
+ @Inject
+ private HighlightingPresenter fPresenter;
+
+ /** Highlighting reconciler */
+ @Inject
+ private HighlightingReconciler fReconciler;
+
+ /** The source viewer */
+ private XtextSourceViewer fSourceViewer;
+
+ /** The source viewer configuration */
+ private XtextSourceViewerConfiguration fConfiguration;
+
+ /** The presentation reconciler */
+ private XtextPresentationReconciler fPresentationReconciler;
+
+ public void install(XtextSourceViewerConfiguration configuration, XtextSourceViewer sourceViewer) {
+ fSourceViewer = sourceViewer;
+ fConfiguration = configuration;
+
+ fPresentationReconciler = (XtextPresentationReconciler)fConfiguration.getPresentationReconciler(sourceViewer);
+ preferenceStoreAccessor.getPreferenceStore().addPropertyChangeListener(this);
+ enable();
+ }
+
+ /**
+ * Enable advanced highlighting.
+ */
+ private void enable() {
+ fPresenter = getPresenterProvider().get();
+ fPresenter.install(fSourceViewer, fPresentationReconciler);
+
+ if(fSourceViewer.getDocument() != null) {
+ fReconciler = reconcilerProvider.get();
+ fReconciler.install(fSourceViewer, fPresenter);
+ }
+ }
+
+ public void uninstall() {
+ disable();
+ preferenceStoreAccessor.getPreferenceStore().removePropertyChangeListener(this);
+ fSourceViewer = null;
+ fConfiguration = null;
+ fPresentationReconciler = null;
+ }
+
+ /**
+ * Disable advanced highlighting.
+ */
+ private void disable() {
+ if(fReconciler != null) {
+ fReconciler.uninstall();
+ fReconciler = null;
+ }
+
+ if(fPresenter != null) {
+ fPresenter.uninstall();
+ fPresenter = null;
+ }
+ }
+
+ /**
+ * Returns this hightlighter's reconciler.
+ *
+ * @return the highlighter reconciler or <code>null</code> if none
+ */
+ public HighlightingReconciler getReconciler() {
+ return fReconciler;
+ }
+
+ public void setReconcilerProvider(Provider<HighlightingReconciler> reconcilerProvider) {
+ this.reconcilerProvider = reconcilerProvider;
+ }
+
+ public Provider<HighlightingReconciler> getReconcilerProvider() {
+ return reconcilerProvider;
+ }
+
+ public void setPresenterProvider(Provider<HighlightingPresenter> presenterProvider) {
+ this.presenterProvider = presenterProvider;
+ }
+
+ public Provider<HighlightingPresenter> getPresenterProvider() {
+ return presenterProvider;
+ }
+
+ public void setPreferenceStoreAccessor(IPreferenceStoreAccess preferenceStoreAccessor) {
+ this.preferenceStoreAccessor = preferenceStoreAccessor;
+ }
+
+ public IPreferenceStoreAccess getPreferenceStoreAccessor() {
+ return preferenceStoreAccessor;
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(fReconciler != null && event.getProperty().contains(".syntaxColorer.tokenStyles")) //$NON-NLS-1$
+ fReconciler.refresh();
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingReconciler.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingReconciler.java
new file mode 100644
index 00000000000..4cb81737b57
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/HighlightingReconciler.java
@@ -0,0 +1,284 @@
+/**
+ * Copyright (c) 2010 itemis AG (http://www.itemis.eu) 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
+ */
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextInputListener;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextSourceViewer;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.model.IXtextModelListener;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.AttributedPosition;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.ITextAttributeProvider;
+import org.eclipse.xtext.ui.editor.syntaxcoloring.MergingHighlightedPositionAcceptor;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+
+import com.google.inject.Inject;
+
+/**
+ * @author Sebastian Zarnekow - Initial contribution and API
+ */
+public class HighlightingReconciler implements ITextInputListener, IXtextModelListener, IHighlightedPositionAcceptor {
+
+ @Inject(optional=true)
+ private ISemanticHighlightingCalculator calculator;
+
+ @Inject
+ private ITextAttributeProvider attributeProvider;
+
+ /** The source viewer this highlighting reconciler is installed on */
+ private XtextSourceViewer sourceViewer;
+ /** The highlighting presenter */
+ private HighlightingPresenter presenter;
+
+ /** Background job's added highlighted positions */
+ private final List<AttributedPosition> addedPositions = new ArrayList<AttributedPosition>();
+ /** Background job's removed highlighted positions */
+ private List<AttributedPosition> removedPositions = new ArrayList<AttributedPosition>();
+ /** Number of removed positions */
+ private int removedPositionCount;
+
+ /**
+ * Reconcile operation lock.
+ *
+ * @since 3.2
+ */
+ private final Object fReconcileLock = new Object();
+ /**
+ * <code>true</code> if any thread is executing <code>reconcile</code>, <code>false</code> otherwise.
+ *
+ * @since 3.2
+ */
+ private boolean reconciling = false;
+
+ /**
+ * Start reconciling positions.
+ */
+ private void startReconcilingPositions() {
+ presenter.addAllPositions(removedPositions);
+ removedPositionCount = removedPositions.size();
+ }
+
+ /**
+ * Reconcile positions based on the AST subtrees
+ *
+ * @param subtrees
+ * the AST subtrees
+ */
+ private void reconcilePositions(XtextResource resource) {
+ // for (int i= 0, n= subtrees.length; i < n; i++)
+ // subtrees[i].accept(fCollector);
+ MergingHighlightedPositionAcceptor acceptor = new MergingHighlightedPositionAcceptor(calculator);
+ acceptor.provideHighlightingFor(resource, this);
+// calculator.provideHighlightingFor(resource, this);
+ List<AttributedPosition> oldPositions = removedPositions;
+ List<AttributedPosition> newPositions = new ArrayList<AttributedPosition>(removedPositionCount);
+ for (int i = 0, n = oldPositions.size(); i < n; i++) {
+ AttributedPosition current = oldPositions.get(i);
+ if (current != null)
+ newPositions.add(current);
+ }
+ removedPositions = newPositions;
+ }
+
+ /**
+ * Add a position with the given range and highlighting if it does not exist already.
+ * @param offset The range offset
+ * @param length The range length
+ * @param highlighting The highlighting
+ */
+ public void addPosition(int offset, int length, String... ids) {
+ TextAttribute highlighting = ids.length == 1 ?
+ attributeProvider.getAttribute(ids[0])
+ : attributeProvider.getMergedAttributes(ids);
+ boolean isExisting= false;
+ // TODO: use binary search
+ for (int i= 0, n= removedPositions.size(); i < n; i++) {
+ AttributedPosition position= removedPositions.get(i);
+ if (position == null)
+ continue;
+ if (position.isEqual(offset, length, highlighting)) {
+ isExisting= true;
+ removedPositions.set(i, null);
+ removedPositionCount--;
+ break;
+ }
+ }
+
+ if (!isExisting) {
+ AttributedPosition position= presenter.createHighlightedPosition(offset, length, highlighting);
+ addedPositions.add(position);
+ }
+ }
+
+ /**
+ * Update the presentation.
+ *
+ * @param textPresentation
+ * the text presentation
+ * @param addedPositions
+ * the added positions
+ * @param removedPositions
+ * the removed positions
+ */
+ private void updatePresentation(TextPresentation textPresentation, List<AttributedPosition> addedPositions,
+ List<AttributedPosition> removedPositions) {
+ Runnable runnable = presenter.createUpdateRunnable(textPresentation, addedPositions, removedPositions);
+ if (runnable == null)
+ return;
+
+ Display display = getDisplay();
+ display.asyncExec(runnable);
+ }
+
+ private Display getDisplay() {
+ return this.sourceViewer.getControl().getDisplay();
+ }
+
+ /**
+ * Stop reconciling positions.
+ */
+ private void stopReconcilingPositions() {
+ removedPositions.clear();
+ removedPositionCount = 0;
+ addedPositions.clear();
+ }
+
+ /**
+ * Install this reconciler on the given editor and presenter.
+ *
+ * @param editor
+ * the editor
+ * @param sourceViewer
+ * the source viewer
+ * @param presenter
+ * the highlighting presenter
+ */
+ public void install(XtextSourceViewer sourceViewer, HighlightingPresenter presenter) {
+ this.presenter = presenter;
+ this.sourceViewer = sourceViewer;
+ if (calculator != null) {
+ ((IXtextDocument) sourceViewer.getDocument()).addModelListener(this);
+ sourceViewer.addTextInputListener(this);
+ }
+ refresh();
+ }
+
+ /**
+ * Uninstall this reconciler from the editor
+ */
+ public void uninstall() {
+ if (presenter != null)
+ presenter.setCanceled(true);
+
+ if (sourceViewer.getDocument() != null) {
+ if (calculator != null) {
+ XtextDocument document = (XtextDocument) sourceViewer.getDocument();
+ document.removeModelListener(this);
+ sourceViewer.removeTextInputListener(this);
+ }
+ }
+
+ sourceViewer = null;
+ presenter = null;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
+ */
+ public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
+ if (oldInput != null)
+ ((IXtextDocument) oldInput).removeModelListener(this);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
+ */
+ public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
+ if (newInput != null) {
+ refresh();
+ ((IXtextDocument) newInput).addModelListener(this);
+ }
+ }
+
+ /**
+ * Refreshes the highlighting.
+ */
+ public void refresh() {
+ if (calculator != null) {
+ ((XtextDocument) sourceViewer.getDocument()).readOnly(new IUnitOfWork.Void<XtextResource>() {
+ @Override
+ public void process(XtextResource state) throws Exception {
+ modelChanged(state);
+ }
+ });
+ } else {
+ Display display = getDisplay();
+ display.asyncExec(presenter.createSimpleUpdateRunnable());
+ }
+ }
+
+ public void modelChanged(XtextResource resource) {
+ // ensure at most one thread can be reconciling at any time
+ synchronized (fReconcileLock) {
+ if (reconciling)
+ return;
+ reconciling = true;
+ }
+ final HighlightingPresenter highlightingPresenter = presenter;
+ try {
+ if (highlightingPresenter == null)
+ return;
+
+ highlightingPresenter.setCanceled(false);
+
+ if (highlightingPresenter.isCanceled())
+ return;
+
+ startReconcilingPositions();
+
+ if (!highlightingPresenter.isCanceled()) {
+ reconcilePositions(resource);
+ }
+
+ final TextPresentation[] textPresentation = new TextPresentation[1];
+ if (!highlightingPresenter.isCanceled()) {
+ textPresentation[0] = highlightingPresenter.createPresentation(addedPositions, removedPositions);
+ }
+
+ if (!highlightingPresenter.isCanceled())
+ updatePresentation(textPresentation[0], addedPositions, removedPositions);
+
+ stopReconcilingPositions();
+ }
+ finally {
+ synchronized (fReconcileLock) {
+ reconciling = false;
+ }
+ }
+ }
+
+ public void setCalculator(ISemanticHighlightingCalculator calculator) {
+ this.calculator = calculator;
+ }
+
+ public ISemanticHighlightingCalculator getCalculator() {
+ return calculator;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/TextViewerAction.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/TextViewerAction.java
new file mode 100644
index 00000000000..fca5e4e3887
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/TextViewerAction.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+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 fOperationCode = -1;
+
+ private ITextOperationTarget fOperationTarget;
+
+ /**
+ * Creates a new action.
+ *
+ * @param viewer
+ * the viewer
+ * @param operationCode
+ * the opcode
+ */
+ public TextViewerAction(ITextViewer viewer, int operationCode) {
+ fOperationCode = operationCode;
+ fOperationTarget = viewer.getTextOperationTarget();
+ update();
+ }
+
+ /**
+ * Updates the enabled state of the action.
+ * Fires a property change if the enabled state changes.
+ *
+ * @see Action#firePropertyChange(String, Object, Object)
+ */
+ public void update() {
+ boolean wasEnabled = isEnabled();
+ boolean isEnabled = (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
+ setEnabled(isEnabled);
+
+ if(wasEnabled != isEnabled) {
+ firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+ }
+
+ /**
+ * @see Action#run()
+ */
+ @Override
+ public void run() {
+ if(fOperationCode != -1 && fOperationTarget != null) {
+ fOperationTarget.doOperation(fOperationCode);
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/ToggleSLCommentAction.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/ToggleSLCommentAction.java
new file mode 100644
index 00000000000..1ef1778be86
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/ToggleSLCommentAction.java
@@ -0,0 +1,305 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.xtext.widgets.Activator;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * This implementation has been copied from org.eclipse.jdt.internal.ui.javaeditor.ToggleCommentAction.
+ *
+ * @author Sebastian Zarnekow - Initial contribution and API
+ * @author Mikaël Barbero - Changed from TextEditorAction to TextViewerAction as superclass.
+ */
+public final class ToggleSLCommentAction extends Action implements IUpdate {
+
+ private ITextOperationTarget fOperationTarget;
+
+ private ITextViewer fViewer;
+
+ /** The document partitioning */
+ private String fDocumentPartitioning;
+
+ /** The comment prefixes */
+ private Map<String, String[]> fPrefixesMap;
+
+ /**
+ * Creates and initializes the action for the given text editor. The action
+ * configures its visual representation from the given resource bundle.
+ *
+ * @param bundle
+ * the resource bundle
+ * @param prefix
+ * a prefix to be prepended to the various resource keys
+ * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none
+ * @param editor
+ * the text editor
+ * @see ResourceAction#ResourceAction(ResourceBundle, String, int)
+ */
+ public ToggleSLCommentAction(ITextViewer viewer) {
+ fViewer = viewer;
+ fOperationTarget = viewer.getTextOperationTarget();
+ }
+
+ /**
+ * Implementation of the <code>IAction</code> prototype. Checks if the selected
+ * lines are all commented or not and uncomments/comments them respectively.
+ */
+ @Override
+ public void run() {
+ if(fOperationTarget == null || fDocumentPartitioning == null || fPrefixesMap == null)
+ return;
+
+ final int operationCode;
+ if(isSelectionCommented(fViewer.getSelectionProvider().getSelection()))
+ operationCode = ITextOperationTarget.STRIP_PREFIX;
+ else
+ operationCode = ITextOperationTarget.PREFIX;
+
+ Shell shell = fViewer.getTextWidget().getShell();
+ if(!fOperationTarget.canDoOperation(operationCode)) {
+ if(shell != null)
+ MessageDialog.openError(shell, "An error occured", "ToggleComment_error_message=An error occurred while toggling comments.");
+ return;
+ }
+
+ Display display = null;
+ if(shell != null && !shell.isDisposed())
+ display = shell.getDisplay();
+
+ BusyIndicator.showWhile(display, new Runnable() {
+
+ public void run() {
+ fOperationTarget.doOperation(operationCode);
+ }
+ });
+ }
+
+ /**
+ * Is the given selection single-line commented?
+ *
+ * @param selection
+ * Selection to check
+ * @return <code>true</code> iff all selected lines are commented
+ */
+ private boolean isSelectionCommented(ISelection selection) {
+ if(!(selection instanceof ITextSelection))
+ return false;
+
+ ITextSelection textSelection = (ITextSelection)selection;
+ if(textSelection.getStartLine() < 0 || textSelection.getEndLine() < 0)
+ return false;
+
+ IDocument document = fViewer.getDocument();
+
+ try {
+
+ IRegion block = getTextBlockFromSelection(textSelection, document);
+ ITypedRegion[] regions = TextUtilities.computePartitioning(document, fDocumentPartitioning, block.getOffset(), block.getLength(), false);
+
+ int[] lines = new int[regions.length * 2]; // [startline, endline, startline, endline, ...]
+ for(int i = 0, j = 0; i < regions.length; i++, j += 2) {
+ // start line of region
+ lines[j] = getFirstCompleteLineOfRegion(regions[i], document);
+ // end line of region
+ int length = regions[i].getLength();
+ int offset = regions[i].getOffset() + length;
+ if(length > 0)
+ offset--;
+ lines[j + 1] = (lines[j] == -1 ? -1 : document.getLineOfOffset(offset));
+ }
+
+ // Perform the check
+ for(int i = 0, j = 0; i < regions.length; i++, j += 2) {
+ String[] prefixes = fPrefixesMap.get(regions[i].getType());
+ if(prefixes != null && prefixes.length > 0 && lines[j] >= 0 && lines[j + 1] >= 0)
+ if(!isBlockCommented(lines[j], lines[j + 1], prefixes, document))
+ return false;
+ }
+
+ return true;
+
+ } catch (BadLocationException x) {
+ // should not happen
+ Activator.log.error(x);
+ }
+
+ return false;
+ }
+
+ /**
+ * Creates a region describing the text block (something that starts at
+ * the beginning of a line) completely containing the current selection.
+ *
+ * @param selection
+ * The selection to use
+ * @param document
+ * The document
+ * @return the region describing the text block comprising the given selection
+ */
+ private IRegion getTextBlockFromSelection(ITextSelection selection, IDocument document) {
+
+ try {
+ IRegion line = document.getLineInformationOfOffset(selection.getOffset());
+ int length = selection.getLength() == 0 ? line.getLength() : selection.getLength() + (selection.getOffset() - line.getOffset());
+ return new Region(line.getOffset(), length);
+
+ } catch (BadLocationException x) {
+ // should not happen
+ Activator.log.error(x);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the index of the first line whose start offset is in the given text range.
+ *
+ * @param region
+ * the text range in characters where to find the line
+ * @param document
+ * The document
+ * @return the first line whose start index is in the given range, -1 if there is no such line
+ */
+ private int getFirstCompleteLineOfRegion(IRegion region, IDocument document) {
+
+ try {
+
+ int startLine = document.getLineOfOffset(region.getOffset());
+
+ int offset = document.getLineOffset(startLine);
+ if(offset >= region.getOffset())
+ return startLine;
+
+ offset = document.getLineOffset(startLine + 1);
+ return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1);
+
+ } catch (BadLocationException x) {
+ // should not happen
+ Activator.log.error(x);
+ }
+
+ return -1;
+ }
+
+ /**
+ * Determines whether each line is prefixed by one of the prefixes.
+ *
+ * @param startLine
+ * Start line in document
+ * @param endLine
+ * End line in document
+ * @param prefixes
+ * Possible comment prefixes
+ * @param document
+ * The document
+ * @return <code>true</code> iff each line from <code>startLine</code> to and including <code>endLine</code> is prepended by one
+ * of the <code>prefixes</code>, ignoring whitespace at the
+ * begin of line
+ */
+ private boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document) {
+
+ try {
+
+ // check for occurrences of prefixes in the given lines
+ for(int i = startLine; i <= endLine; i++) {
+
+ IRegion line = document.getLineInformation(i);
+ String text = document.get(line.getOffset(), line.getLength());
+
+ int[] found = TextUtilities.indexOf(prefixes, text, 0);
+
+ if(found[0] == -1)
+ // found a line which is not commented
+ return false;
+
+ String s = document.get(line.getOffset(), found[0]);
+ s = s.trim();
+ if(s.length() != 0)
+ // found a line which is not commented
+ return false;
+
+ }
+
+ return true;
+
+ } catch (BadLocationException x) {
+ // should not happen
+ Activator.log.error(x);
+ }
+
+ return false;
+ }
+
+ /**
+ * Implementation of the <code>IUpdate</code> prototype method discovers
+ * the operation through the current editor's <code>ITextOperationTarget</code> adapter, and sets the enabled state
+ * accordingly.
+ */
+ public void update() {
+ boolean isEnabled = (fOperationTarget != null && fOperationTarget.canDoOperation(ITextOperationTarget.PREFIX) && fOperationTarget.canDoOperation(ITextOperationTarget.STRIP_PREFIX));
+ setEnabled(isEnabled);
+ }
+
+ public void configure(ISourceViewer sourceViewer, SourceViewerConfiguration configuration) {
+ fPrefixesMap = null;
+
+ String[] types = configuration.getConfiguredContentTypes(sourceViewer);
+ Map<String, String[]> prefixesMap = new HashMap<String, String[]>(types.length);
+ for(int i = 0; i < types.length; i++) {
+ String type = types[i];
+ String[] prefixes = configuration.getDefaultPrefixes(sourceViewer, type);
+ if(prefixes != null && prefixes.length > 0) {
+ int emptyPrefixes = 0;
+ for(int j = 0; j < prefixes.length; j++)
+ if(prefixes[j].length() == 0)
+ emptyPrefixes++;
+
+ if(emptyPrefixes > 0) {
+ String[] nonemptyPrefixes = new String[prefixes.length - emptyPrefixes];
+ for(int j = 0, k = 0; j < prefixes.length; j++) {
+ String prefix = prefixes[j];
+ if(prefix.length() != 0) {
+ nonemptyPrefixes[k] = prefix;
+ k++;
+ }
+ }
+ prefixes = nonemptyPrefixes;
+ }
+
+ prefixesMap.put(type, prefixes);
+ }
+ }
+ fDocumentPartitioning = configuration.getConfiguredDocumentPartitioning(sourceViewer);
+ fPrefixesMap = prefixesMap;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/XTextEditor.java b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/XTextEditor.java
new file mode 100644
index 00000000000..dd9f856e7cf
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.xtext.widgets/src/org/eclipse/papyrus/infra/xtext/widgets/embedded/XTextEditor.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.xtext.widgets.embedded;
+
+import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class XTextEditor extends AbstractValueEditor {
+
+ public XTextEditor(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ public Object getValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getEditableType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setToolTipText(String text) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/.classpath b/deprecated/org.eclipse.papyrus.uml.documentation/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/.project b/deprecated/org.eclipse.papyrus.uml.documentation/.project
new file mode 100644
index 00000000000..a2dd10157fe
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.documentation</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/deprecated/org.eclipse.papyrus.uml.documentation/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.uml.documentation/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d984a68cd13
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.views.documentation;bundle-version="0.10.1",
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.uml.documentation.profile;bundle-version="0.10.1",
+ org.eclipse.core.runtime;bundle-version="3.8.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.documentation.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.documentation;singleton:=
+ true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/about.html b/deprecated/org.eclipse.papyrus.uml.documentation/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/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/deprecated/org.eclipse.papyrus.uml.documentation/build.properties b/deprecated/org.eclipse.papyrus.uml.documentation/build.properties
new file mode 100644
index 00000000000..972de33ac51
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:51 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,about.html,plugin.properties
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/plugin.properties b/deprecated/org.eclipse.papyrus.uml.documentation/plugin.properties
new file mode 100644
index 00000000000..1221470b2bd
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/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=UML implementation of Papyrus Documentation (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/plugin.xml b/deprecated/org.eclipse.papyrus.uml.documentation/plugin.xml
new file mode 100644
index 00000000000..27c9a11ec3a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/plugin.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.views.documentation.documentationManager">
+ <documentationManager
+ managerClass="org.eclipse.papyrus.uml.documentation.UMLDocumentationManager"
+ modelNsURI="http://www.eclipse.org/uml2/3.0.0/UML"
+ priority="Lowest">
+ </documentationManager>
+ <documentationManager
+ managerClass="org.eclipse.papyrus.uml.documentation.UMLDocumentationManager"
+ modelNsURI="http://www.eclipse.org/uml2/2.1.0/UML"
+ priority="Lowest">
+ </documentationManager>
+ <documentationManager
+ managerClass="org.eclipse.papyrus.uml.documentation.UMLDocumentationManager"
+ modelNsURI="http://www.eclipse.org/uml2/2.0.0/UML"
+ priority="Lowest">
+ </documentationManager>
+ </extension>
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Activator.java b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Activator.java
new file mode 100644
index 00000000000..18e14cb06d3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Activator.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * 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.uml.documentation;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Messages.java b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Messages.java
new file mode 100644
index 00000000000..9933755a800
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Messages.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.uml.documentation;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.documentation.messages"; //$NON-NLS-1$
+
+ public static String UMLDocumentationManager_DocOnDocCommentError;
+
+ public static String UMLDocumentationManager_NonUMLElementError;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLAddOrRemoveAssociatedResourceCommand.java b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLAddOrRemoveAssociatedResourceCommand.java
new file mode 100644
index 00000000000..76b799bda25
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLAddOrRemoveAssociatedResourceCommand.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * 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.uml.documentation;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.uml.documentation.profile.IUMLDocumentationConstants;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+@SuppressWarnings("unchecked")
+public class UMLAddOrRemoveAssociatedResourceCommand extends AbstractCommand {
+
+ private Element element;
+
+ private Comment documentationComment = null;
+
+ private Stereotype documentationStereotype = null;
+
+ private Set<IDocumentationChangedListener> documentationChangedListeners;
+
+ private boolean remove;
+
+ private String resourceURIString;
+
+ public UMLAddOrRemoveAssociatedResourceCommand(boolean remove, Element element, URI resourceURI, Set<IDocumentationChangedListener> documentationChangedListeners) {
+ super(org.eclipse.papyrus.views.documentation.Messages.AddOrRemoveAssociatedResourceCommandLabel);
+ this.remove = remove;
+ this.element = element;
+ this.resourceURIString = resourceURI.toString();
+ this.documentationChangedListeners = documentationChangedListeners;
+ }
+
+ @Override
+ public boolean canExecute() {
+ return true;
+ }
+
+ @Override
+ public boolean canUndo() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() {
+ EList<Comment> ownedComments = element.getOwnedComments();
+
+ for(Comment comment : ownedComments) {
+ documentationStereotype = comment.getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME);
+ if(documentationStereotype != null) {
+ documentationComment = comment;
+ break;
+ }
+ }
+
+ redo();
+ }
+
+ private void notifyListeners() {
+ for(IDocumentationChangedListener listener : documentationChangedListeners) {
+ listener.documentationChanged(element);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void redo() {
+ if (remove) {
+ removeAssociatedResource();
+ } else {
+ addAssociatedResource();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void undo() {
+ if (remove) {
+ addAssociatedResource();
+ } else {
+ removeAssociatedResource();
+ }
+ }
+
+ private void removeAssociatedResource() {
+ if(documentationStereotype != null && documentationComment != null) {
+ List<String> resourceURIs = (List<String>)documentationComment.getValue(documentationStereotype, IUMLDocumentationConstants.RESOURCE_PROPERTY_NAME);
+ resourceURIs.remove(resourceURIString);
+ notifyListeners();
+ }
+ }
+
+ private void addAssociatedResource() {
+ if(documentationStereotype != null && documentationComment != null) {
+ List<String> resourceURIs = (List<String>)documentationComment.getValue(documentationStereotype, IUMLDocumentationConstants.RESOURCE_PROPERTY_NAME);
+ resourceURIs.add(resourceURIString);
+ notifyListeners();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLChangeDocumentationCommand.java b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLChangeDocumentationCommand.java
new file mode 100644
index 00000000000..cd43fc17712
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLChangeDocumentationCommand.java
@@ -0,0 +1,193 @@
+/*****************************************************************************
+ * 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.uml.documentation;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.util.EList;
+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.papyrus.uml.documentation.profile.IUMLDocumentationConstants;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * A GEF Command use to update documentation using profiled Comment.
+ *
+ */
+public class UMLChangeDocumentationCommand extends AbstractCommand {
+
+ private Element element;
+
+ private String newComment;
+
+ private String oldComment;
+
+ private Comment documentationComment = null;
+
+ private Stereotype documentationStereotype = null;
+
+ private boolean profileWasAlreadyApplied = false;
+
+ private Set<IDocumentationChangedListener> documentationChangedListeners;
+
+ public UMLChangeDocumentationCommand(Element element, String newDocumentation, Set<IDocumentationChangedListener> documentationChangedListeners) {
+ super(org.eclipse.papyrus.views.documentation.Messages.ChangeDocCommandLabel);
+ this.element = element;
+ this.newComment = newDocumentation;
+ this.documentationChangedListeners = documentationChangedListeners;
+ }
+
+ @Override
+ public boolean canExecute() {
+ return true;
+ }
+
+ @Override
+ public boolean canUndo() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() {
+
+ profileWasAlreadyApplied = element.getNearestPackage().getAppliedProfile(IUMLDocumentationConstants.PROFILE_NAME, true) != null;
+
+ // stores the previous doc
+ oldComment = null;
+
+ EList<Comment> ownedComments = element.getOwnedComments();
+
+ for(Comment comment : ownedComments) {
+ documentationStereotype = comment.getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME);
+ if(documentationStereotype != null) {
+ documentationComment = comment;
+ break;
+ }
+ }
+
+ if(documentationComment != null) {
+ oldComment = documentationComment.getBody();
+ }
+
+ redo();
+ }
+
+ private void notifyListeners() {
+ for(IDocumentationChangedListener listener : documentationChangedListeners) {
+ listener.documentationChanged(element);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void redo() {
+ changeDocumentation(newComment);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void undo() {
+ changeDocumentation(oldComment);
+ }
+
+ private IStatus changeDocumentation(String newDoc) {
+ if(newDoc != null) {
+ if(documentationComment == null) {
+ documentationComment = UMLFactory.eINSTANCE.createComment();
+ element.getOwnedComments().add(documentationComment);
+ applyDocumentationStereotype(documentationComment);
+ }
+
+ documentationComment.setBody(newDoc);
+ } else {
+ removeDocumentation();
+ }
+ notifyListeners();
+ return Status.OK_STATUS;
+ }
+
+ private void removeDocumentation() {
+ if(documentationComment != null) {
+ Stereotype documentationStereotype = documentationComment.getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME);
+ if(documentationStereotype != null) {
+ documentationComment.unapplyStereotype(documentationStereotype);
+ }
+ element.getOwnedComments().remove(documentationComment);
+ documentationComment = null;
+ }
+
+ // remove profile application if not applied before
+ if(!profileWasAlreadyApplied) {
+ Profile documentationProfile = element.getNearestPackage().getAppliedProfile(IUMLDocumentationConstants.PROFILE_NAME, true);
+ if(documentationProfile != null) {
+ element.getNearestPackage().unapplyProfile(documentationProfile);
+ }
+ }
+ }
+
+ public void applyDocumentationStereotype(Comment comment) {
+
+ Profile documentationProfile = element.getNearestPackage().getAppliedProfile(IUMLDocumentationConstants.PROFILE_NAME, true);
+
+ if(documentationProfile == null) {
+ ResourceSet rs = null;
+ Resource resource = element.eResource();
+ if(resource != null) {
+ rs = resource.getResourceSet();
+ }
+ if (rs == null) {
+ rs = new ResourceSetImpl();
+ }
+
+ Resource papyrusProfileResource = rs.getResource(URI.createURI(IUMLDocumentationConstants.PROFILE_URI), true);
+
+ if(papyrusProfileResource != null && !papyrusProfileResource.getContents().isEmpty() && papyrusProfileResource.getContents().get(0) instanceof Profile) {
+ Profile papyrusProfile = (Profile)papyrusProfileResource.getContents().get(0);
+
+ NamedElement possibleDocumentationProfile = papyrusProfile.getMember(IUMLDocumentationConstants.DOCUMENTATION_SUB_PROFILE_NAME);
+
+ if (possibleDocumentationProfile instanceof Profile) {
+ documentationProfile = (Profile)possibleDocumentationProfile;
+ element.getNearestPackage().applyProfile(documentationProfile);
+ }
+ }
+
+ }
+
+ if (documentationProfile != null) {
+ Stereotype documentationStereotype = documentationProfile.getOwnedStereotype(IUMLDocumentationConstants.STEREOTYPE_NAME);
+
+ if(documentationStereotype != null) {
+ comment.applyStereotype(documentationStereotype);
+ }
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLDocumentationManager.java b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLDocumentationManager.java
new file mode 100644
index 00000000000..7e98e921145
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLDocumentationManager.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * 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.uml.documentation;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.documentation.profile.IUMLDocumentationConstants;
+import org.eclipse.papyrus.views.documentation.DocumentationUnsupportedException;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.papyrus.views.documentation.IDocumentationManager;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+
+public class UMLDocumentationManager implements IDocumentationManager {
+
+ private static class UMLDocumentationManagerHolder {
+
+ public static final UMLDocumentationManager instance = new UMLDocumentationManager();
+ }
+
+ public static UMLDocumentationManager getInstance() {
+ return UMLDocumentationManagerHolder.instance;
+ }
+
+ private static Set<IDocumentationChangedListener> documentationChangedListeners = new HashSet<IDocumentationChangedListener>();
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getChangeDocumentationCommand(EObject eObject, String newDocumentation) {
+ if (getUnsupportedErrorMessage(eObject) == null) {
+ return new UMLChangeDocumentationCommand((Element)eObject, newDocumentation, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDocumentation(EObject eObject) throws DocumentationUnsupportedException {
+ String errorMsg = getUnsupportedErrorMessage(eObject);
+ if (errorMsg == null) {
+ EList<Comment> ownedComments = ((Element)eObject).getOwnedComments();
+
+ for(Comment comment : ownedComments) {
+ if(comment.getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME) != null) {
+ return comment.getBody();
+ }
+ }
+ return null;
+ } else {
+ throw new DocumentationUnsupportedException(errorMsg);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<URI> getAssociatedResources(EObject eObject) throws DocumentationUnsupportedException {
+ String errorMsg = getUnsupportedErrorMessage(eObject);
+ if (errorMsg == null) {
+ List<URI> URIs = new LinkedList<URI>();
+ EList<Comment> ownedComments = ((Element)eObject).getOwnedComments();
+
+ for(Comment comment : ownedComments) {
+ Stereotype docStereotype = comment.getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME);
+ if(docStereotype != null) {
+ List<String> stringURIs = (List<String>)comment.getValue(docStereotype, IUMLDocumentationConstants.RESOURCE_PROPERTY_NAME);
+ for (String stringURI : stringURIs) {
+ URIs.add(URI.createURI(stringURI));
+ }
+ }
+ }
+ return URIs;
+ } else {
+ throw new DocumentationUnsupportedException(errorMsg);
+ }
+ }
+
+ /**
+ * {@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;
+ }
+
+ /**
+ * get an error message if eObject is unsupported by this implementation
+ * @param eObject
+ * @return null if documentation is supported or an error message if not
+ */
+ private static String getUnsupportedErrorMessage(EObject eObject) {
+ // can't have a documentation on a documentation comment
+ if(eObject instanceof Comment && ((Comment)eObject).getAppliedStereotype(IUMLDocumentationConstants.STEREOTYPE_QUALIFIED_NAME) != null) {
+ return Messages.UMLDocumentationManager_DocOnDocCommentError;
+ } else if(eObject instanceof Element) {
+ // OK, return null
+ return null;
+ } else {
+ return Messages.UMLDocumentationManager_NonUMLElementError;
+ }
+ }
+
+ public Command getAddAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ if (getUnsupportedErrorMessage(eObject) == null) {
+ return new UMLAddOrRemoveAssociatedResourceCommand(false, (Element)eObject, resourceURI, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+
+ public Command getRemoveAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ if (getUnsupportedErrorMessage(eObject) == null) {
+ return new UMLAddOrRemoveAssociatedResourceCommand(true, (Element)eObject, resourceURI, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/messages.properties b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/messages.properties
new file mode 100644
index 00000000000..09c53a6992e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/messages.properties
@@ -0,0 +1,2 @@
+UMLDocumentationManager_DocOnDocCommentError=Documentation on documentation comment unsupported
+UMLDocumentationManager_NonUMLElementError=Documentation on non UML element unsupported by this implementation
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.project b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.project
new file mode 100644
index 00000000000..6947862fdd5
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.properties.tabbedproperties.comments</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/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0f12a878a9a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Nov 26 19:09:06 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..28f12ef60ab
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.views.properties.tabbed,
+ org.eclipse.emf.ecore;bundle-version="2.5.0",
+ org.eclipse.uml2.uml;bundle-version="3.0.0",
+ org.eclipse.emf.edit;bundle-version="2.5.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="0.10.1",
+ org.eclipse.epf.richtext;bundle-version="1.2.0",
+ org.eclipse.emf.edit.ui;bundle-version="2.5.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.1",
+ org.eclipse.gef;bundle-version="3.7.1",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1"
+Export-Package: org.eclipse.papyrus.uml.properties.tabbedproperties.comments,
+ org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.properties.tabbedproperties.
+ comments.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.properties.tabbedproperti
+ es.comments;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/about.html b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/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/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/build.properties b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/build.properties
new file mode 100644
index 00000000000..9b2f95aa4ed
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:30:17 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,icons/,bin/,about.html,plugin.properties
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/icons/ConsoleView.gif b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/icons/ConsoleView.gif
new file mode 100644
index 00000000000..a598f6082f6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/icons/ConsoleView.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.properties b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.properties
new file mode 100644
index 00000000000..8bf4177acf1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 CEA LIST.
+# 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:
+# Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - initial API and implementation
+##################################################################################
+pluginName=Papyrus Comments TabbedProperties Plug in (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.xml b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.xml
new file mode 100644
index 00000000000..ec7ae22e328
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="TreeOutlinePage">
+ <propertySection
+ class="org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentPropertySection"
+ filter="org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentFilter"
+ id="org.eclipse.papyrus.tabbedproperties.comment.styledsection"
+ tab="Base">
+ </propertySection>
+ <propertySection
+ class="org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentedElementPropertySection"
+ filter="org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentedElementPropertySection"
+ id="org.eclipse.papyrus.tabbedproperties.comment.umlelementsection"
+ tab="Comments">
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
+ <DirectEditor
+ contributor="CEA LIST"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
+ language="Papyrus UML"
+ objectToEdit="org.eclipse.uml2.uml.Comment">
+ <advancededitor
+ editorConfiguration="org.eclipse.papyrus.uml.properties.tabbedproperties.comments.directeditor.HTMLCommentEditorDialogConfiguration">
+ </advancededitor>
+ </DirectEditor>
+ </extension>
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Activator.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Activator.java
new file mode 100644
index 00000000000..fb7c1861610
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Activator.java
@@ -0,0 +1,54 @@
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.properties.tabbedproperties.comments";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** logging helper */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(plugin);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ log = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Messages.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Messages.java
new file mode 100644
index 00000000000..3673aa3c156
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Messages.java
@@ -0,0 +1,34 @@
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.properties.tabbedproperties.comments.messages"; //$NON-NLS-1$
+
+ public static String CommentedElementPropertySection_AddButtonTooltip;
+
+ public static String CommentedElementPropertySection_AddCommentCommand;
+
+ public static String CommentedElementPropertySection_CommentsViewerLabel;
+
+ public static String CommentedElementPropertySection_DeleteButtonTooltip;
+
+ public static String CommentedElementPropertySection_DestroyUpdateComment_DialogTitle;
+
+ public static String CommentedElementPropertySection_DestroyUpdateComment_Message;
+
+ public static String CommentedElementPropertySection_DisplayButtonTooltip;
+
+ public static String CommentedElementPropertySection_RemoveCommentCommand;
+
+ public static String HTMLCommentEditorDialogConfiguration_CommentDialogTitle;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
new file mode 100644
index 00000000000..c7248c68e8e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
@@ -0,0 +1,180 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.directeditor;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Messages;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentRichTextEditor;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentRichTextFormToolkit;
+import org.eclipse.swt.SWT;
+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.forms.widgets.FormToolkit;
+import org.eclipse.uml2.uml.Comment;
+
+
+/**
+ *
+ */
+public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorConfiguration implements IAdvancedEditorConfiguration {
+
+ /**
+ * Constructor.
+ */
+ public HTMLCommentEditorDialogConfiguration() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration#getTextToEdit(java.lang.Object)
+ *
+ * @param objectToEdit
+ * @return
+ */
+
+ @Override
+ public String getTextToEdit(Object objectToEdit) {
+ if(objectToEdit instanceof Comment) {
+ return ((Comment)objectToEdit).getBody();
+ }
+ return super.getTextToEdit(objectToEdit);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration#createDialog(org.eclipse.swt.widgets.Shell,
+ * org.eclipse.emf.ecore.EObject, java.lang.String)
+ *
+ * @param shell
+ * @param objectToEdit
+ * @param textToEdit
+ * @return
+ */
+
+ public Dialog createDialog(Shell shell, EObject objectToEdit, String textToEdit) {
+ if(objectToEdit instanceof Comment) {
+ return new CommentEditorDialog(shell, (Comment)objectToEdit, textToEdit);
+ }
+ return null;
+ }
+
+ public class CommentEditorDialog extends TrayDialog implements ILabelEditorDialog {
+
+ /** text to edit */
+ private String textToEdit;
+
+ /** object to edit */
+ private Comment commentToEdit;
+
+ /** return value */
+ String returnValue = ""; //$NON-NLS-1$
+
+ private CommentRichTextEditor richText;
+
+ /**
+ * Creates a new Comment editor dialog.
+ *
+ * @param parentShell
+ * the parent shell of this dialog
+ */
+ public CommentEditorDialog(Shell parentShell, Comment commentToEdit, String textToEdit) {
+ super(parentShell);
+ this.commentToEdit = commentToEdit;
+ this.textToEdit = textToEdit;
+ }
+
+ /**
+ * @{inheritDoc
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ // remove the OK button as default button, so Carriage Return key pressed does not close the dialog
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.HTMLCommentEditorDialogConfiguration_CommentDialogTitle);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * the parent composite to contain the dialog area
+ * @return the dialog area control
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite parentComposite = (Composite)super.createDialogArea(parent);
+
+ richText = CommentRichTextFormToolkit.createRichTextEditor(new FormToolkit(Display.getCurrent()), parent, textToEdit, commentToEdit, SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ return parentComposite;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog#getValue()
+ *
+ * @return
+ */
+ public String getValue() {
+ return returnValue;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ *
+ */
+
+ @Override
+ protected void okPressed() {
+ if(richText != null && !richText.isDisposed()) {
+ returnValue = richText.getText();
+ }
+ super.okPressed();
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration#postEditAction(java.lang.Object,
+ * java.lang.String)
+ *
+ * @param objectToEdit
+ * @param newText
+ * @return
+ */
+
+ @Override
+ public Object postEditAction(Object objectToEdit, String newText) {
+ if(objectToEdit instanceof Comment) {
+ ((Comment)objectToEdit).setBody(newText);
+ }
+ return objectToEdit;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/messages.properties b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/messages.properties
new file mode 100644
index 00000000000..67b94f0e311
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/messages.properties
@@ -0,0 +1,9 @@
+CommentedElementPropertySection_AddButtonTooltip=Add a comment to the current selected element
+CommentedElementPropertySection_AddCommentCommand=Set Comment Body
+CommentedElementPropertySection_CommentsViewerLabel=Comments
+CommentedElementPropertySection_DeleteButtonTooltip=Delete the selected comment to the current selected element.\n If the comment annotates another element, the current element is only removed from the list of annotated elements. Otherwise, it is destroy.
+CommentedElementPropertySection_DestroyUpdateComment_DialogTitle=Destroy or update the comment?
+CommentedElementPropertySection_DestroyUpdateComment_Message=The comment you want to destroy is annotating several elements ({0}).\nYou can choose between 2 behaviors:\n- You can destroy the comment. All annotated elements will lose this associated comment.\n- You can only remove the current element from the list of annotated element of the comment. Other elements will remain unchanged.\n\nDo you want to destroy the comment?
+CommentedElementPropertySection_DisplayButtonTooltip=Display the selected comment in the current diagram
+CommentedElementPropertySection_RemoveCommentCommand=Remove or Delete Comment
+HTMLCommentEditorDialogConfiguration_CommentDialogTitle=Edit Comment
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentContentProvider.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentContentProvider.java
new file mode 100644
index 00000000000..38255a3c02b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentContentProvider.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * @author RS211865
+ */
+public class CommentContentProvider implements IContentProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentFilter.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentFilter.java
new file mode 100644
index 00000000000..1678a177ab6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentFilter.java
@@ -0,0 +1,52 @@
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+/**
+ * Filter for the comment section
+ */
+public class CommentFilter implements IFilter {
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean select(Object toTest) {
+ EObject eObjectToTest = resolveSemanticObject(toTest);
+ return eObjectToTest != null && eObjectToTest.eClass() == UMLPackage.eINSTANCE.getComment();
+ }
+
+ /**
+ * Resolve semantic element
+ *
+ * @param object
+ * the object to resolve
+ * @return <code>null</code> or the semantic element associated to the specified object
+ */
+ private EObject resolveSemanticObject(Object object) {
+ if (object instanceof EObject) {
+ return (EObject) object;
+ } else if (object instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) object;
+ if (adaptable.getAdapter(EObject.class) != null) {
+ return (EObject) adaptable.getAdapter(EObject.class);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentPropertySection.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentPropertySection.java
new file mode 100644
index 00000000000..9a054c7c12f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentPropertySection.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.uml2.uml.Comment;
+
+/**
+ * Section with advanced editor for the {@link Comment} in Papyrus
+ */
+public class CommentPropertySection extends AbstractPropertySection {
+
+ /** advanced editor for the comments */
+ protected CommentRichTextEditor richText;
+
+ /** edited comment */
+ protected Comment comment;
+
+ /**
+ * Creates a new CommentPropertySection
+ */
+ public CommentPropertySection() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ richText = CommentRichTextFormToolkit.createFocusAwareRichTextEditor(getWidgetFactory(), parent, "", comment, SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ if(!(selection instanceof IStructuredSelection) || !((part instanceof IEditingDomainProvider) || part.getAdapter(IEditingDomainProvider.class) != null)) {
+ return;
+ }
+
+ Object firstElement = ((IStructuredSelection)selection).getFirstElement();
+ EObject newEObject = resolveSemanticObject(firstElement);
+
+ if(newEObject instanceof Comment) {
+ setComment((Comment)newEObject);
+ richText.init(comment, null);
+ richText.setText(comment.getBody());
+ }
+ }
+
+ /**
+ * Sets the comment to edit
+ *
+ * @param comment
+ * the comment to edit
+ */
+ protected void setComment(Comment comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * Returns the comment to edit
+ *
+ * @return the comment to edit
+ */
+ protected Comment getComment() {
+ return comment;
+ }
+
+ /**
+ * Resolve semantic element
+ *
+ * @param object
+ * the object to resolve
+ * @return <code>null</code> or the semantic element associated to the specified object
+ */
+ private EObject resolveSemanticObject(Object object) {
+ if(object instanceof EObject) {
+ return (EObject)object;
+ } else if(object instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable)object;
+ if(adaptable.getAdapter(EObject.class) != null) {
+ return (EObject)adaptable.getAdapter(EObject.class);
+ }
+ }
+ return null;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichText.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichText.java
new file mode 100644
index 00000000000..397fb892ed3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichText.java
@@ -0,0 +1,418 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2005, 2007 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 implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.epf.richtext.RichText;
+import org.eclipse.epf.richtext.RichTextListener;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.LocationAdapter;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.uml2.uml.Comment;
+
+/**
+ * A Method Editor Rich Text control.
+ *
+ * @author Kelvin Low
+ * @author Jeff Hardy
+ * @since 1.0
+ */
+public class CommentRichText extends RichText {
+
+ // The method element associated with this rich text control.
+ private Comment comment;
+
+ // The modal object associated with this rich text control.
+ private EObject modalObject;
+
+ // The modal object feature associated with this rich text control.
+ private EStructuralFeature modalObjectFeature;
+
+ // The resource being edited
+ protected Resource resource;
+
+ // the decoratedField label
+ protected Label label;
+
+ protected ControlDecoration controlDecoration;
+
+ protected final Image errorFieldDecorationImage = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
+
+ // Field name being edited
+ protected String fieldName = ""; //$NON-NLS-1$
+
+ // Field name being edited with the trailing : removed
+ protected String fieldNameTrim;
+
+ // marker helper
+ // protected MethodRichTextMarkerHelper markerHelper;
+
+ // // marker attribute
+ // private static String METHOD_FIELDNAME = "MethodFieldName";
+
+ // // marker ID
+ // protected static final String MARKER_ID = "org.eclipse.epf.authoring.ui.methodRichText"; //$NON-NLS-1$
+
+ /**
+ * Creates a new instance.
+ *
+ * @param parent
+ * The parent control.
+ * @param style
+ * The initial style for the editor.
+ * @param basePath
+ * The base path used for resolving hrefs.
+ */
+ public CommentRichText(Composite parent, int style, String basePath) {
+ super(parent, style, basePath);
+ }
+
+ /**
+ * Updates the presentation names of all element links.
+ *
+ * @param text
+ * Rich text encoded in HTML format.
+ */
+ @Override
+ protected String tidyText(String text) {
+ /*
+ * this will do the following to the HTML: 1. update Element Links 2. change <A ..> to <a
+ * ..> 3. change </A> to </a> 4. add double-quotes (") around all attribute values if they
+ * are missing
+ */
+
+ // return ResourceHelper.validateRichTextContent(comment, text, new
+ // RichTextContentValidator());
+ return text;
+ }
+
+ /**
+ * Adds listeners to manage the activation and focus events.
+ */
+ protected void addListeners() {
+ editorControl = getControlSite(editor);
+ if(editorControl != null) {
+ if(debug) {
+ printDebugMessage("init", "editorControl=" + editorControl.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // only IE (win32) has the editorControl != null
+ isIE = true;
+
+ editorControl.addListener(SWT.Activate, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(debug) {
+ printDebugMessage("activateListener"); //$NON-NLS-1$
+ }
+ // setFocus(); //NOTE (RS): this is removed because of the dialog flashing from the workbench to this dialog window
+ notifyListeners(SWT.Activate, event);
+ }
+ });
+
+ editorControl.addListener(SWT.Deactivate, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(debug) {
+ printDebugMessage("deactivateListener"); //$NON-NLS-1$
+ }
+ setBlur();
+ notifyListeners(SWT.Deactivate, event);
+ }
+ });
+
+ editorControl.addListener(SWT.FocusIn, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(debug) {
+ printDebugMessage("focusInListener"); //$NON-NLS-1$
+ }
+ executeCommand("updateSelection"); //$NON-NLS-1$
+ notifyListeners(SWT.FocusIn, event);
+ }
+ });
+
+ editorControl.addListener(SWT.KeyUp, new Listener() {
+
+ public void handleEvent(Event event) {
+ int keyCode = event.keyCode;
+ int stateMask = event.stateMask;
+ if(debug) {
+ printDebugMessage("keyUpListener", "keyCode=" + keyCode //$NON-NLS-1$ //$NON-NLS-2$
+ + ", stateMask=" + stateMask + ", editable=" + editable); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if((stateMask & SWT.CTRL) > 0 || (stateMask & SWT.ALT) > 0 || ((stateMask & SWT.SHIFT) > 0 && keyCode == stateMask)) {
+ return;
+ }
+ if(editable) {
+ switch(event.keyCode) {
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_LEFT:
+ case SWT.ARROW_RIGHT:
+ case SWT.ARROW_UP:
+ case SWT.END:
+ case SWT.HOME:
+ case SWT.PAGE_DOWN:
+ case SWT.PAGE_UP:
+ case SWT.TAB:
+ return;
+ default:
+ checkModify();
+ break;
+ }
+ }
+ }
+ });
+
+ editor.addLocationListener(new LocationAdapter() {
+
+ public void changing(LocationEvent event) {
+ // Deactivate the links in the content page in readonly
+ // mode.
+ event.doit = editable;
+ }
+ });
+ } else {
+ editor.addListener(SWT.Activate, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(debug) {
+ printDebugMessage("activateListener"); //$NON-NLS-1$
+ }
+ setFocus();
+ }
+ });
+
+ editor.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ if(e.keyCode == SWT.TAB) {
+ if((e.stateMask & SWT.SHIFT) != 0) {
+ editor.traverse(SWT.TRAVERSE_TAB_PREVIOUS);
+ } else {
+ editor.traverse(SWT.TRAVERSE_TAB_NEXT);
+ }
+ return;
+ }
+ if(!editable) {
+ e.doit = false;
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if((e.stateMask & SWT.CTRL) > 0 || (e.stateMask & SWT.ALT) > 0)
+ return;
+ if(editable) {
+ switch(e.keyCode) {
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_LEFT:
+ case SWT.ARROW_RIGHT:
+ case SWT.ARROW_UP:
+ case SWT.END:
+ case SWT.HOME:
+ case SWT.PAGE_DOWN:
+ case SWT.PAGE_UP:
+ case SWT.SHIFT:
+ case SWT.TAB:
+ break;
+ default:
+ checkModify();
+ break;
+ }
+ }
+ }
+ });
+ }
+
+ editor.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ if(debug) {
+ printDebugMessage("disposeListener"); //$NON-NLS-1$
+ }
+ dispose();
+ }
+ });
+
+ listeners = new Hashtable<Listener, RichTextListener>();
+ modifyListeners = new ArrayList<ModifyListener>();
+ }
+
+ /**
+ * Sets the method element associated with this rich text control.
+ *
+ * @param comment
+ */
+ public void setComment(Comment comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * Returns the method element associated with this rich text control.
+ */
+ public Comment getComment() {
+ return comment;
+ }
+
+ /**
+ * Returns the modal object associated with this rich text control.
+ */
+ public EObject getModalObject() {
+ return modalObject;
+ }
+
+ /**
+ * Sets the modal object associated with this rich text control.
+ */
+ public void setModalObject(EObject modalObject) {
+ this.modalObject = modalObject;
+ }
+
+ /**
+ * Returns modal object feature associated with this rich text control.
+ */
+ public EStructuralFeature getModalObjectFeature() {
+ return modalObjectFeature;
+ }
+
+ /**
+ * Sets the modal object feature associated with this rich text control.
+ */
+ public void setModalObjectFeature(EStructuralFeature modalObjectFeature) {
+ this.modalObjectFeature = modalObjectFeature;
+ }
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ public void setDecoratedFieldLabel(Label label) {
+ this.label = label;
+ if(label != null) {
+ // Object data = label.getData(BaseFormPage.LABEL_DECORATOR_KEY);
+ // if (data instanceof ControlDecoration) {
+ // controlDecoration = (ControlDecoration) data;
+ // controlDecoration.setImage(errorFieldDecorationImage);
+ // controlDecoration.hide();
+ // }
+ updateFieldNameFromLabel(label);
+ }
+ }
+
+ private boolean updateFieldNameFromLabel(Label label) {
+ if(label != null) {
+ String fieldName = label.getText();
+ if(!this.fieldName.equals(fieldName)) {
+ this.fieldName = fieldName;
+ int colonIndex = fieldName.indexOf(':');
+ if(colonIndex == -1)
+ colonIndex = fieldName.length();
+ this.fieldNameTrim = fieldName.substring(0, colonIndex).trim();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void init(Comment comment, Label label) {
+ setComment(comment);
+ setDecoratedFieldLabel(label);
+ // markerHelper = MethodRichTextMarkerHelper.INSTANCE;
+ }
+
+ @Override
+ protected String formatHTML(String text) {
+ String formattedText;
+ try {
+ // clear markers first
+ clearMarkers();
+ // Call JTidy to format the source to XHTML.
+ formattedText = htmlFormatter.formatHTML(text);
+ // if (htmlFormatter.getLastErrorStr() != null) {
+ // String errorString = htmlFormatter.getLastErrorStr();
+ // // create markers
+ // try {
+ // createMarker(errorString);
+ // } catch (CoreException cex) {
+ // logger.logError(cex);
+ // }
+ // }
+ return formattedText;
+ } catch (UnsupportedEncodingException e) {
+ logger.logError(e);
+ }
+ return text;
+ }
+
+ protected void clearMarkers() {
+ // markerHelper.deleteMarkers(contentDescription, fieldNameTrim);
+ setErrorDescription(""); //$NON-NLS-1$
+ hideErrorDecoration();
+ refreshDecorators();
+ }
+
+ protected void setErrorDescription(String text) {
+ if(controlDecoration != null) {
+ controlDecoration.setDescriptionText(text);
+ }
+ }
+
+ protected void refreshDecorators() {
+ // refresh
+ // PlatformUI.getWorkbench().getDecoratorManager().update(MethodElementLightweightLabelDecorator.DECORATOR_ID);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ clearMarkers();
+ refreshDecorators();
+ }
+
+ public void showErrorDecoration() {
+ if(controlDecoration != null) {
+ controlDecoration.show();
+ }
+ }
+
+ public void hideErrorDecoration() {
+ if(controlDecoration != null) {
+ controlDecoration.hide();
+ }
+ }
+
+ @Override
+ public void setText(String text) {
+ // check if label text was changed (this happens when RTE is expanded)
+ // this is called when RTE is toggled in editor - read new fieldName
+ if(updateFieldNameFromLabel(label))
+ hideErrorDecoration();
+ super.setText(text);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextEditor.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextEditor.java
new file mode 100644
index 00000000000..b019d96df26
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextEditor.java
@@ -0,0 +1,210 @@
+//------------------------------------------------------------------------------
+// Copyright (c) 2005, 2007 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 implementation
+//------------------------------------------------------------------------------
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.epf.richtext.IRichTextToolBar;
+import org.eclipse.epf.richtext.RichTextEditor;
+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.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;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.uml2.uml.Comment;
+
+/**
+ * A Rich Text editor with added extensions to support Method browsing and authoring. Includes a
+ * tool bar and an integrated HTML source editor.
+ *
+ * @author Kelvin Low
+ * @author Jeff Hardy
+ * @since 1.0
+ */
+public class CommentRichTextEditor extends RichTextEditor {
+
+ // The method element associated with this rich text control.
+ private Comment comment;
+
+ // The modal object associated with this rich text control.
+ private EObject modalObject;
+
+ // The modal object feature associated with this rich text control.
+ private EStructuralFeature modalObjectFeature;
+
+ protected FormToolkit toolkit;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param parent
+ * The parent control.
+ * @param style
+ * The initial style for the editor.
+ * @param basePath
+ * The base path used for resolving hrefs.
+ */
+ public CommentRichTextEditor(Composite parent, int style, String basePath, Comment comment, Label label, IEditorSite editorSite) {
+ super(parent, style, editorSite, basePath);
+ this.comment = comment;
+ init(comment, label);
+ }
+
+ /**
+ * Creates the underlying rich text control.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style for this control.
+ * @param basePath
+ * The path used for resolving links.
+ */
+ protected IRichText createRichTextControl(Composite parent, int style, String basePath) {
+ CommentRichText commentRichText = new CommentRichText(parent, style, basePath);
+ org.eclipse.swt.layout.GridData gridData = new org.eclipse.swt.layout.GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = SWT.DEFAULT;
+ gridData.heightHint = 200;
+ commentRichText.setLayoutData(gridData);
+ return commentRichText;
+ }
+
+ /**
+ * @{inheritDoc
+ */
+ @Override
+ protected void createUndoRedoActions() {
+ // removes these actions, as they are already provided by the editor site
+ }
+
+ /**
+ * @{inheritDoc
+ */
+ @Override
+ protected void createActions() {
+ // removes these actions, as they are already provided by the editor site
+ }
+
+
+
+ /**
+ * Fills the Rich Text editor tool bar with action items.
+ *
+ * @param toolBar
+ * The Rich text editor tool bar.
+ */
+ public void fillToolBar(IRichTextToolBar toolBar) {
+ toolBar.addAction(new FontStyleAction(this));
+ toolBar.addAction(new FontNameAction(this));
+ toolBar.addAction(new FontSizeAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new CutAction(this));
+ toolBar.addAction(new CopyAction(this));
+ toolBar.addAction(new PasteAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new ClearContentAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new BoldAction(this));
+ toolBar.addAction(new ItalicAction(this));
+ toolBar.addAction(new UnderlineAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new SubscriptAction(this));
+ toolBar.addAction(new SuperscriptAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new TidyActionGroup(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new AddOrderedListAction(this));
+ toolBar.addAction(new AddUnorderedListAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new OutdentAction(this));
+ toolBar.addAction(new IndentAction(this));
+ toolBar.addSeparator();
+ toolBar.addAction(new FindReplaceAction(this) {
+
+ @Override
+ public void execute(IRichText richText) {
+ richText.getFindReplaceAction().execute(richText);
+ }
+ });
+ toolBar.addSeparator();
+ // toolBar.addAction(new MethodAddLinkAction(this));
+ // toolBar.addAction(new MethodAddImageAction(this));
+ toolBar.addAction(new AddTableAction(this));
+ }
+
+ /**
+ * Returns the comment associated with this rich text control.
+ */
+ public Comment getComment() {
+ return comment;
+ }
+
+ /**
+ * Returns the modal object associated with this rich text control.
+ */
+ public EObject getModalObject() {
+ return modalObject;
+ }
+
+ /**
+ * Sets the modal object associated with this rich text control.
+ */
+ public void setModalObject(EObject modalObject) {
+ this.modalObject = modalObject;
+ }
+
+ /**
+ * Returns modal object feature associated with this rich text control.
+ */
+ public EStructuralFeature getModalObjectFeature() {
+ return modalObjectFeature;
+ }
+
+ /**
+ * Sets the modal object feature associated with this rich text control.
+ */
+ public void setModalObjectFeature(EStructuralFeature modalObjectFeature) {
+ this.modalObjectFeature = modalObjectFeature;
+ }
+
+ public void init(Comment comment, Label label) {
+ if(richText instanceof CommentRichText)
+ ((CommentRichText)richText).init(comment, label);
+ }
+
+ /**
+ * Returns the rich text control embedded within this editor.
+ */
+ public FocusAwareCommentRichText getRichTextControl() {
+ return (FocusAwareCommentRichText)richText;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextFormToolkit.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextFormToolkit.java
new file mode 100644
index 00000000000..77b883cfa7a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextFormToolkit.java
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+//------------------------------------------------------------------------------
+//Copyright (c) 2005, 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 implementation
+//------------------------------------------------------------------------------
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.uml2.uml.Comment;
+
+/**
+ * A helper toolkit for creating a rich text control and editor that can be added to an Eclipse
+ * form.
+ *
+ * @author Kelvin Low
+ * @since 1.0
+ */
+public class CommentRichTextFormToolkit {
+
+ // /**
+ // * Creates a rich text control and adapts it to be used in a form.
+ // *
+ // * @param toolkit
+ // * the form toolkit
+ // * @param parent
+ // * the parent control
+ // * @param text
+ // * the initial text for the viewer
+ // * @param style
+ // * the initial style for the viewer
+ // * @param basePath
+ // * the base path used for resolving hrefs
+ // * @return a new <code>IRichText</code> instance
+ // */
+ // public static CommentRichText createRichText(FormToolkit toolkit, Composite parent, String text, int style) {
+ // CommentRichText richText = new CommentRichText(parent, toolkit.getBorderStyle() | style
+ // | toolkit.getOrientation(), null);
+ // richText.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
+ // if (text != null) {
+ // richText.setText(text);
+ // }
+ // return richText;
+ // }
+
+ /**
+ * Creates a rich text editor and adapts it to be used in a form.
+ *
+ * @param toolkit
+ * the form toolkit
+ * @param parent
+ * the parent control
+ * @param text
+ * the initial text for the viewer
+ * @param style
+ * the initial style for the viewer
+ * @param basePath
+ * the base path used for resolving hrefs
+ * @return a new <code>IRichText</code> instance
+ */
+ public static CommentRichTextEditor createRichTextEditor(FormToolkit toolkit, Composite parent, String text, Comment comment, int style, IEditorSite editorSite) {
+ CommentRichTextEditor richTextEditor = new CommentRichTextEditor(parent, toolkit.getBorderStyle() | style | toolkit.getOrientation(), null, comment, null, editorSite);
+ // richTextEditor.getControl().setData(FormToolkit.KEY_DRAW_BORDER,
+ // FormToolkit.TREE_BORDER);
+ if(text != null) {
+ richTextEditor.setInitialText(text);
+ }
+ return richTextEditor;
+ }
+
+ /**
+ * Creates a rich text editor and adapts it to be used in a form.
+ *
+ * @param toolkit
+ * the form toolkit
+ * @param parent
+ * the parent control
+ * @param text
+ * the initial text for the viewer
+ * @param style
+ * the initial style for the viewer
+ * @param basePath
+ * the base path used for resolving hrefs
+ * @return a new <code>IRichText</code> instance
+ */
+ public static CommentRichTextEditor createFocusAwareRichTextEditor(FormToolkit toolkit, Composite parent, String text, Comment comment, int style, IEditorSite editorSite) {
+ CommentRichTextEditor richTextEditor = new FocusAwareCommentRichTextEditor(parent, toolkit.getBorderStyle() | style | toolkit.getOrientation(), null, comment, null, editorSite);
+ // richTextEditor.getControl().setData(FormToolkit.KEY_DRAW_BORDER,
+ // FormToolkit.TREE_BORDER);
+ if(text != null) {
+ richTextEditor.setInitialText(text);
+ }
+ return richTextEditor;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
new file mode 100644
index 00000000000..cfa166b103c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
@@ -0,0 +1,789 @@
+/*****************************************************************************
+ * Copyright (c) 2009 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantService;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
+import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
+import org.eclipse.papyrus.uml.diagram.common.parser.HTMLCleaner;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+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.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.uml2.common.util.UML2Util;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Section with advanced editor for the {@link Comment} in Papyrus
+ */
+public class CommentedElementPropertySection extends AbstractPropertySection implements IFilter {
+
+ /** advanced editor for the comments */
+ protected CommentRichTextEditor richText;
+
+ /** edited element */
+ protected Element element;
+
+ /** edited comment */
+ protected Comment comment;
+
+ /** Table viewer for comment */
+ protected TableViewer viewer;
+
+ /** selection change listener on the comment viewer */
+ protected ISelectionChangedListener viewerListener = new SelectionChangeListener();
+
+ /** icon path for the display button */
+ public final static String DISPLAY_ICON = "/icons/ConsoleView.gif"; //$NON-NLS-1$
+
+ /** Remove comment button */
+ protected Button removeCommentButton;
+
+ /** Display comment button */
+ protected Button displayCommentButton;
+
+ /**
+ *
+ */
+ public CommentedElementPropertySection() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ // create a main composite for this section
+ Composite mainComposite = getWidgetFactory().createComposite(parent);
+ mainComposite.setLayout(new GridLayout(2, false));
+
+ // create a composite for the comment viewer (label + buttons + viewer itself)
+ Composite tableComposite = getWidgetFactory().createComposite(mainComposite);
+ GridData data = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1);
+ tableComposite.setLayoutData(data);
+ GridLayout layout = new GridLayout(4, false);
+ tableComposite.setLayout(layout);
+
+ // label for the comments viewer
+ Label commentViewerLabel = getWidgetFactory().createLabel(tableComposite, Messages.CommentedElementPropertySection_CommentsViewerLabel);
+ data = new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1);
+ data.horizontalIndent = 3; // put some space on the left of the label
+ commentViewerLabel.setLayoutData(data);
+
+ // button to add a comment to the current edited element
+ Button addCommentButton = getWidgetFactory().createButton(tableComposite, "", SWT.NONE); //$NON-NLS-1$
+ addCommentButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ADD));
+ addCommentButton.setToolTipText(Messages.CommentedElementPropertySection_AddButtonTooltip);
+ addCommentButton.addMouseListener(new AddCommentButtonMouseListener());
+
+ // button to remove a comment from the current edited element
+ removeCommentButton = getWidgetFactory().createButton(tableComposite, "", SWT.NONE); //$NON-NLS-1$
+ removeCommentButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE));
+ removeCommentButton.setToolTipText(Messages.CommentedElementPropertySection_DeleteButtonTooltip);
+ removeCommentButton.addMouseListener(new RemoveCommentButtonMouseListener());
+
+ // button to display a comment in the current diagram
+ displayCommentButton = getWidgetFactory().createButton(tableComposite, "", SWT.NONE); //$NON-NLS-1$
+ displayCommentButton.setImage(org.eclipse.papyrus.uml.diagram.common.Activator.getPluginIconImage(org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator.PLUGIN_ID, DISPLAY_ICON));
+ displayCommentButton.setToolTipText(Messages.CommentedElementPropertySection_DisplayButtonTooltip);
+ displayCommentButton.addMouseListener(new DisplayCommentButtonMouseListener());
+
+ // creates a table where every comment attached to the current selected element is displayed
+ // and selectable
+ Table table = getWidgetFactory().createTable(tableComposite, SWT.BORDER);
+ data = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
+ data.minimumHeight = 210;
+ data.minimumWidth = 200;
+ table.setLayoutData(data);
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new CommentContentProvider());
+ CommentLabelProvider labelProvider = new CommentLabelProvider(org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getItemProvidersAdapterFactory());
+ labelProvider.setFireLabelUpdateNotifications(true);
+ viewer.setLabelProvider(labelProvider);
+
+ // listen for the viewer selection to update the rich editor content
+ viewer.addSelectionChangedListener(viewerListener);
+
+ // creates the rich text editor content
+ richText = CommentRichTextFormToolkit.createFocusAwareRichTextEditor(getWidgetFactory(), mainComposite, "", comment, //$NON-NLS-1$
+ SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ data = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
+ data.heightHint = 240;
+ richText.setLayoutData(data);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ if(!(selection instanceof IStructuredSelection) || !((part instanceof IEditingDomainProvider) || part.getAdapter(IEditingDomainProvider.class) != null)) {
+ return;
+ }
+
+ Object firstElement = ((IStructuredSelection)selection).getFirstElement();
+ EObject newEObject = resolveSemanticObject(firstElement);
+
+ // check an uml element is selected
+ if(newEObject instanceof Element) {
+ setElement((Element)newEObject);
+ viewer.setInput(newEObject);
+
+ // select first comment by default
+ Object firstComment = viewer.getElementAt(0);
+ if(firstComment != null) {
+ viewer.setSelection(new StructuredSelection(firstComment), true);
+ } else {
+ richText.setEditable(false);
+ }
+ }
+
+ // enables the display button ?
+ if(displayCommentButton != null && !displayCommentButton.isDisposed()) {
+ if(firstElement instanceof GraphicalEditPart) {
+ displayCommentButton.setEnabled(true);
+ } else {
+ displayCommentButton.setEnabled(false);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ // remove viewer listener on dispose
+ if(viewer != null && viewerListener != null) {
+ viewer.removeSelectionChangedListener(viewerListener);
+ }
+ super.dispose();
+ }
+
+ /**
+ * Returns the element to edit
+ *
+ * @return the element to edit
+ */
+ public Element getElement() {
+ return element;
+ }
+
+ /**
+ * Sets the element to edit
+ *
+ * @param element
+ * the element to set
+ */
+ public void setElement(Element element) {
+ this.element = element;
+ }
+
+ /**
+ * Sets the comment to edit
+ *
+ * @param comment
+ * the comment to edit
+ */
+ protected void setComment(Comment comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * Returns the comment to edit
+ *
+ * @return the comment to edit
+ */
+ protected Comment getComment() {
+ return comment;
+ }
+
+ /**
+ * Resolve semantic element
+ *
+ * @param object
+ * the object to resolve
+ * @return <code>null</code> or the semantic element associated to the specified object
+ */
+ private EObject resolveSemanticObject(Object object) {
+ if(object instanceof EObject) {
+ return (EObject)object;
+ } else if(object instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable)object;
+ if(adaptable.getAdapter(EObject.class) != null) {
+ return (EObject)adaptable.getAdapter(EObject.class);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean select(Object toTest) {
+ EObject eObjectToTest = resolveSemanticObject(toTest);
+ return eObjectToTest instanceof Element;
+ }
+
+ /**
+ * Content provider for the comment viewer
+ */
+ public class CommentContentProvider implements IStructuredContentProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof Element) {
+ Set<Comment> annotatedElements = new HashSet<Comment>();
+ Iterator<Setting> it = UML2Util.getNonNavigableInverseReferences((Element)inputElement).iterator();
+ while(it.hasNext()) {
+ Setting setting = it.next();
+ if(setting.getEStructuralFeature() == UMLPackage.Literals.COMMENT__ANNOTATED_ELEMENT) {
+ if(setting.getEObject() instanceof Comment) {
+ Comment comment = (Comment)setting.getEObject();
+
+ // small bugfix...
+ // UML2Util.getNonNavigableInverseReferences returns more element than
+ // needed, especially elements that are not real ones
+ // so we must check if they are contained by the current resource or
+ // not...
+ boolean isProxy = false;
+ for(Element annotatedElement : comment.getAnnotatedElements()) {
+ if(annotatedElement.eResource() == null) {
+ isProxy = true;
+ }
+ }
+
+ // this is the real element, not a ghost one. display it in the list
+ if(!isProxy) {
+ if(comment.getAnnotatedElements().contains(inputElement)) {
+ annotatedElements.add(comment);
+ }
+ }
+
+ }
+ }
+
+ }
+ return annotatedElements.toArray();
+ }
+ return new Object[0];
+ }
+ }
+
+ /**
+ * Content provider for the comment viewer
+ */
+ public class CommentLabelProvider extends AdapterFactoryLabelProvider {
+
+ public CommentLabelProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /** max number of char in the label */
+ private static final int MAX_SIZE = 25;
+
+ /** string for cutted label */
+ private static final String CUT_STRING = "..."; //$NON-NLS-1$
+
+ /** cut string length */
+ private final int CUT_STRING_LENGTH = CUT_STRING.length();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getColumnText(Object object, int columnIndex) {
+ return getText(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText(Object element) {
+ if(element instanceof Comment) {
+ String body = ((Comment)element).getBody();
+ if(body == null) {
+ return ""; //$NON-NLS-1$
+ } else {
+ body = HTMLCleaner.cleanHTMLTags(body);
+ if(body.length() <= MAX_SIZE) {
+ return body;
+ } else {
+ return body.substring(0, MAX_SIZE - CUT_STRING_LENGTH) + CUT_STRING;
+ }
+ }
+ }
+ // return element.toString();
+ return "<NotAComment>"; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * selection change listener for the comment viewer
+ */
+ protected class SelectionChangeListener implements ISelectionChangedListener {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ Comment element = (Comment)selection.getFirstElement();
+ if(richText == null) {
+ return;
+ }
+ // should save old comment edition if required...
+ richText.getRichTextControl().saveCommentBody();
+
+ // no checks here, perhaps some should be done
+ setComment(element);
+ richText.init(element, null);
+ if(element != null) {
+ richText.setEditable(true);
+ if(removeCommentButton != null) {
+ removeCommentButton.setEnabled(true);
+ }
+ richText.setText(element.getBody());
+ } else {
+ // in case no element is selected, remove the text in the editor
+ richText.setEditable(false);
+ removeCommentButton.setEnabled(false);
+ richText.setText("");//$NON-NLS-1$
+ }
+
+ }
+ }
+
+ /**
+ * Action on the add Comment button
+ */
+ protected class AddCommentButtonMouseListener implements MouseListener {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ // get the selected element
+ final Element element = getElement();
+
+ // add a comment to this element
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ // open transaction to save the comment body
+ // retrieve editing domain
+ if(domain != null) {
+ RecordingCommand command = new RecordingCommand(domain, Messages.CommentedElementPropertySection_AddCommentCommand) {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ Comment newComment = element.createOwnedComment();
+ newComment.getAnnotatedElements().add(element);
+ newComment.setBody(""); //$NON-NLS-1$
+
+ if(viewer != null && richText != null) {
+ viewer.refresh(true);
+ viewer.setSelection(new StructuredSelection(newComment), true);
+ richText.setFocus();
+ }
+ }
+
+ };
+ domain.getCommandStack().execute(command);
+ } else {
+ Activator.log.error("Impossible to find current editing domain", null); //$NON-NLS-1$
+ }
+ }
+
+ }
+
+ /**
+ * Action on the add Comment button
+ */
+ protected class RemoveCommentButtonMouseListener implements MouseListener {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseUp(MouseEvent e) {
+ // get the selected element
+ final Element element = getElement();
+
+ // get the selected comment
+ final Comment comment = getComment();
+
+ if(element == null || comment == null) {
+ Activator.log.error("Element or comment is null", null); //$NON-NLS-1$
+ return;
+ }
+
+ // add a comment to this element
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+ // open transaction to save the comment body
+ // retrieve editing domain
+ if(domain != null) {
+ // 1. check annotated elements
+ List<Element> annotatedElements = comment.getAnnotatedElements();
+ boolean hasOtherAnnotatedElement = (annotatedElements.size() > 1);
+
+ // 2. if there are more than one annotated element, ask for destruction of
+ // the comment or only the removal of the element in the annotated element
+ // list
+ boolean destroy = true;
+ if(hasOtherAnnotatedElement) {
+ destroy = MessageDialog.openQuestion(getPart().getSite().getShell(), Messages.CommentedElementPropertySection_DestroyUpdateComment_DialogTitle, Messages.bind(Messages.CommentedElementPropertySection_DestroyUpdateComment_Message, prettyPrint(comment.getAnnotatedElements())));
+ }
+
+ try {
+ if(destroy) {
+ DestroyElementCommand command = new DestroyElementCommand(new DestroyElementRequest(getComment(), true));
+ if(command != null && command.canExecute()) {
+ command.execute(new NullProgressMonitor(), null);
+ } else {
+ Activator.log.error("Impossible to execute the delete command for the comment", null);
+ }
+ } else {
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(domain, "Remove element from annotated element comment list", null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ comment.getAnnotatedElements().remove(element);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ if(command != null && command.canExecute()) {
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+ } else {
+ Activator.log.error("Impossible to modify the annotated element list for the comment", null);
+ }
+ }
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+
+ if(viewer != null && richText != null) {
+ viewer.refresh(true);
+ Object firstElement = viewer.getElementAt(0);
+ if(firstElement != null) {
+ viewer.setSelection(new StructuredSelection(firstElement), true);
+ }
+ richText.setFocus();
+ }
+ }
+
+ }
+
+ /**
+ * Pretty print the list of annotated element for the message dialog
+ *
+ * @param annotatedElements
+ * the list of annotated elements
+ * @return the string corresponding to the list of annotated elements
+ */
+ protected String prettyPrint(EList<Element> annotatedElements) {
+ StringBuffer buffer = new StringBuffer();
+ Iterator<Element> it = annotatedElements.iterator();
+ while(it.hasNext()) {
+ Element element = it.next();
+ if(element instanceof NamedElement) {
+ buffer.append(((NamedElement)element).getLabel());
+ } else {
+ buffer.append(element.toString());
+ }
+ if(it.hasNext()) {
+ buffer.append(", ");
+ }
+ }
+
+ return buffer.toString();
+ }
+ }
+
+
+
+ /**
+ * Action on the add Comment button
+ */
+ protected class DisplayCommentButtonMouseListener implements MouseListener {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDoubleClick(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void mouseDown(MouseEvent e) {
+ // nothing to do
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = getSelection();
+ if(!(selection instanceof IStructuredSelection)) {
+ return;
+ }
+ Object selectedObject = null;
+ if(((IStructuredSelection)selection).getFirstElement() instanceof EditPart) {
+ selectedObject = ((IStructuredSelection)selection).getFirstElement();
+ }
+
+ if(selectedObject instanceof GraphicalEditPart) {
+ GraphicalEditPart selectionEditPart = (GraphicalEditPart)selectedObject;
+ IAdaptable elementAdapter = new EObjectAdapter(getComment());
+ ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, null, ViewUtil.APPEND, false, selectionEditPart.getDiagramPreferencesHint());
+ CreateViewRequest request = new CreateViewRequest(descriptor);
+
+ Command createCommand = null;
+ GraphicalEditPart parent = getParent(selectionEditPart);
+ while(createCommand == null && parent != null) {
+ Command command = parent.getCommand(request);
+ if(command.canExecute()) {
+ createCommand = command;
+ } else {
+ command.dispose();
+ }
+ // retrieve parent of the current edit part
+ parent = getParent(parent);
+ }
+
+ IAdaptable sourceAdapter = (IAdaptable)((List)request.getNewObject()).get(0);
+ IAdaptable targetAdapter = new SemanticAdapter(null, selectionEditPart.getModel());
+
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(domain, selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
+ CompositeCommand compoundCommand = new CompositeCommand("Display Comment with link");
+ compoundCommand.compose(new CommandProxy(createCommand));
+ compoundCommand.compose(linkVisualIDCommand);
+
+ try {
+ compoundCommand.execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e1) {
+ Activator.log.error(e1);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Returns the first valid parent edit part where to display the comment
+ *
+ * @param selectionEditPart
+ * the edit part to comment
+ * @return the first valid parent edit part where to display the comment or <code>null</code>
+ */
+ protected GraphicalEditPart getParent(EditPart editPart) {
+ EditPart parentEditPart = editPart.getParent();
+ if(parentEditPart == null) {
+ return null;
+ } else if(parentEditPart instanceof GraphicalEditPart) {
+ return ((GraphicalEditPart)parentEditPart);
+ } else {
+ return getParent(parentEditPart);
+ }
+ }
+
+ protected class CreateCommentLinkTransactionnalCommand extends AbstractTransactionalCommand {
+
+ /** edit part viewer */
+ private EditPartViewer viewer;
+
+ /** IAdaptable from which to retrieve availalbe links */
+ private IAdaptable sourceViewAdapter;
+
+ /** IAdaptable to the target commented element */
+ private IAdaptable targetViewAdapter;
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * transactionnal editing domain on which the operation is run
+ */
+ public CreateCommentLinkTransactionnalCommand(TransactionalEditingDomain domain, EditPartViewer viewer, IAdaptable sourceViewAdapter, IAdaptable targetViewAdapter) {
+ super(domain, "Retrieve Comment Link visual ID", null);
+ this.viewer = viewer;
+ this.sourceViewAdapter = sourceViewAdapter;
+ this.targetViewAdapter = targetViewAdapter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Map epRegistry = viewer.getEditPartRegistry();
+ IGraphicalEditPart sourceEP = (IGraphicalEditPart)epRegistry.get(sourceViewAdapter.getAdapter(View.class));
+
+ // perhaps it could be more simple => directly pass the edit part in parameter ?
+ List<IElementType> types = ModelingAssistantService.getInstance().getRelTypesOnSource(sourceEP);
+ for(IElementType type : types) {
+ if(!"org.eclipse.gmf.runtime.diagram.ui.presentation.noteAttachment".equals(type.getId())) {
+ ConnectionViewDescriptor viewDescriptor = new ConnectionViewDescriptor(type, ((IHintedType)type).getSemanticHint(), sourceEP.getDiagramPreferencesHint());
+
+ CommonDeferredCreateConnectionViewCommand binaryCommand = new CommonDeferredCreateConnectionViewCommand(EditorUtils.getTransactionalEditingDomain(), ((IHintedType)type).getSemanticHint(), sourceViewAdapter, targetViewAdapter, viewer, sourceEP.getDiagramPreferencesHint(), viewDescriptor, null);
+ if(binaryCommand != null && binaryCommand.canExecute()) {
+ binaryCommand.execute(new NullProgressMonitor(), null);
+ }
+ }
+ }
+
+ return CommandResult.newOKCommandResult();
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
new file mode 100644
index 00000000000..2f2cc57e139
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+
+/**
+ * Comment rich text that listens for focus lost events to save the content of the comment.
+ */
+public class FocusAwareCommentRichText extends CommentRichText {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * @param style
+ * @param basePath
+ */
+ public FocusAwareCommentRichText(Composite parent, int style, String basePath) {
+ super(parent, style, basePath);
+ }
+
+ /**
+ * Adds listeners to manage the activation and focus events.
+ */
+ @Override
+ protected void addListeners() {
+ editorControl = getControlSite(editor);
+
+ editorControl.addListener(SWT.FocusOut, new Listener() {
+
+ public void handleEvent(Event event) {
+ if(debug) {
+ printDebugMessage("focusOutListener"); //$NON-NLS-1$
+ }
+ focusLostAction(event);
+ notifyListeners(SWT.FocusOut, event);
+ }
+
+ });
+
+ super.addListeners();
+ }
+
+ /**
+ * Action to take when the focus is lost
+ *
+ * @param event
+ * the focus lost event
+ */
+ protected void focusLostAction(Event event) {
+ saveCommentBody();
+ }
+
+ /**
+ * Saves the body of the current comment
+ */
+ public void saveCommentBody() {
+ if(getComment() != null) {
+
+ // check save must be done (comment is perhaps not modified)
+ if(getText().equals(getComment().getBody())) {
+ // do not save
+ return;
+ }
+
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(getComment());
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ // open transaction to save the comment body
+ // retrieve editing domain
+ if(domain != null) {
+ RecordingCommand command = new RecordingCommand(domain, "Set Comment Body") {
+
+ @Override
+ protected void doExecute() {
+ getComment().setBody(getText());
+
+ }
+
+ };
+ domain.getCommandStack().execute(command);
+ } else {
+ Activator.log.error("impossible to find the editing domain", null);
+ }
+
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichTextEditor.java b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichTextEditor.java
new file mode 100644
index 00000000000..ef251c53c07
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichTextEditor.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection;
+
+import org.eclipse.epf.richtext.IRichText;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.uml2.uml.Comment;
+
+
+/**
+ *
+ */
+public class FocusAwareCommentRichTextEditor extends CommentRichTextEditor {
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * @param style
+ * @param basePath
+ * @param comment
+ * @param label
+ * @param editorSite
+ */
+ public FocusAwareCommentRichTextEditor(Composite parent, int style, String basePath, Comment comment, Label label, IEditorSite editorSite) {
+ super(parent, style, basePath, comment, label, editorSite);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection.CommentRichTextEditor#createRichTextControl(org.eclipse.swt.widgets.Composite,
+ * int, java.lang.String)
+ *
+ * @param parent
+ * @param style
+ * @param basePath
+ * @return
+ */
+
+ @Override
+ protected IRichText createRichTextControl(Composite parent, int style, String basePath) {
+ FocusAwareCommentRichText commentRichText = new FocusAwareCommentRichText(parent, style, basePath);
+ org.eclipse.swt.layout.GridData gridData = new org.eclipse.swt.layout.GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = SWT.DEFAULT;
+ gridData.heightHint = 200;
+ commentRichText.setLayoutData(gridData);
+ return commentRichText;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/.project b/deprecated/org.eclipse.papyrus.views.documentation.feature/.project
new file mode 100644
index 00000000000..70a8a2ad781
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.views.documentation.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/build.properties b/deprecated/org.eclipse.papyrus.views.documentation.feature/build.properties
new file mode 100644
index 00000000000..128baaa4d3b
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ epl-v10.html,\
+ license.html,\
+ feature.properties
+src.includes = epl-v10.html,\
+ license.html
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/epl-v10.html b/deprecated/org.eclipse.papyrus.views.documentation.feature/epl-v10.html
new file mode 100644
index 00000000000..cb1073a4bad
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/epl-v10.html
@@ -0,0 +1,304 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ }
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+
+ }
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang="EN-US" style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor (&quot;Commercial
+Contributor&quot;) hereby agrees to defend and indemnify every other
+Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
+costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal></p>
+
+</div>
+
+</body>
+
+</html> \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.properties b/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.properties
new file mode 100644
index 00000000000..81b829b1bf0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.properties
@@ -0,0 +1,139 @@
+# NLS_MESSAGEFORMAT_VAR
+
+# "featureName" property - name of the feature
+featureName=Papyrus Documentation View (Incubation)
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse Modeling Project
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.xml b/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.xml
new file mode 100644
index 00000000000..24d7532c02f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/feature.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><feature id="org.eclipse.papyrus.views.documentation.feature" label="%featureName" provider-name="%providerName" version="0.10.1.qualifier">
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2012 CEA LIST.
+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
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.views.documentation" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.views.documentation.view" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.views.documentation.view.papyrus" install-size="0" unpack="false" version="0.0.0"/>
+
+</feature> \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.feature/license.html b/deprecated/org.eclipse.papyrus.views.documentation.feature/license.html
new file mode 100644
index 00000000000..f19c483b9c8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.feature/license.html
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!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>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation 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 provided with this Content and is also 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>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.classpath b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.classpath
new file mode 100644
index 00000000000..9d5026e8ffd
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.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/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.project b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.project
new file mode 100644
index 00000000000..72e3c5a4396
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.views.documentation.view.papyrus</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/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d1fc8939f21
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.views.documentation.view;bundle-version="0.10.1",
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.1",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1"
+Bundle-Vendor: %providerName
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.views.documentation.view.papy
+ rus;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/about.html b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/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/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/build.properties b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/build.properties
new file mode 100644
index 00000000000..972de33ac51
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:51 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,about.html,plugin.properties
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.properties b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.properties
new file mode 100644
index 00000000000..ef2d995ea65
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/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=Papyrus integration of the documentation view (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.xml b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.xml
new file mode 100644
index 00000000000..0afe5f04af8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.views.documentation.view.documentationPartHandler">
+ <documentationPartHandler
+ documentationPartHandler="org.eclipse.papyrus.views.documentation.view.papyrus.PapyrusDocumentationPartHandler">
+ </documentationPartHandler>
+ </extension>
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
new file mode 100644
index 00000000000..c2a60bf0cb7
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/PapyrusDocumentationPartHandler.java
@@ -0,0 +1,201 @@
+/*****************************************************************************
+ * 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.views.documentation.view.papyrus;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.DiagramsUtil;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.views.documentation.DocumentationManager;
+import org.eclipse.papyrus.views.documentation.IDocumentationManager;
+import org.eclipse.papyrus.views.documentation.view.IDocumentationPartHandler;
+import org.eclipse.papyrus.views.documentation.view.SelectResourceDialog;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+
+public class PapyrusDocumentationPartHandler implements IDocumentationPartHandler {
+
+ public boolean canHandlePart(IWorkbenchPart part) {
+ return part instanceof CoreMultiDiagramEditor || part instanceof ModelExplorerPageBookView;
+ }
+
+ public IDocumentationManager getDocumentationManager() {
+ return DocumentationManager.getInstance();
+ }
+
+ public void executeCommand(IWorkbenchPart part, Command cmd) {
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null && cmd != null) {
+ try {
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ domain.getCommandStack().execute(cmd);
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.err);
+ }
+ }
+ }
+
+ public EObject getAssociatedDiagram(IWorkbenchPart part, EObject eObject) {
+ if(eObject instanceof Diagram) {
+ return null;
+ }
+
+ if(eObject != null) {
+ if(part instanceof IDiagramWorkbenchPart) {
+ Diagram currentDiagram = ((IDiagramWorkbenchPart)part).getDiagram();
+ if(currentDiagram != null && eObject.equals(currentDiagram.getElement())) {
+ return currentDiagram;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void openElement(IWorkbenchPart part, URI elementUri) {
+ try {
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null) {
+ EditingDomain ed = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ if(ed != null) {
+ EObject eObject = ed.getResourceSet().getEObject(elementUri, false);
+ final Diagram diagram;
+ if(eObject instanceof Diagram) {
+ diagram = (Diagram)eObject;
+ } else {
+ List<Diagram> diagrams = DiagramsUtil.getAssociatedDiagrams(eObject, null);
+ if(diagrams.isEmpty()) {
+ return;
+ } else {
+ diagram = diagrams.get(0);
+ }
+ }
+
+ if(diagram != null) {
+ final IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(registry);
+ if(pageMngr != null) {
+ if(pageMngr.isOpen(diagram)) {
+ pageMngr.selectPage(diagram);
+ } else {
+ TransactionalEditingDomain editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Open diagram") {
+
+ @Override
+ public void doExecute() {
+ pageMngr.openPage(diagram);
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+
+ public EObject openElementSelectionDialog(IWorkbenchPart part) {
+ Object selectedElement = null;
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null) {
+ ISelectionStatusValidator validator = new ISelectionStatusValidator() {
+
+ public IStatus validate(Object[] selectedElements) {
+ boolean enableOK = false;
+ if(selectedElements.length == 1) {
+ Object selectedElement = selectedElements[0];
+ if(adapt(selectedElement) != null) {
+ enableOK = true;
+ }
+ }
+
+ String msg = "";
+ if(enableOK == false) {
+ msg = "Only one EObject can be selected";
+ }
+ return enableOK ? new Status(IStatus.OK, "org.eclipse.emf.common.ui", 0, msg, null) : new Status(IStatus.ERROR, "org.eclipse.emf.common.ui", 0, msg, null);
+ }
+ };
+
+ ILabelProvider labelProvider;
+ try {
+ labelProvider = registry.getService(LabelProviderService.class).getLabelProvider();
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.out);
+ labelProvider = new LabelProvider();
+ }
+
+ selectedElement = SelectResourceDialog.openElementSelection(registry, labelProvider, new MoDiscoContentProvider(), validator, null, true);
+ }
+ return adapt(selectedElement);
+ }
+
+ public boolean isReadOnly(IWorkbenchPart part, EObject eObject) {
+ ServicesRegistry registry = getServicesRegistry(part);
+ if(registry != null && eObject != null) {
+ try {
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
+ return domain.isReadOnly(eObject.eResource());
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.out);
+ }
+ }
+ return false;
+ }
+
+ private static EObject adapt(Object obj) {
+ if(obj instanceof EObject) {
+ return (EObject)obj;
+ } else if(obj instanceof IAdaptable) {
+ EObject adapted = (EObject)((IAdaptable)obj).getAdapter(EObject.class);
+ return adapted;
+ }
+ return null;
+ }
+
+ private static ServicesRegistry getServicesRegistry(IWorkbenchPart part) {
+ if(part instanceof IMultiDiagramEditor) {
+ return ((IMultiDiagramEditor)part).getServicesRegistry();
+ }
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(activeEditor instanceof IMultiDiagramEditor) {
+ return ((IMultiDiagramEditor)activeEditor).getServicesRegistry();
+ }
+ return null;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java
new file mode 100644
index 00000000000..01603c111ea
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view.papyrus/src/org/eclipse/papyrus/views/documentation/view/papyrus/TransactionalUncheckedCommandProxy.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * 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.views.documentation.view.papyrus;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.EditingDomainUndoContext;
+
+
+public class TransactionalUncheckedCommandProxy extends AbstractTransactionalCommand {
+
+ /** The wrapped command */
+ private Command command;
+
+ public TransactionalUncheckedCommandProxy(TransactionalEditingDomain editingDomain, Command command) {
+ super(editingDomain, (command.getLabel() == null) ? StringStatics.BLANK : command.getLabel(), null);
+ Assert.isNotNull(command);
+ this.command = command;
+ addContext(new EditingDomainUndoContext(editingDomain));
+ }
+
+ protected CommandResult doExecuteWithResult(
+ IProgressMonitor progressMonitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.execute();
+ return CommandResult.newOKCommandResult();
+ }
+
+ protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.undo();
+ setResult(CommandResult.newOKCommandResult());
+
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ command.redo();
+ setResult(CommandResult.newOKCommandResult());
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Returns the wrapped command.
+ *
+ * @return Command
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ public boolean canUndo() {
+ return command.canUndo();
+ }
+
+ public boolean canExecute() {
+ return command.canExecute();
+ }
+
+ public boolean canRedo() {
+ return canExecute() && canUndo();
+ }
+
+ public void dispose() {
+ super.dispose();
+ command.dispose();
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/.classpath b/deprecated/org.eclipse.papyrus.views.documentation.view/.classpath
new file mode 100644
index 00000000000..9d5026e8ffd
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/.project b/deprecated/org.eclipse.papyrus.views.documentation.view/.project
new file mode 100644
index 00000000000..60ba04a747c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.views.documentation.view/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d0e4df4f8fb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.views.documentation.view
+Require-Bundle: org.eclipse.core.expressions,
+ org.eclipse.ui.editors,
+ 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.views.documentation;bundle-version="0.10.1";visibility:=reexport
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.views.documentation.view.DocView
+ Plugin
+Bundle-SymbolicName: org.eclipse.papyrus.views.documentation.view;sing
+ leton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/about.html b/deprecated/org.eclipse.papyrus.views.documentation.view/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/build.properties b/deprecated/org.eclipse.papyrus.views.documentation.view/build.properties
new file mode 100644
index 00000000000..2ac5f5b4811
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableCol.png b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableCol.png
new file mode 100644
index 00000000000..2e154a377ab
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableCol.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableRow.png b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableRow.png
new file mode 100644
index 00000000000..54c69691ed3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/DeleteTableRow.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableCol.png b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableCol.png
new file mode 100644
index 00000000000..70f6ab94964
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableCol.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableRow.png b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableRow.png
new file mode 100644
index 00000000000..ff5925efd43
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/InsertTableRow.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextColor.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextColor.gif
new file mode 100644
index 00000000000..2a4cd71bdbf
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextColor.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextHighlight.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextHighlight.gif
new file mode 100644
index 00000000000..3669e712af8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/TextHighlight.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/application_link.png b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/application_link.png
new file mode 100644
index 00000000000..f3727d22e77
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/application_link.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/documentation.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/documentation.gif
new file mode 100644
index 00000000000..3d86636daa5
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/documentation.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/edit.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/edit.gif
new file mode 100644
index 00000000000..855dd5871db
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/edit.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/externalResource.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/externalResource.gif
new file mode 100644
index 00000000000..229c391c493
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/externalResource.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/icons/htmlEditor.gif b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/htmlEditor.gif
new file mode 100644
index 00000000000..adf2410fa60
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/icons/htmlEditor.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/plugin.properties b/deprecated/org.eclipse.papyrus.views.documentation.view/plugin.properties
new file mode 100644
index 00000000000..cb6416737c0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/plugin.xml b/deprecated/org.eclipse.papyrus.views.documentation.view/plugin.xml
new file mode 100644
index 00000000000..5c728118fe6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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.views.documentation.view.DocView"
+ icon="icons/documentation.gif"
+ id="org.eclipse.papyrus.views.documentation.view.DocView"
+ name="Documentation"
+ restorable="true">
+ </view>
+ </extension>
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation.view/schema/documentationPartHandler.exsd b/deprecated/org.eclipse.papyrus.views.documentation.view/schema/documentationPartHandler.exsd
new file mode 100644
index 00000000000..050760c7646
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.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.views.documentation.view" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ArrayTreeContentProvider.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ArrayTreeContentProvider.java
new file mode 100644
index 00000000000..4877d45cbd9
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/CommentsComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/CommentsComposite.java
new file mode 100644
index 00000000000..eaa10e597b0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPage.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPage.java
new file mode 100644
index 00000000000..fa5d38a77ae
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPageComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocPageComposite.java
new file mode 100644
index 00000000000..4fb410e209d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.documentation.view;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.views.documentation.DocumentationManager;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocView.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocView.java
new file mode 100644
index 00000000000..b03122974c8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocViewPlugin.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocViewPlugin.java
new file mode 100644
index 00000000000..9b6ee5de4f3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocumentionPartHandlerRegistry.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/DocumentionPartHandlerRegistry.java
new file mode 100644
index 00000000000..bd79f231916
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/EmptyDocPage.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/EmptyDocPage.java
new file mode 100644
index 00000000000..b289d35d24f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ExternalResourceEditorInput.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ExternalResourceEditorInput.java
new file mode 100644
index 00000000000..769d020e4fe
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocPage.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocPage.java
new file mode 100644
index 00000000000..69ac58a3606
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocumentationPartHandler.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocumentationPartHandler.java
new file mode 100644
index 00000000000..aa45a6c9c95
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IDocumentationPartHandler.java
@@ -0,0 +1,63 @@
+package org.eclipse.papyrus.views.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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IText.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/IText.java
new file mode 100644
index 00000000000..aa9a9dea5da
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/Messages.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/Messages.java
new file mode 100644
index 00000000000..bfa4e3d3147
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/Messages.java
@@ -0,0 +1,63 @@
+package org.eclipse.papyrus.views.documentation.view;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/PlainTextComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/PlainTextComposite.java
new file mode 100644
index 00000000000..e1df9ffdd12
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ResourcesComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/ResourcesComposite.java
new file mode 100644
index 00000000000..fc9160cc953
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.DocumentationUnsupportedException;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextComposite.java
new file mode 100644
index 00000000000..a02a9234c88
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextEditorDialog.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/RichTextEditorDialog.java
new file mode 100644
index 00000000000..270385be352
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.documentation.view;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.papyrus.views.documentation.view.actions.AddElementLinkAction;
+import org.eclipse.papyrus.views.documentation.view.actions.DeleteTableColumnAction;
+import org.eclipse.papyrus.views.documentation.view.actions.DeleteTableRowAction;
+import org.eclipse.papyrus.views.documentation.view.actions.InsertTableColumnAction;
+import org.eclipse.papyrus.views.documentation.view.actions.InsertTableRowAction;
+import org.eclipse.papyrus.views.documentation.view.actions.TextColorAction;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SelectResourceDialog.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SelectResourceDialog.java
new file mode 100644
index 00000000000..a36bcb9f90f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SpellingTextComposite.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/SpellingTextComposite.java
new file mode 100644
index 00000000000..ed0b4f008e3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TextViewerAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TextViewerAction.java
new file mode 100644
index 00000000000..905b1e62a5c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TypedResourcesSelectionDialog.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/TypedResourcesSelectionDialog.java
new file mode 100644
index 00000000000..80c2c5153d7
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/AddElementLinkAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/AddElementLinkAction.java
new file mode 100644
index 00000000000..e68a2b05590
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.documentation.view.DocumentionPartHandlerRegistry;
+import org.eclipse.papyrus.views.documentation.view.IDocumentationPartHandler;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/CommandConstants.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/CommandConstants.java
new file mode 100644
index 00000000000..1451d413fd1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/CommandConstants.java
@@ -0,0 +1,24 @@
+package org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableColumnAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableColumnAction.java
new file mode 100644
index 00000000000..be9516543c3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableRowAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/DeleteTableRowAction.java
new file mode 100644
index 00000000000..4b2a20289e8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableColumnAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableColumnAction.java
new file mode 100644
index 00000000000..f8ffc90bdc4
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableRowAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/InsertTableRowAction.java
new file mode 100644
index 00000000000..1dd505cedbb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/NumberValidator.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/NumberValidator.java
new file mode 100644
index 00000000000..fe2f46e989a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextColorAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextColorAction.java
new file mode 100644
index 00000000000..d795ba4422e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextHighlightAction.java b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/actions/TextHighlightAction.java
new file mode 100644
index 00000000000..7c29e12f858
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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.views.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.views.documentation.view.DocViewPlugin;
+import org.eclipse.papyrus.views.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/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/messages.properties b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/documentation/view/messages.properties
new file mode 100644
index 00000000000..3e42c335ec9
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation.view/src/org/eclipse/papyrus/views/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
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/.classpath b/deprecated/org.eclipse.papyrus.views.documentation/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/.project b/deprecated/org.eclipse.papyrus.views.documentation/.project
new file mode 100644
index 00000000000..6f2cf1dabb3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.views.documentation</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/deprecated/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..c8fbb49d90a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.core.runtime,
+ org.eclipse.core.commands
+Export-Package: org.eclipse.papyrus.views.documentation,
+ org.eclipse.papyrus.views.documentation.eannotation
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.1.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.views.documentation.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.views.documentation;singleton
+ :=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/about.html b/deprecated/org.eclipse.papyrus.views.documentation/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/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/deprecated/org.eclipse.papyrus.views.documentation/build.properties b/deprecated/org.eclipse.papyrus.views.documentation/build.properties
new file mode 100644
index 00000000000..fc75f29690d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:50 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,schema/,plugin.properties,about.html
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/plugin.properties b/deprecated/org.eclipse.papyrus.views.documentation/plugin.properties
new file mode 100644
index 00000000000..9d6c640a44d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/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=Papyrus documentation manager (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/plugin.xml b/deprecated/org.eclipse.papyrus.views.documentation/plugin.xml
new file mode 100644
index 00000000000..21020b34feb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="documentationManager" name="documentationManager" schema="schema/documentationManager.exsd"/>
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/schema/documentationManager.exsd b/deprecated/org.eclipse.papyrus.views.documentation/schema/documentationManager.exsd
new file mode 100644
index 00000000000..1ca36d98dcb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/schema/documentationManager.exsd
@@ -0,0 +1,100 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.views.documentation" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.views.documentation" id="modelDocumentationManager" name="modelDocumentationManager"/>
+ </appinfo>
+ <documentation>
+ This extension is used to provide a way to get and set a documentation for an element of a specific meta-model.
+A generic implementation using EAnnotation on EModelElement is used if no other implementation is found for the current meta-model.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="documentationManager" 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="documentationManager">
+ <complexType>
+ <attribute name="modelNsURI" type="string" use="required">
+ <annotation>
+ <documentation>
+ The nsURI of the meta-model for which this implementation applies.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="managerClass" type="string" use="required">
+ <annotation>
+ <documentation>
+ The implementation for the specified meta-model.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.views.documentation.registry.IDocumentationManager"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority">
+ <annotation>
+ <documentation>
+ This attribute is used to specify the priority of the contributed documentationManager.
+The documentationManager with the higher priority will be used. The behavior is unspecified if more than one documentationManager have the same modelNsURI and the same priority. Default value is Lowest.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="Lowest">
+ </enumeration>
+ <enumeration value="Low">
+ </enumeration>
+ <enumeration value="Medium">
+ </enumeration>
+ <enumeration value="High">
+ </enumeration>
+ <enumeration value="Highest">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+
+</schema>
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java
new file mode 100644
index 00000000000..fb0b9db7978
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManager.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManager.java
new file mode 100644
index 00000000000..0735303eec2
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManager.java
@@ -0,0 +1,131 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * Helper class to access and modify documentation independently from the meta-model.
+ * It also provides an easy way to be notified of documentation change.
+ * The default implementation {@link EAnnotationDocumentationManager} uses an EAnnotation if it is available.
+ *
+ * @author mvelten
+ *
+ */
+public class DocumentationManager extends DocumentationManagerRegistry implements IDocumentationManager {
+
+ private static class DocumentationManagerHolder {
+
+ public static final DocumentationManager instance = new DocumentationManager();
+ }
+
+ public static DocumentationManager getInstance() {
+ return DocumentationManagerHolder.instance;
+ }
+
+ private static Set<IDocumentationChangedListener> documentationChangedListeners = new HashSet<IDocumentationChangedListener>();
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDocumentation(EObject eObject) throws DocumentationUnsupportedException {
+ if (eObject != null) {
+ IDocumentationManager documentationManager = getDocumentationManager(eObject.eClass().getEPackage().getNsURI());
+ if(documentationManager != null) {
+ return documentationManager.getDocumentation(eObject);
+ }
+ }
+ throw new DocumentationUnsupportedException(Messages.DocumentationManager_UnsupportedModelType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getChangeDocumentationCommand(EObject eObject, String newDocumentation) {
+ IDocumentationManager documentationManager = getDocumentationManager(eObject.eClass().getEPackage().getNsURI());
+ if(documentationManager != null) {
+ return documentationManager.getChangeDocumentationCommand(eObject, newDocumentation);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getAddAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ IDocumentationManager documentationManager = getDocumentationManager(eObject.eClass().getEPackage().getNsURI());
+ if(documentationManager != null) {
+ return documentationManager.getAddAssociatedResourceCommand(eObject, resourceURI);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getRemoveAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ IDocumentationManager documentationManager = getDocumentationManager(eObject.eClass().getEPackage().getNsURI());
+ if(documentationManager != null) {
+ return documentationManager.getRemoveAssociatedResourceCommand(eObject, resourceURI);
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<URI> getAssociatedResources(EObject eObject) throws DocumentationUnsupportedException {
+ IDocumentationManager documentationManager = getDocumentationManager(eObject.eClass().getEPackage().getNsURI());
+ if(documentationManager != null) {
+ return documentationManager.getAssociatedResources(eObject);
+ } else {
+ throw new DocumentationUnsupportedException(Messages.DocumentationManager_UnsupportedModelType);
+ }
+ }
+
+ /**
+ * {@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;
+ }
+
+ public void documentationChanged(EObject eObject) {
+ for(IDocumentationChangedListener listener : documentationChangedListeners) {
+ listener.documentationChanged(eObject);
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManagerRegistry.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManagerRegistry.java
new file mode 100644
index 00000000000..c0560d8c810
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationManagerRegistry.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.PriorityQueue;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.views.documentation.eannotation.EAnnotationDocumentationManager;
+
+public abstract class DocumentationManagerRegistry implements IDocumentationChangedListener {
+
+ // extension point ID
+ private static final String MODELDOCUMENTATION_EXTENSION_ID = "org.eclipse.papyrus.views.documentation.documentationManager"; //$NON-NLS-1$
+
+ private static final String MODELNSURI_ID = "modelNsURI"; //$NON-NLS-1$
+
+ private static final String PRIORITY_ID = "priority"; //$NON-NLS-1$
+
+ private static final String MODELDOCUMENTATIONCLASS_ID = "managerClass"; //$NON-NLS-1$
+
+ // Lowest is default
+ private static final Integer DEFAULT_PRIORITY = 0;
+
+
+ private Map<String, PriorityQueue<IDocumentationManager>> nsURIDocumentationManagerMap = new HashMap<String, PriorityQueue<IDocumentationManager>>();
+
+ private Map<IDocumentationManager, Integer> documentationManagerPriorityMap = new HashMap<IDocumentationManager, Integer>();
+
+ private IDocumentationManager eAnnotationDocumentationManager;
+
+ public DocumentationManagerRegistry() {
+ eAnnotationDocumentationManager = EAnnotationDocumentationManager.getInstance();
+ eAnnotationDocumentationManager.registerDocumentationChangedListener(this);
+ initializeMap();
+ }
+
+ protected IDocumentationManager getDocumentationManager(String nsURI) {
+ IDocumentationManager documentationManager = null;
+
+ PriorityQueue<IDocumentationManager> documentationManagers = nsURIDocumentationManagerMap.get(nsURI);
+ if(documentationManagers != null) {
+ documentationManager = documentationManagers.peek();
+ }
+
+ if(documentationManager == null) {
+ return eAnnotationDocumentationManager;
+ }
+
+ return documentationManager;
+ }
+
+ private void initializeMap() {
+ // Reading data from plugins
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(MODELDOCUMENTATION_EXTENSION_ID);
+ for(int i = 0; i < configElements.length; i++) {
+ initializeOne(configElements[i]);
+ }
+ }
+
+ private void initializeOne(IConfigurationElement iConfigurationElement) {
+ try {
+ String modelNsURI = iConfigurationElement.getAttribute(MODELNSURI_ID);
+
+ IDocumentationManager documentationManager = (IDocumentationManager)createExtension(iConfigurationElement, MODELDOCUMENTATIONCLASS_ID);
+ documentationManager.registerDocumentationChangedListener(this);
+
+ String priority = iConfigurationElement.getAttribute(PRIORITY_ID);
+ documentationManagerPriorityMap.put(documentationManager, convertPriorityToInteger(priority));
+
+ PriorityQueue<IDocumentationManager> documentationManagers = nsURIDocumentationManagerMap.get(modelNsURI);
+ if(documentationManagers == null) {
+ documentationManagers = new PriorityQueue<IDocumentationManager>(10, new Comparator<IDocumentationManager>() {
+
+ public int compare(IDocumentationManager o1, IDocumentationManager o2) {
+ Integer p1 = documentationManagerPriorityMap.get(o1);
+ if(p1 == null) {
+ p1 = DEFAULT_PRIORITY;
+ }
+ Integer p2 = documentationManagerPriorityMap.get(o2);
+ if(p2 == null) {
+ p2 = DEFAULT_PRIORITY;
+ }
+ return p2 - p1;
+ }
+ });
+
+ nsURIDocumentationManagerMap.put(modelNsURI, documentationManagers);
+ }
+ documentationManagers.add(documentationManager);
+ } catch (Throwable e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private static Integer convertPriorityToInteger(String priorityString) {
+ if(priorityString == null) {
+ return DEFAULT_PRIORITY;
+ }
+ if(priorityString.equalsIgnoreCase("Lowest")) { //$NON-NLS-1$
+ return 0;
+ }
+ if(priorityString.equalsIgnoreCase("Low")) { //$NON-NLS-1$
+ return 1;
+ }
+ if(priorityString.equalsIgnoreCase("Medium")) { //$NON-NLS-1$
+ return 2;
+ }
+ if(priorityString.equalsIgnoreCase("High")) { //$NON-NLS-1$
+ return 3;
+ }
+ if(priorityString.equalsIgnoreCase("Highest")) { //$NON-NLS-1$
+ return 4;
+ }
+ return DEFAULT_PRIORITY;
+ }
+
+ /**
+ * Load an instance of a class
+ *
+ * @param element
+ * the extension point
+ * @param classAttribute
+ * the name of the class to load
+ * @return the loaded Class
+ * @throws Exception
+ * if the class is not loaded
+ */
+ private static Object createExtension(final IConfigurationElement element, final String classAttribute) throws Exception {
+ return element.createExecutableExtension(classAttribute);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationUnsupportedException.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationUnsupportedException.java
new file mode 100644
index 00000000000..457b78a1a0d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/DocumentationUnsupportedException.java
@@ -0,0 +1,27 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+public class DocumentationUnsupportedException extends Exception {
+
+ private static final long serialVersionUID = -5469193051315476642L;
+
+ public DocumentationUnsupportedException() {
+ super();
+ }
+
+ public DocumentationUnsupportedException(String message) {
+ super(message);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationChangedListener.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationChangedListener.java
new file mode 100644
index 00000000000..dea2e167d2d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationChangedListener.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Listener interface used to be notified of a change in the documentation.
+ *
+ * @author mvelten
+ *
+ */
+public interface IDocumentationChangedListener {
+
+ /**
+ * This method will be called when the documentation of eObject or its author is modified.
+ *
+ * @param eObject
+ */
+ void documentationChanged(EObject eObject);
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationManager.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationManager.java
new file mode 100644
index 00000000000..3a4ea21be63
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/IDocumentationManager.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * Interface used to provide a way to get or change the documentation of an element.
+ *
+ * @author mvelten
+ *
+ */
+public interface IDocumentationManager {
+
+ /**
+ * Returns an EMF Command to change the documentation.
+ *
+ * @param eObject
+ * The element where to change the documentation.
+ * @param newDocumentation
+ * The new value of the documentation or null to remove it.
+ * @return the command to execute or null if this element can not host a documentation.
+ */
+ public Command getChangeDocumentationCommand(EObject eObject, String newDocumentation);
+
+ /**
+ * Returns an EMF Command to add an associated resource to the element.
+ *
+ * @param eObject
+ * The element where to add the associated resource.
+ * @param resourceURI
+ * the URI of the resource.
+ * @return the command to execute or null if this element can not host a documentation.
+ */
+ public Command getAddAssociatedResourceCommand(EObject eObject, URI resourceURI);
+
+ /**
+ * Returns an EMF Command to remove an associated resource from the element.
+ *
+ * @param eObject
+ * The element where to remove the associated resource.
+ * @param resourceURI
+ * the URI of the resource.
+ * @return the command to execute or null if this element can not host a documentation.
+ */
+ public Command getRemoveAssociatedResourceCommand(EObject eObject, URI resourceURI);
+
+ /**
+ * Returns the documentation of an element.
+ *
+ * @param eObject
+ * The element where to look for the documentation.
+ * @return The documentation or null if there is no documentation.
+ * @throws DocumentationUnsupportedException
+ * if documentation is not supported on this element.
+ */
+ public String getDocumentation(EObject eObject) throws DocumentationUnsupportedException;
+
+ /**
+ * Returns the associated resources of the element.
+ *
+ * @param eObject
+ * The element where to look for the associated resources.
+ * @return a list of resource URIs.
+ * @throws DocumentationUnsupportedException
+ * if documentation is not supported on this element.
+ */
+ public List<URI> getAssociatedResources(EObject eObject) throws DocumentationUnsupportedException;
+
+ /**
+ * Register a IDocumentationChangedListener (see {@link IDocumentationChangedListener}).
+ *
+ * @param listener
+ */
+ public void registerDocumentationChangedListener(IDocumentationChangedListener listener);
+
+ /**
+ * Unregister a IDocumentationChangedListener (see {@link IDocumentationChangedListener}).
+ *
+ * @param listener
+ */
+ public void unregisterDocumentationChangedListener(IDocumentationChangedListener listener);
+
+ /**
+ * @return the registered IDocumentationChangedListeners.
+ */
+ public Set<IDocumentationChangedListener> getRegisteredDocumentationChangedListeners();
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Messages.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Messages.java
new file mode 100644
index 00000000000..4902e80b7a3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Messages.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * 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.views.documentation;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.views.documentation.messages"; //$NON-NLS-1$
+
+ public static String AddOrRemoveAssociatedResourceCommandLabel;
+
+ public static String ChangeDocCommandLabel;
+
+ public static String DocumentationManager_UnsupportedModelType;
+
+ public static String EAnnotationDocumentationManager_DocOnDocEAnnotationError;
+
+ public static String EAnnotationDocumentationManager_NonEModelElementError;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/AddOrRemoveAssociatedResourceCommand.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/AddOrRemoveAssociatedResourceCommand.java
new file mode 100644
index 00000000000..d7c3ddb7f3d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/AddOrRemoveAssociatedResourceCommand.java
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * 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.views.documentation.eannotation;
+
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.papyrus.views.documentation.Messages;
+
+
+public class AddOrRemoveAssociatedResourceCommand extends AbstractCommand {
+
+ private boolean remove;
+
+ private EModelElement element;
+
+ private Set<IDocumentationChangedListener> documentationChangedListeners;
+
+ private String prefix;
+
+ private String value;
+
+ public AddOrRemoveAssociatedResourceCommand(boolean remove, EModelElement element, URI resourceURI, Set<IDocumentationChangedListener> documentationChangedListeners) {
+ super(Messages.AddOrRemoveAssociatedResourceCommandLabel);
+ this.remove = remove;
+ this.element = element;
+ this.documentationChangedListeners = documentationChangedListeners;
+
+ if(resourceURI.isPlatform()) {
+ prefix = IEAnnotationConstants.PREFIX_WORKSPACE_RESOURCE;
+ value = resourceURI.toPlatformString(true);
+ } else if(resourceURI.isFile()) {
+ prefix = IEAnnotationConstants.PREFIX_EXTERNAL_RESOURCE;
+ value = resourceURI.toFileString();
+ } else {
+ prefix = IEAnnotationConstants.PREFIX_REMOTE_RESOURCE;
+ value = resourceURI.toString();
+ }
+ }
+
+ private void notifyListeners() {
+ for(IDocumentationChangedListener listener : documentationChangedListeners) {
+ listener.documentationChanged(element);
+ }
+ }
+
+ @Override
+ public boolean canExecute() {
+ return true;
+ }
+
+ @Override
+ public boolean canUndo() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() {
+ redo();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void redo() {
+ if(remove) {
+ removeAssociatedResource();
+ } else {
+ addAssociatedResource();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void undo() {
+ if(remove) {
+ addAssociatedResource();
+ } else {
+ removeAssociatedResource();
+ }
+ }
+
+ private void addAssociatedResource() {
+ EAnnotation annotation = element.getEAnnotation(IEAnnotationConstants.ASSOCIATED_RESOURCES_SOURCE);
+ if(annotation == null) {
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource(IEAnnotationConstants.ASSOCIATED_RESOURCES_SOURCE);
+ element.getEAnnotations().add(annotation);
+ }
+ if(prefix != null && value != null) {
+ annotation.getDetails().put(getNewResourceKey(annotation, prefix, 0), value);
+ notifyListeners();
+ }
+ }
+
+ private void removeAssociatedResource() {
+ EAnnotation annotation = element.getEAnnotation(IEAnnotationConstants.ASSOCIATED_RESOURCES_SOURCE);
+ if(annotation != null && prefix != null && value != null) {
+ EMap<String, String> details = annotation.getDetails();
+ for(Entry<String, String> detail : details) {
+ if(detail.getKey() != null && detail.getKey().startsWith(prefix) && value.equals(detail.getValue())) {
+ details.remove(detail);
+ break;
+ }
+ }
+ if (details.isEmpty()) {
+ element.getEAnnotations().remove(annotation);
+ }
+ notifyListeners();
+ }
+ }
+
+ /**
+ * Recursively compute a new resource key using its prefix, a starting index and a map of resources to create. It
+ * also look in the existing resources to find a free index.
+ *
+ * @param resourcePrefix
+ * the resource prefix to use
+ * @param startIndex
+ * the start index (ie : 0)
+ * @return a new resource key
+ */
+ private String getNewResourceKey(EAnnotation annotation, String resourcePrefix, int startIndex) {
+ String key = resourcePrefix + startIndex;
+ if(annotation != null && annotation.getDetails().get(key) == null) {
+ return key;
+ }
+
+ return getNewResourceKey(annotation, resourcePrefix, startIndex + 1);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/ChangeEAnnotationCommand.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/ChangeEAnnotationCommand.java
new file mode 100644
index 00000000000..127a8b1ba52
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/ChangeEAnnotationCommand.java
@@ -0,0 +1,150 @@
+/***********************************************************************
+ * 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:
+ * Jacques Lescot (Anyware Technologies) - initial API and implementation
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com
+ **********************************************************************/
+package org.eclipse.papyrus.views.documentation.eannotation;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.papyrus.views.documentation.Messages;
+
+/**
+ * A GEF Command use to update documentation EAnnotation when an EModelElement is selected.
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques LESCOT</a>
+ * @author <a href="mailto:sebastien.gabel@c-s.fr">Sebastien GABEL</a>
+ * @author Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com
+ */
+public class ChangeEAnnotationCommand extends AbstractCommand {
+
+ private EModelElement element;
+
+ private String newValue;
+
+ private String oldValue;
+
+ private String source;
+
+ private String key;
+
+ private Set<IDocumentationChangedListener> documentationChangedListeners;
+
+ /**
+ * Constructor
+ *
+ * @param element
+ * the EModelElement
+ * @param newValue
+ * the new documentation as a String
+ */
+ public ChangeEAnnotationCommand(EModelElement element, String source, String key, String newValue, Set<IDocumentationChangedListener> documentationChangedListeners) {
+ super(Messages.ChangeDocCommandLabel);
+ this.element = element;
+ this.source = source;
+ this.key = key;
+ this.newValue = newValue;
+ this.documentationChangedListeners = documentationChangedListeners;
+ }
+
+
+
+ @Override
+ public boolean canExecute() {
+ return true;
+ }
+
+
+
+ @Override
+ public boolean canUndo() {
+ return true;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() {
+ // stores the previous doc
+ oldValue = null;
+ EAnnotation annotation = element.getEAnnotation(source);
+ if(annotation != null) {
+ oldValue = annotation.getDetails().get(key);
+ }
+
+ redo();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void redo() {
+ changeDocumentation(element, newValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void undo() {
+ changeDocumentation(element, oldValue);
+ }
+
+ private void notifyListeners(String currentDoc) {
+ for (IDocumentationChangedListener listener : documentationChangedListeners) {
+ listener.documentationChanged(element);
+ }
+ }
+
+ /**
+ * Set the documentation for the given Model Element
+ *
+ * @param elt
+ * the element to document
+ * @param newDoc
+ * the documentation text
+ */
+ protected IStatus changeDocumentation(EModelElement elt, String newDoc) {
+ EAnnotation annotation = elt.getEAnnotation(source);
+ if(newDoc != null && !"".equals(newDoc)) { //$NON-NLS-1$
+ // creates EAnnotation if needed
+ if(annotation == null) {
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource(source);
+ elt.getEAnnotations().add(annotation);
+ }
+
+ annotation.getDetails().put(key, newDoc);
+ } else {
+ // remove the documentation
+ if(annotation != null) {
+ annotation.getDetails().remove(key);
+
+ // remove the EAnnotation if empty
+ if(annotation.getDetails().isEmpty()) {
+ elt.getEAnnotations().remove(annotation);
+ }
+ }
+ }
+ notifyListeners(newDoc);
+
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/EAnnotationDocumentationManager.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/EAnnotationDocumentationManager.java
new file mode 100644
index 00000000000..7b2608fce85
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/EAnnotationDocumentationManager.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * 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.views.documentation.eannotation;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.views.documentation.DocumentationUnsupportedException;
+import org.eclipse.papyrus.views.documentation.IDocumentationChangedListener;
+import org.eclipse.papyrus.views.documentation.IDocumentationManager;
+import org.eclipse.papyrus.views.documentation.Messages;
+
+
+public class EAnnotationDocumentationManager implements IDocumentationManager {
+
+ private static class EAnnotationDocumentationManagerHolder {
+
+ public static final EAnnotationDocumentationManager instance = new EAnnotationDocumentationManager();
+ }
+
+ public static EAnnotationDocumentationManager getInstance() {
+ return EAnnotationDocumentationManagerHolder.instance;
+ }
+
+ private static Set<IDocumentationChangedListener> documentationChangedListeners = new HashSet<IDocumentationChangedListener>();
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getChangeDocumentationCommand(EObject eObject, String newDocumentation) {
+ if(getUnsupportedErrorMessage(eObject) == null) {
+ return new ChangeEAnnotationCommand((EModelElement)eObject, IEAnnotationConstants.DOCUMENTATION_SOURCE, IEAnnotationConstants.DOCUMENTATION_KEY, newDocumentation, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDocumentation(EObject eObject) throws DocumentationUnsupportedException {
+ String errorMsg = getUnsupportedErrorMessage(eObject);
+ if(errorMsg == null) {
+ EAnnotation annotation = ((EModelElement)eObject).getEAnnotation(IEAnnotationConstants.DOCUMENTATION_SOURCE);
+ if(annotation != null) {
+ return annotation.getDetails().get(IEAnnotationConstants.DOCUMENTATION_KEY);
+ }
+ return null;
+ } else {
+ throw new DocumentationUnsupportedException(errorMsg);
+ }
+ }
+
+ public Command getAddAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ if(getUnsupportedErrorMessage(eObject) == null) {
+ return new AddOrRemoveAssociatedResourceCommand(false, (EModelElement)eObject, resourceURI, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+
+ public Command getRemoveAssociatedResourceCommand(EObject eObject, URI resourceURI) {
+ if(getUnsupportedErrorMessage(eObject) == null) {
+ return new AddOrRemoveAssociatedResourceCommand(true, (EModelElement)eObject, resourceURI, documentationChangedListeners);
+ } else {
+ return null;
+ }
+ }
+
+ public List<URI> getAssociatedResources(EObject eObject) throws DocumentationUnsupportedException {
+ String errorMsg = getUnsupportedErrorMessage(eObject);
+ if(errorMsg == null) {
+ EAnnotation annotation = ((EModelElement)eObject).getEAnnotation(IEAnnotationConstants.ASSOCIATED_RESOURCES_SOURCE);
+ if(annotation != null) {
+ return convertDetailsToURIs(annotation.getDetails());
+ }
+ return new LinkedList<URI>();
+ } else {
+ throw new DocumentationUnsupportedException(errorMsg);
+ }
+ }
+
+ /**
+ * {@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;
+ }
+
+ private static List<URI> convertDetailsToURIs(EMap<String, String> details) {
+ List<URI> uris = new LinkedList<URI>();
+ for(Entry<String, String> detail : details) {
+ String value = detail.getValue();
+
+ String prefix = detail.getKey().substring(0, 2);
+ URI uri = null;
+ if(IEAnnotationConstants.PREFIX_REMOTE_RESOURCE.equals(prefix)) {
+ uri = URI.createURI(value, false);
+ } else if(IEAnnotationConstants.PREFIX_EXTERNAL_RESOURCE.equals(prefix)) {
+ uri = URI.createFileURI(value);
+ } else if(IEAnnotationConstants.PREFIX_WORKSPACE_RESOURCE.equals(prefix)) {
+ uri = URI.createPlatformResourceURI(value, true);
+ }
+ uris.add(uri);
+ }
+ return uris;
+ }
+
+ /**
+ * get an error message if eObject is unsupported by this implementation
+ *
+ * @param eObject
+ * @return null if it is ok or an error message if not
+ */
+ private static String getUnsupportedErrorMessage(EObject eObject) {
+ // forbid doc on doc eannotation
+ if(eObject instanceof EAnnotation && ((EAnnotation)eObject).getSource().equals(IEAnnotationConstants.DOCUMENTATION_SOURCE)) {
+ return Messages.EAnnotationDocumentationManager_DocOnDocEAnnotationError;
+ // Check whether the element is an EModelElement
+ } else if(eObject instanceof EModelElement) {
+ // OK, return null
+ return null;
+ } else {
+ return Messages.EAnnotationDocumentationManager_NonEModelElementError;
+ }
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/IEAnnotationConstants.java b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/IEAnnotationConstants.java
new file mode 100644
index 00000000000..f8251a7747f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/eannotation/IEAnnotationConstants.java
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * 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.views.documentation.eannotation;
+
+public abstract interface IEAnnotationConstants {
+ public static final String DOCUMENTATION_SOURCE = "http://www.topcased.org/documentation"; //$NON-NLS-1$
+
+ public static final String DOCUMENTATION_KEY = "documentation"; //$NON-NLS-1$
+
+ public static final String ASSOCIATED_RESOURCES_SOURCE = "http://www.topcased.org/resources"; //$NON-NLS-1$
+
+ public static final String PREFIX_WORKSPACE_RESOURCE = "WR"; //$NON-NLS-1$
+
+ public static final String PREFIX_EXTERNAL_RESOURCE = "ER"; //$NON-NLS-1$
+
+ public static final String PREFIX_REMOTE_RESOURCE = "RR"; //$NON-NLS-1$
+}
diff --git a/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/messages.properties b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/messages.properties
new file mode 100644
index 00000000000..71288ecb6cf
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/messages.properties
@@ -0,0 +1,5 @@
+AddOrRemoveAssociatedResourceCommandLabel=Add or remove associated resource
+ChangeDocCommandLabel=Change documentation
+DocumentationManager_UnsupportedModelType=Unsupported type of model
+EAnnotationDocumentationManager_DocOnDocEAnnotationError=Documentation on documentation EAnnotation unsupported
+EAnnotationDocumentationManager_NonEModelElementError=Documentation on non EModelElement unsupported by this implementation

Back to the top