diff options
author | cletavernie | 2012-02-14 09:30:23 +0000 |
---|---|---|
committer | cletavernie | 2012-02-14 09:30:23 +0000 |
commit | ba1ee579d04cba5fd4f007c45578115d1a233a94 (patch) | |
tree | 93fcf0dabc3cb4dccf094bd096f9c1b7c8393805 | |
parent | e1dc14e078c9b5568c895cb88dbba474ab8b583d (diff) | |
download | org.eclipse.papyrus-ba1ee579d04cba5fd4f007c45578115d1a233a94.tar.gz org.eclipse.papyrus-ba1ee579d04cba5fd4f007c45578115d1a233a94.tar.xz org.eclipse.papyrus-ba1ee579d04cba5fd4f007c45578115d1a233a94.zip |
371460: [UML Diagram Common] The UML Diagram Common plug-in should be split
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371460
Initial import of *.appearance plug-ins
32 files changed, 1838 insertions, 0 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.classpath b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.project b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.project new file mode 100644 index 00000000000..8c0d3ad1182 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.appearance</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +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/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..fe8b99f8b31 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.appearance +Bundle-Version: 0.9.0.qualifier +Bundle-Activator: org.eclipse.papyrus.infra.emf.appearance.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.emf.ecore;bundle-version="2.8.0", + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.papyrus.infra.emf;bundle-version="0.9.0", + org.eclipse.papyrus.infra.core.log;bundle-version="0.9.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.papyrus.infra.emf.appearance, + org.eclipse.papyrus.infra.emf.appearance.commands, + org.eclipse.papyrus.infra.emf.appearance.helper diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/build.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/build.properties new file mode 100644 index 00000000000..f4ae9701586 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/build.properties @@ -0,0 +1,5 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/plugin.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/plugin.properties new file mode 100644 index 00000000000..95da0b35cc0 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.infra.emf.appearance
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Appearance
\ No newline at end of file diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/Activator.java new file mode 100644 index 00000000000..5e7f816e18c --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/Activator.java @@ -0,0 +1,58 @@ +package org.eclipse.papyrus.infra.emf.appearance;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.appearance"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/AddMaskManagedLabelDisplayCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/AddMaskManagedLabelDisplayCommand.java new file mode 100644 index 00000000000..aed6716800b --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/AddMaskManagedLabelDisplayCommand.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.Activator;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+
+/**
+ * The Class AddAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class AddMaskManagedLabelDisplayCommand extends CreateEAnnotationCommand {
+
+ /** new Mask Value */
+ private int maskValue;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the editing domain that manages the command
+ * @param object
+ * the object to be modified
+ * @param maskValue
+ * the mask value to be stored
+ */
+ public AddMaskManagedLabelDisplayCommand(TransactionalEditingDomain domain, EModelElement object, int maskValue) {
+ super(domain, object, VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ this.maskValue = maskValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+
+ EAnnotation oldAnnotation = getObject().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ Activator.log.debug(maskValue + " -> " + Integer.toString(maskValue));
+ replaceEntry(oldAnnotation, VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE, Integer.toString(maskValue));
+
+ replaceEannotation(getObject().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION), getObject());
+
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetLayoutKindCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetLayoutKindCommand.java new file mode 100644 index 00000000000..92f6740487a --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetLayoutKindCommand.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+
+
+/**
+ * set the kind of the layout of the figure
+ */
+public class SetLayoutKindCommand extends CreateEAnnotationCommand {
+
+ private String layoutKind;
+
+ /**
+ * Instantiates a new sets the qualified name depth command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param shadow
+ * the shadow
+ */
+ public SetLayoutKindCommand(TransactionalEditingDomain domain, EModelElement object, String layoutKind) {
+ super(domain, object, VisualInformationPapyrusConstants.LAYOUTFIGURE);
+ this.layoutKind = "" + layoutKind;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation shadowFigureEAnnotation = createEAnnotation();
+ replaceEannotation(shadowFigureEAnnotation, getObject());
+ replaceEntry(shadowFigureEAnnotation, VisualInformationPapyrusConstants.LAYOUTFIGURE_VALUE, layoutKind);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetNameLabelIconCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetNameLabelIconCommand.java new file mode 100644 index 00000000000..8ef21e32b4e --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetNameLabelIconCommand.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+
+/**
+ * The Class SetQualifiedNameDepthCommand.
+ */
+public class SetNameLabelIconCommand extends CreateEAnnotationCommand {
+
+ /** The shadowFigure. */
+ private String displayIcon;
+
+ /**
+ * Instantiates a new sets the qualified name depth command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param shadow
+ * the shadow
+ */
+ public SetNameLabelIconCommand(TransactionalEditingDomain domain, EModelElement object, boolean displayIcon) {
+ super(domain, object, VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON);
+ this.displayIcon = "" + displayIcon;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation shadowFigureEAnnotation = createEAnnotation();
+ replaceEannotation(shadowFigureEAnnotation, getObject());
+ replaceEntry(shadowFigureEAnnotation, VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON_VALUE, displayIcon);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetQualifiedNameDepthCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetQualifiedNameDepthCommand.java new file mode 100644 index 00000000000..79dfe55bd0b --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetQualifiedNameDepthCommand.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+
+/**
+ * The Class SetQualifiedNameDepthCommand.
+ */
+public class SetQualifiedNameDepthCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepth. */
+ private String qualifiedNamedepth;
+
+ /**
+ * Instantiates a new sets the qualified name depth command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param depth
+ * the depth
+ */
+ public SetQualifiedNameDepthCommand(TransactionalEditingDomain domain, EModelElement object, int depth) {
+ super(domain, object, VisualInformationPapyrusConstants.QUALIFIED_NAME);
+ this.qualifiedNamedepth = "" + depth;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation qualifiedNameEAnnotation = createEAnnotation();
+ replaceEannotation(qualifiedNameEAnnotation, getObject());
+ replaceEntry(qualifiedNameEAnnotation, VisualInformationPapyrusConstants.QUALIFIED_NAME_DEPTH, qualifiedNamedepth);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetShadowFigureCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetShadowFigureCommand.java new file mode 100644 index 00000000000..0d83c8ec5fd --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/commands/SetShadowFigureCommand.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+
+/**
+ * The Class SetQualifiedNameDepthCommand.
+ */
+public class SetShadowFigureCommand extends CreateEAnnotationCommand {
+
+ /** The shadowFigure. */
+ private String shadowFigure;
+
+ /**
+ * Instantiates a new sets the qualified name depth command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param shadow
+ * the shadow
+ */
+ public SetShadowFigureCommand(TransactionalEditingDomain domain, EModelElement object, boolean shadow) {
+ super(domain, object, VisualInformationPapyrusConstants.SHADOWFIGURE);
+ this.shadowFigure = "" + shadow;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation shadowFigureEAnnotation = createEAnnotation();
+ replaceEannotation(shadowFigureEAnnotation, getObject());
+ replaceEntry(shadowFigureEAnnotation, VisualInformationPapyrusConstants.SHADOWFIGURE_VALUE, shadowFigure);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/NameLabelIconHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/NameLabelIconHelper.java new file mode 100644 index 00000000000..a79ce0b8a74 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/NameLabelIconHelper.java @@ -0,0 +1,70 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.helper;
+
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.commands.SetNameLabelIconCommand;
+
+public class NameLabelIconHelper {
+
+ /**
+ * get the display name label icon indication true or false
+ *
+ * @param modelElement
+ * the view where is attach the element
+ */
+ public static boolean showLabelIcon(EModelElement modelElement) {
+ EAnnotation displayNameLabelIcon = modelElement.getEAnnotation(VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON);
+ if(displayNameLabelIcon != null) {
+ EMap<String, String> entries = displayNameLabelIcon.getDetails();
+ if(entries != null) {
+ String gradientvalueString = entries.get(VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON_VALUE);
+ if(gradientvalueString != null) {
+ Boolean display = new Boolean(gradientvalueString);
+ if(display) {
+ return true;
+ }
+ }
+ }
+ }
+
+ //CSS Value (TODO : Remove this dependency ; add an extension point)
+
+ // return UMLCustomStyle.getCSSElementIcon(modelElement);
+
+ return false;
+ }
+
+ /**
+ * Gets the command to set the gradient to true are false.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param nameLabelIconValue
+ * true to display the icon of the element in labelName
+ *
+ * @return the command to set the gradient to true are false.
+ */
+ // @unused
+ public static RecordingCommand getNameLabelIconCommand(TransactionalEditingDomain domain, EModelElement view, boolean nameLabelIconValue) {
+ return new SetNameLabelIconCommand(domain, view, nameLabelIconValue);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/QualifiedNameHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/QualifiedNameHelper.java new file mode 100644 index 00000000000..e3be8cf921d --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/QualifiedNameHelper.java @@ -0,0 +1,72 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.helper;
+
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.commands.SetQualifiedNameDepthCommand;
+
+public class QualifiedNameHelper {
+
+ /**
+ * get the depth to display for the qualified name from a eannotation in the view
+ *
+ * @param modelElement
+ * the view where is attach the element
+ * @return the depth
+ */
+ public static int getQualifiedNameDepth(EModelElement modelElement) {
+ EAnnotation qualifiedNameAnnotation = modelElement.getEAnnotation(VisualInformationPapyrusConstants.QUALIFIED_NAME);
+ if(qualifiedNameAnnotation != null) {
+ EMap<String, String> entries = qualifiedNameAnnotation.getDetails();
+
+ if(entries != null) {
+ String depthString = entries.get(VisualInformationPapyrusConstants.QUALIFIED_NAME_DEPTH);
+ if(depthString != null) {
+ Integer i = new Integer(depthString);
+ if(i != 1000) {
+ return i.intValue();
+ }
+ }
+ }
+ }
+
+ //CSS Value (TODO : Remove this dependency ; add an extension point)
+
+ // return UMLCustomStyle.getCSSQualifiedNameDepth(modelElement);
+
+ return 1000;
+ }
+
+ /**
+ * Gets the sets the qualifed name depth command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param depth
+ * the depth
+ *
+ * @return the sets the qualifed name depth command
+ */
+ // @unused
+ public static RecordingCommand getSetQualifedNameDepthCommand(TransactionalEditingDomain domain, EModelElement view, int depth) {
+ return new SetQualifiedNameDepthCommand(domain, view, depth);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/ShadowFigureHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/ShadowFigureHelper.java new file mode 100644 index 00000000000..0934faac09d --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/ShadowFigureHelper.java @@ -0,0 +1,73 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.helper;
+
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.appearance.commands.SetShadowFigureCommand;
+
+public class ShadowFigureHelper {
+
+ /**
+ * get the shadow figure indication true or false
+ *
+ * @param modelElement
+ * the view where is attach the element
+ */
+ public static boolean getShadowFigureValue(EModelElement modelElement) {
+ EAnnotation shadowAnnotation = modelElement.getEAnnotation(VisualInformationPapyrusConstants.SHADOWFIGURE);
+ if(shadowAnnotation != null) {
+ EMap<String, String> entries = shadowAnnotation.getDetails();
+
+ if(entries != null) {
+ String gradientvalueString = entries.get(VisualInformationPapyrusConstants.SHADOWFIGURE_VALUE);
+ if(gradientvalueString != null) {
+ Boolean b = new Boolean(gradientvalueString);
+ if(b) {
+ return true;
+ }
+ }
+ }
+ }
+ //CSS Value (TODO : Remove this dependency ; add an extension point)
+
+ // if(modelElement instanceof UMLCustomStyle) {
+ // UMLCustomStyle cssElement = (UMLCustomStyle)modelElement;
+ // return cssElement.getCSSShadow();
+ // }
+
+ return false;
+ }
+
+ /**
+ * Gets the command to set the shadow figure to true are false.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param shadowFigureValue
+ * true to display the shadow on the figure
+ *
+ * @return the command to set the gradient to true are false.
+ */
+ // @unused
+ public static RecordingCommand getShadowColorCommand(TransactionalEditingDomain domain, EModelElement view, boolean shadowFigureValue) {
+ return new SetShadowFigureCommand(domain, view, shadowFigureValue);
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java new file mode 100644 index 00000000000..45d5747193f --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java @@ -0,0 +1,47 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.appearance.helper;
+
+//Refactoring 0.9: Some constants have been moved to UMLVisualInformationPapyrusConstant
+public interface VisualInformationPapyrusConstants {
+
+ /** The qualified name. */
+ public static String QUALIFIED_NAME = "QualifiedName";
+
+ /** The qualified name depth. */
+ public static String QUALIFIED_NAME_DEPTH = "QualifiedNameDepth";
+
+ public static String SHADOWFIGURE = "ShadowFigure";
+
+ public static String SHADOWFIGURE_VALUE = "ShadowFigure_Value";
+
+ public static String DISPLAY_NAMELABELICON = "displayNameLabelIcon";
+
+ public static String DISPLAY_NAMELABELICON_VALUE = "displayNameLabelIcon_value";
+
+ public static String LAYOUTFIGURE = "layoutFigure";
+
+ public static String LAYOUTFIGURE_VALUE = "layoutFigure_value";
+
+ /** key for the appearance of properties or other specific display */
+ public static final String CUSTOM_APPEARENCE_ANNOTATION = "CustomAppearance_Annotation";
+
+ /**
+ * this is a key of eAnnnotation that contains hypertext link or referenced document
+ **/
+ public static final String HYPERLINK_DIAGRAM = "PapyrusHyperLink_Diagram";
+
+ public static final String HYPERLINK_DIAGRAM_NAME = "diagram_name";
+
+ /** key for the appearance of properties or other specific display */
+ public static final String CUSTOM_APPEARANCE_MASK_VALUE = "CustomAppearance_MaskValue";
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/.classpath b/plugins/uml/org.eclipse.papyrus.uml.appearance/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/.project b/plugins/uml/org.eclipse.papyrus.uml.appearance/.project new file mode 100644 index 00000000000..a93dd622464 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.appearance</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/org.eclipse.papyrus.uml.appearance/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +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/plugins/uml/org.eclipse.papyrus.uml.appearance/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.appearance/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..9b79348c454 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.papyrus.uml.appearance +Bundle-Version: 0.9.0.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.appearance.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.infra.emf;bundle-version="0.9.0", + org.eclipse.emf.ecore;bundle-version="2.8.0", + org.eclipse.papyrus.infra.core.log;bundle-version="0.9.0", + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.uml2.uml;bundle-version="4.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.papyrus.uml.appearance, + org.eclipse.papyrus.uml.appearance.commands, + org.eclipse.papyrus.uml.appearance.helper diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/build.properties b/plugins/uml/org.eclipse.papyrus.uml.appearance/build.properties new file mode 100644 index 00000000000..f4ae9701586 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/build.properties @@ -0,0 +1,5 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/plugin.properties b/plugins/uml/org.eclipse.papyrus.uml.appearance/plugin.properties new file mode 100644 index 00000000000..5a45d2f65d6 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.uml.appearance
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = UML Appearance
\ No newline at end of file diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/Activator.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/Activator.java new file mode 100644 index 00000000000..bd3d87a2e5e --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/Activator.java @@ -0,0 +1,58 @@ +package org.eclipse.papyrus.uml.appearance;
+
+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.appearance"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedQNStereotypeToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedQNStereotypeToDisplayCommand.java new file mode 100644 index 00000000000..4820d81bdbf --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedQNStereotypeToDisplayCommand.java @@ -0,0 +1,83 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class AddQNAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display withe the qualifiedName.
+ */
+public class AddAppliedQNStereotypeToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private final String stereotypeListQN;
+
+ /**
+ * the presnetation kind of applied stereotypes
+ */
+ // @unused
+ private String appliedStereotypePresentationKind;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedQNStereotypeToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypeQNList) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypeListQN = stereotypeQNList;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ String stereoListQN = AppliedStereotypeHelper.getStereotypesQNToDisplay(this.getObject());
+ if(!"".equals(stereoListQN)) {
+ stereoListQN = stereoListQN + ",";
+ }
+ stereoListQN = stereoListQN + stereotypeListQN;
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, stereoListQN);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, AppliedStereotypeHelper
+ .getStereotypesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ AppliedStereotypeHelper.getAppliedStereotypePresentationKind(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypePropertiesToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypePropertiesToDisplayCommand.java new file mode 100644 index 00000000000..a78dece3300 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypePropertiesToDisplayCommand.java @@ -0,0 +1,79 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class AddAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class AddAppliedStereotypePropertiesToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private String stereotypeList;
+
+ /**
+ * add a new sets the applied stereotype properties to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedStereotypePropertiesToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypeList) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypeList = stereotypeList;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ String stereotypePropertiesList = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(this
+ .getObject());
+ if(!"".equals(stereotypePropertiesList)) {
+ stereotypePropertiesList = stereotypePropertiesList + ",";
+ }
+ stereotypePropertiesList = stereotypePropertiesList + stereotypeList;
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper
+ .getStereotypesQNToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, AppliedStereotypeHelper
+ .getStereotypesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ stereotypePropertiesList);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ AppliedStereotypeHelper.getAppliedStereotypePresentationKind(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypeToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypeToDisplayCommand.java new file mode 100644 index 00000000000..28634ed6bda --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/AddAppliedStereotypeToDisplayCommand.java @@ -0,0 +1,84 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class AddAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class AddAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private String stereotypeList;
+
+ /**
+ * the presnetation kind of applied stereotypes
+ */
+ private String appliedStereotypePresentationKind;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public AddAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypeList, String appliedStereotypepresentationKind) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypeList = stereotypeList;
+ this.appliedStereotypePresentationKind = appliedStereotypepresentationKind;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ String stereoList = AppliedStereotypeHelper.getStereotypesToDisplay(this.getObject());
+ if(!"".equals(stereoList)) {
+ stereoList = stereoList + ",";
+ }
+ stereoList = stereoList + stereotypeList;
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper
+ .getStereotypesQNToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, stereoList);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ appliedStereotypePresentationKind);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypePropertiesToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypePropertiesToDisplayCommand.java new file mode 100644 index 00000000000..e2935a0cefa --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypePropertiesToDisplayCommand.java @@ -0,0 +1,84 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class RemoveAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class RemoveAppliedStereotypePropertiesToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private String stereotypePropertiesListToRemove;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypePropertyList
+ * the stereotype list
+ */
+ public RemoveAppliedStereotypePropertiesToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypePropertyList) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypePropertiesListToRemove = stereotypePropertyList;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ String stereotypePropertiesList = AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(this
+ .getObject());
+
+ StringTokenizer appliedStereotypeToken = new StringTokenizer(stereotypePropertiesListToRemove, ",");
+ while(appliedStereotypeToken.hasMoreElements()) {
+ String tokenToRemove = appliedStereotypeToken.nextToken();
+ stereotypePropertiesList = stereotypePropertiesList.replaceAll("," + tokenToRemove.trim(), "");
+ stereotypePropertiesList = stereotypePropertiesList.replaceAll(tokenToRemove.trim(), "");
+ }
+
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper
+ .getStereotypesQNToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, AppliedStereotypeHelper
+ .getStereotypesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ AppliedStereotypeHelper.getAppliedStereotypePresentationKind(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ stereotypePropertiesList);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypeToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypeToDisplayCommand.java new file mode 100644 index 00000000000..10ed0e4c5e1 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/RemoveAppliedStereotypeToDisplayCommand.java @@ -0,0 +1,96 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class RemoveAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class RemoveAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private String stereotypeList;
+
+ /**
+ * the presnetation kind of applied stereotypes
+ */
+ private String appliedStereotypePresentationKind;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public RemoveAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypeList, String appliedStereotypepresentationKind) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypeList = stereotypeList;
+ this.appliedStereotypePresentationKind = appliedStereotypepresentationKind;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ String stereoList = AppliedStereotypeHelper.getStereotypesToDisplay(this.getObject());
+
+ StringTokenizer appliedStereotypeToken = new StringTokenizer(stereotypeList, ",");
+ while(appliedStereotypeToken.hasMoreElements()) {
+ String token = appliedStereotypeToken.nextToken();
+ stereoList = stereoList.replaceAll("," + token.trim(), "");
+ stereoList = stereoList.replaceAll(token.trim(), "");
+ }
+
+ String stereoListQN = AppliedStereotypeHelper.getStereotypesQNToDisplay(this.getObject());
+ appliedStereotypeToken = new StringTokenizer(stereotypeList, ",");
+ while(appliedStereotypeToken.hasMoreElements()) {
+ String token = appliedStereotypeToken.nextToken();
+ stereoListQN = stereoListQN.replaceAll("," + token.trim(), "");
+ stereoListQN = stereoListQN.replaceAll(token.trim(), "");
+ }
+
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, stereoListQN);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, stereoList);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ appliedStereotypePresentationKind);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypePropertiesLocalizationCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypePropertiesLocalizationCommand.java new file mode 100644 index 00000000000..425747ec1a8 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypePropertiesLocalizationCommand.java @@ -0,0 +1,75 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class SetAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class SetAppliedStereotypePropertiesLocalizationCommand extends CreateEAnnotationCommand {
+
+ /**
+ * the presnetation kind of applied stereotypes
+ */
+ private String appliedStereotypePropertiesKind;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public SetAppliedStereotypePropertiesLocalizationCommand(TransactionalEditingDomain domain, EModelElement object,
+ String appliedStereotypePropertiesKind) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.appliedStereotypePropertiesKind = appliedStereotypePropertiesKind;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper
+ .getStereotypesQNToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, AppliedStereotypeHelper
+ .getStereotypesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ AppliedStereotypeHelper.getAppliedStereotypePresentationKind(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ appliedStereotypePropertiesKind);
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypeToDisplayCommand.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypeToDisplayCommand.java new file mode 100644 index 00000000000..a406906e2c0 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/commands/SetAppliedStereotypeToDisplayCommand.java @@ -0,0 +1,79 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.commands;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
+import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
+
+/**
+ * The Class SetAppliedStereotypeToDisplayCommand used to set the list of applied stereotype to
+ * display
+ */
+public class SetAppliedStereotypeToDisplayCommand extends CreateEAnnotationCommand {
+
+ /** The qualified namedepht. */
+ private String stereotypeList;
+
+ /**
+ * the presnetation kind of applied stereotypes
+ */
+ private String appliedStereotypePresentationKind;
+
+ /**
+ * Instantiates a new sets the applied stereotype to display command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object
+ * @param stereotypeList
+ * the stereotype list
+ */
+ public SetAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, EModelElement object,
+ String stereotypeList, String appliedStereotypepresentationKind) {
+ super(domain, object, UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ this.stereotypeList = stereotypeList;
+ this.appliedStereotypePresentationKind = appliedStereotypepresentationKind;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ EAnnotation oldAnnotation = getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(oldAnnotation == null) {
+ oldAnnotation = createEAnnotation();
+ attachEannotation(oldAnnotation, getObject());
+ }
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST, AppliedStereotypeHelper
+ .getStereotypesQNToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST, stereotypeList);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND,
+ appliedStereotypePresentationKind);
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesToDisplay(getObject()));
+ replaceEntry(oldAnnotation, UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION,
+ AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(getObject()));
+
+ replaceEannotation(getObject().getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION),
+ getObject());
+
+ }
+
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/AppliedStereotypeHelper.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/AppliedStereotypeHelper.java new file mode 100644 index 00000000000..c3792b70575 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/AppliedStereotypeHelper.java @@ -0,0 +1,339 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Chokri Mraidha (CEA LIST) Chokri.Mraidha@cea.fr - Initial API and implementation
+ * Patrick Tessier (CEA LIST) Patrick.Tessier@cea.fr - modification
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.helper;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.uml.appearance.commands.AddAppliedQNStereotypeToDisplayCommand;
+import org.eclipse.papyrus.uml.appearance.commands.AddAppliedStereotypePropertiesToDisplayCommand;
+import org.eclipse.papyrus.uml.appearance.commands.AddAppliedStereotypeToDisplayCommand;
+import org.eclipse.papyrus.uml.appearance.commands.RemoveAppliedStereotypePropertiesToDisplayCommand;
+import org.eclipse.papyrus.uml.appearance.commands.RemoveAppliedStereotypeToDisplayCommand;
+import org.eclipse.papyrus.uml.appearance.commands.SetAppliedStereotypePropertiesLocalizationCommand;
+import org.eclipse.papyrus.uml.appearance.commands.SetAppliedStereotypeToDisplayCommand;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * The Class AppliedStereotypeHelper.
+ */
+public class AppliedStereotypeHelper {
+
+ /**
+ * get the list of stereotype to display from the eannotation.
+ *
+ * @param view
+ * the view
+ *
+ * @return the list of stereotypes to display separated by a comma. the applied stereotype to
+ * display is represented by the qualified name of the stereotype
+ */
+ public static String getStereotypesToDisplay(EModelElement view) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+
+ String stereotypesToDisplay = entries.get(UMLVisualInformationPapyrusConstant.STEREOTYPE_LIST);
+ if(stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return "";
+ }
+
+ /**
+ * Gets the applied stereotypes properties to display.
+ *
+ * @param view
+ * the view the view that displays the stereotyped element
+ *
+ * @return the applied stereotypes properties to display
+ */
+ public static String getAppliedStereotypesPropertiesToDisplay(EModelElement view) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+
+ String stereotypesToDisplay = entries.get(UMLVisualInformationPapyrusConstant.PROPERTY_STEREOTYPE_DISPLAY);
+ if(stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return "";
+ }
+
+ /**
+ * checks if the applied stereotypes properties have to be displayed.
+ *
+ * @param view
+ * the view the view that displays the stereotyped element
+ * @param location
+ * the location where the properties have to be displayed.
+ *
+ * @return <code>true</code> if the applied stereotypes properties have to display, <code>false</code> in other case
+ */
+ public static boolean hasAppliedStereotypesPropertiesToDisplay(EModelElement view, String location) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+
+ String placeToDisplay = entries.get(UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION);
+ if(placeToDisplay != null && placeToDisplay.equals(location)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Gets the applied stereotypes properties localization.
+ *
+ * @param view
+ * the view
+ *
+ * @return the applied stereotypes properties localization
+ */
+ public static String getAppliedStereotypesPropertiesLocalization(EModelElement view) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+
+ String displayLocalization = entries.get(UMLVisualInformationPapyrusConstant.STEREOTYPE_PROPERTY_LOCATION);
+ if(displayLocalization != null && !displayLocalization.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_COMPARTMENT_LOCATION)) {
+ return displayLocalization;
+ }
+ }
+
+ //CSS Value (TODO : Remove this dependency ; add an extension point)
+
+ // if(view instanceof UMLCustomStyle) {
+ // UMLCustomStyle cssElement = (UMLCustomStyle)view;
+ // return cssElement.getCSSDisplayPlace();
+ // }
+
+ return UMLVisualInformationPapyrusConstant.STEREOTYPE_COMPARTMENT_LOCATION;
+ }
+
+ /**
+ * get lhe list of stereotype to display with the qulifiedName.
+ *
+ * @param view
+ * the view of the uml element
+ *
+ * @return the list of applied stereotype to display withe their qualified name
+ */
+ public static String getStereotypesQNToDisplay(EModelElement view) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+
+ String stereotypesToDisplay = entries.get(UMLVisualInformationPapyrusConstant.STEREOTYPE_WITHQN_LIST);
+ if(stereotypesToDisplay != null) {
+ return stereotypesToDisplay;
+ }
+ }
+ return "";
+ }
+
+ /**
+ * return the kind of display of applied stereotype.
+ *
+ * @param view
+ * that contains the eannotation about the display
+ *
+ * @return VisualInformationPapyrusConstant.TEXT_ICON_STEREOTYPE_PRESENTATION,
+ * VisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION,
+ * VisualInformationPapyrusConstant.IMAGE_STEREOTYPE_PRESENTATION,
+ * VisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION,
+ * VisualInformationPapyrusConstant.STEREOTYPE_TEXT_VERTICAL_PRESENTATION
+ */
+ public static String getAppliedStereotypePresentationKind(EModelElement view) {
+ EAnnotation stereotypeDisplayKind = view.getEAnnotation(UMLVisualInformationPapyrusConstant.STEREOTYPE_ANNOTATION);
+ if(stereotypeDisplayKind != null) {
+ EMap<String, String> entries = stereotypeDisplayKind.getDetails();
+ String stereotypespresentationKind = entries.get(UMLVisualInformationPapyrusConstant.STEREOTYPE_PRESENTATION_KIND);
+ if(stereotypespresentationKind != null) {
+ if(!(stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION) || stereotypespresentationKind.equals(UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_VERTICAL_PRESENTATION))) {
+ return stereotypespresentationKind;
+ }
+ }
+ }
+
+ //CSS Value (TODO : Remove this dependency ; add an extension point)
+
+ // if(view instanceof UMLCustomStyle) {
+ // UMLCustomStyle cssElement = (UMLCustomStyle)view;
+ // String display = cssElement.getCSSStereotypeDisplay();
+ //
+ // if(display != null) {
+ // if(display.equals("Text")) {
+ // String alignment = cssElement.getCSSTextAlignment();
+ // if(alignment.equals("Vertical")) {
+ // return VisualInformationPapyrusConstant.STEREOTYPE_TEXT_VERTICAL_PRESENTATION;
+ // }
+ // return VisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION;
+ // } else if("Text and Icon".equals(display)) {
+ // return VisualInformationPapyrusConstant.TEXT_ICON_STEREOTYPE_PRESENTATION;
+ // } else if("Icon".equals(display)) {
+ // return VisualInformationPapyrusConstant.ICON_STEREOTYPE_PRESENTATION;
+ // } else if("Shape".equals(display)) {
+ // return VisualInformationPapyrusConstant.IMAGE_STEREOTYPE_PRESENTATION;
+ // }
+ // }
+ // }
+
+ return UMLVisualInformationPapyrusConstant.STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION;
+ }
+
+ /**
+ * Gets the applied.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeList
+ * the applied stereotype list
+ * @param presentationKind
+ * see {@link UMLVisualInformationPapyrusConstant} for the kind of presentation
+ *
+ * @return the applied
+ */
+ public static RecordingCommand getAppliedStereotypeToDisplayCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeList, String presentationKind) {
+ return new SetAppliedStereotypeToDisplayCommand(domain, view, appliedStereotypeList, presentationKind);
+ }
+
+ /**
+ * add new applied stereotypes to display withe the qualified name.
+ *
+ * @param domain
+ * the transactionnal edit domain
+ * @param view
+ * the emodel element that is the display of the uml element
+ * @param appliedStereotypeList
+ * the list of stereotype with qualified name to display
+ *
+ * @return the command to display it
+ */
+ public static RecordingCommand getAddAppliedStereotypeToDisplayWithQNCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeList) {
+ return new AddAppliedQNStereotypeToDisplayCommand(domain, view, appliedStereotypeList);
+ }
+
+ /**
+ * Gets the adds the applied stereotype command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToAdd
+ * the applied stereotype list to add
+ * @param presentationKind
+ * the presentation kind
+ *
+ * @return the adds the applied stereotype command
+ */
+ public static RecordingCommand getAddAppliedStereotypeCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeListToAdd, String presentationKind) {
+ return new AddAppliedStereotypeToDisplayCommand(domain, view, appliedStereotypeListToAdd, presentationKind);
+ }
+
+ /**
+ * Gets the adds the applied stereotype propertiescommand.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToAdd
+ * the applied stereotype properties list to add
+ *
+ * @return the adds the applied stereotype command
+ */
+ public static RecordingCommand getAddAppliedStereotypePropertiesCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeListToAdd) {
+ return new AddAppliedStereotypePropertiesToDisplayCommand(domain, view, appliedStereotypeListToAdd);
+ }
+
+ /**
+ * Gets the removes the applied stereotype command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToRemove
+ * the applied stereotype list to remove
+ * @param presentationKind
+ * the presentation kind
+ *
+ * @return the removes the applied stereotype command
+ */
+ public static RecordingCommand getRemoveAppliedStereotypeCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeListToRemove, String presentationKind) {
+ return new RemoveAppliedStereotypeToDisplayCommand(domain, view, appliedStereotypeListToRemove, presentationKind);
+ }
+
+ /**
+ * Gets the remove applied stereotype properties command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypeListToRemove
+ * the applied stereotype list to remove
+ *
+ * @return the removes the applied stereotype properties command
+ */
+ public static RecordingCommand getRemoveAppliedStereotypePropertiesCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypeListToRemove) {
+ return new RemoveAppliedStereotypePropertiesToDisplayCommand(domain, view, appliedStereotypeListToRemove);
+ }
+
+ /**
+ * Gets the sets the applied stereotype properties localization command.
+ *
+ * @param domain
+ * the domain
+ * @param view
+ * the view
+ * @param appliedStereotypePropertiesLocation
+ * the applied stereotype properties location
+ *
+ * @return the sets the applied stereotype properties localization command
+ */
+ public static RecordingCommand getSetAppliedStereotypePropertiesLocalizationCommand(TransactionalEditingDomain domain, EModelElement view, String appliedStereotypePropertiesLocation) {
+ return new SetAppliedStereotypePropertiesLocalizationCommand(domain, view, appliedStereotypePropertiesLocation);
+ }
+
+ /**
+ *
+ * @param model
+ * @param element
+ * @return
+ */
+ public static Stereotype getFirstDisplayedStereotype(EModelElement model, Element element) {
+ String stereotypesToDisplay = AppliedStereotypeHelper.getStereotypesToDisplay(model);
+ StringTokenizer tokenizer = new StringTokenizer(stereotypesToDisplay, ",");
+ if(tokenizer.hasMoreTokens()) {
+ String firstStereotypeName = tokenizer.nextToken();
+ Stereotype stereotype = element.getAppliedStereotype(firstStereotypeName);
+ return stereotype;
+ }
+ return null;
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/UMLVisualInformationPapyrusConstant.java b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/UMLVisualInformationPapyrusConstant.java new file mode 100644 index 00000000000..0f7ddadee74 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.appearance/src/org/eclipse/papyrus/uml/appearance/helper/UMLVisualInformationPapyrusConstant.java @@ -0,0 +1,117 @@ +/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.appearance.helper;
+
+//Refactoring 0.9: Some constants have been moved to VisualInformationPapyrusConstant in infra/gmfdiag/common
+public interface UMLVisualInformationPapyrusConstant {
+
+ public static String STEREOTYPE_ANNOTATION = "Stereotype_Annotation";
+
+ /**
+ * the kind of presentation for stereotype
+ */
+ public static String STEREOTYPE_PRESENTATION_KIND = "Stereotype_Presentation_Kind";
+
+ /**
+ * the list of stereotype to display
+ */
+ public static String STEREOTYPE_LIST = "StereotypeList";
+
+ /**
+ * the list of stereotype to display
+ */
+ public static String STEREOTYPE_WITHQN_LIST = "StereotypeWithQualifiedNameList";
+
+ /**
+ *
+ */
+ public static String TEXT_ICON_STEREOTYPE_PRESENTATION = "TextIconStereotype";
+
+ /**
+ *
+ */
+ public static String ICON_STEREOTYPE_PRESENTATION = "IconStereotype";
+
+ /**
+ *
+ */
+ public static String IMAGE_STEREOTYPE_PRESENTATION = "ImageStereotype";
+
+ /**
+ *
+ */
+ public static String STEREOTYPE_TEXT_HORIZONTAL_PRESENTATION = "HorizontalStereo";
+
+ /**
+ *
+ */
+ public static String STEREOTYPE_TEXT_VERTICAL_PRESENTATION = "VerticalStereo";
+
+ /**
+ *
+ */
+ public static String PROPERTY_STEREOTYPE_DISPLAY = "PropStereoDisplay";
+
+ /**
+ *
+ */
+ // @unused
+ public static String PROPERTY_STEREOTYPE_PROPERTY_VALUES_DISPLAY = "PropStereoPropValuesDisplay";
+
+ /**
+ *
+ */
+ // @unused
+ public static String OPAQUE_EXPRESSION_BODY_DISPLAY = "OpaqueExpressionBodyDisplay";
+
+ /**
+ * String represent the location of stereotype properties within a comment
+ */
+ public static String STEREOTYPE_COMMENT_LOCATION = "Comment";
+
+ /**
+ * String represent the location of stereotype properties within a compartment of a graph node
+ */
+ public static String STEREOTYPE_COMPARTMENT_LOCATION = "Compartment";
+
+ /**
+ * properties of applied stereotypes are enclose in braces
+ */
+ public static String STEREOTYPE_BRACE_LOCATION = "With brace";
+
+
+ public static String STEREOTYPE_PROPERTY_LOCATION = "StereotypePropertyLocation";
+
+ /**
+ * The Constant P_STEREOTYPE_NAME_DISPLAY_USER_CONTROLLED.
+ */
+ public final static String P_STEREOTYPE_NAME_DISPLAY_USER_CONTROLLED = "User Controlled";
+
+ /**
+ * The Constant P_STEREOTYPE_NAME_DISPLAY_UML_CONFORM.
+ */
+ public final static String P_STEREOTYPE_NAME_DISPLAY_UML_CONFORM = "UML Compatibility (lower case first letter - default)";
+
+ /**
+ * The Constant P_STEREOTYPE_NAME_APPEARANCE.
+ */
+ public static final String P_STEREOTYPE_NAME_APPEARANCE = "ProfileApplicationPreferenceConstants.stereotype.name.appearance";
+
+ /**
+ * Separator for stereotype properties list, i.e. the separator between each properties in the
+ * list. It is set to "<code>,</code>" by default
+ */
+ public static final String STEREOTYPE_PROPERTIES_LIST_SEPARATOR = ",";
+
+}
|