Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-04-04 14:14:37 +0000
committerLaurent Wouters2014-04-04 14:14:37 +0000
commita7be9ef2589bcbee82511664d616e50b29c61ce2 (patch)
treec10939f011ac33616e354f67fc16ac2aae966344 /deprecated/org.eclipse.papyrus.uml.documentation/src/org
parent91529e93b237ec709adb311593c1f848510f3229 (diff)
downloadorg.eclipse.papyrus-last/org.eclipse.papyrus.uml.documentation.tar.gz
org.eclipse.papyrus-last/org.eclipse.papyrus.uml.documentation.tar.xz
org.eclipse.papyrus-last/org.eclipse.papyrus.uml.documentation.zip
[clean] Retiring org.eclipse.papyrus.uml.documentationlast/org.eclipse.papyrus.uml.documentation
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
Diffstat (limited to 'deprecated/org.eclipse.papyrus.uml.documentation/src/org')
-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
6 files changed, 0 insertions, 546 deletions
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
deleted file mode 100644
index 18e14cb06d3..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 9933755a800..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 76b799bda25..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLAddOrRemoveAssociatedResourceCommand.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index cd43fc17712..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLChangeDocumentationCommand.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 7e98e921145..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/UMLDocumentationManager.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 09c53a6992e..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.documentation/src/org/eclipse/papyrus/uml/documentation/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-UMLDocumentationManager_DocOnDocCommentError=Documentation on documentation comment unsupported
-UMLDocumentationManager_NonUMLElementError=Documentation on non UML element unsupported by this implementation

Back to the top