summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-04-04 10:15:07 (EDT)
committerLaurent Wouters2014-04-04 10:15:07 (EDT)
commit87bb70421f282530e54a88842bfe8499df4a6a81 (patch)
tree556bc9c935c7c613bb320192b0a2ef4eaeaf415b
parent77f853099e95b63a563834776bf9efade8ebb71a (diff)
downloadorg.eclipse.papyrus-87bb70421f282530e54a88842bfe8499df4a6a81.zip
org.eclipse.papyrus-87bb70421f282530e54a88842bfe8499df4a6a81.tar.gz
org.eclipse.papyrus-87bb70421f282530e54a88842bfe8499df4a6a81.tar.bz2
[clean] Retiring org.eclipse.papyrus.uml.properties.tabbedproperties.commentslast/org.eclipse.papyrus.uml.properties.tabbedproperties.comments
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
-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.gifbin582 -> 0 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
22 files changed, 0 insertions, 2344 deletions
diff --git a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath b/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath
deleted file mode 100644
index 2d1a430..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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
deleted file mode 100644
index 6947862..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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
deleted file mode 100644
index 0f12a87..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#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
deleted file mode 100644
index 28f12ef..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,31 +0,0 @@
-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
deleted file mode 100644
index 82d49bf..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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
deleted file mode 100644
index 9b2f95a..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-#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
deleted file mode 100644
index a598f60..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/icons/ConsoleView.gif
+++ /dev/null
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
deleted file mode 100644
index 8bf4177..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-#################################################################################
-# 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
deleted file mode 100644
index ec7ae22..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/plugin.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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
deleted file mode 100644
index fb7c186..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Activator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-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
deleted file mode 100644
index 3673aa3..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/Messages.java
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index c7248c6..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 67b94f0..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/messages.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-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
deleted file mode 100644
index 38255a3..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentContentProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 1678a17..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentFilter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-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
deleted file mode 100644
index 9a054c7..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentPropertySection.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 397fb89..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichText.java
+++ /dev/null
@@ -1,418 +0,0 @@
-//------------------------------------------------------------------------------
-// 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
deleted file mode 100644
index b019d96..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextEditor.java
+++ /dev/null
@@ -1,210 +0,0 @@
-//------------------------------------------------------------------------------
-// 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
deleted file mode 100644
index 77b883c..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentRichTextFormToolkit.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index cfa166b..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
+++ /dev/null
@@ -1,789 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 2f2cc57..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index ef251c5..0000000
--- a/deprecated/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichTextEditor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * 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;
- }
-
-}