Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2015-03-16 10:57:12 +0000
committerFlorian Noyrit2015-03-16 10:57:12 +0000
commit865a46ea335528aa18e17c260d8496c1d7fde770 (patch)
tree2beabe7c33f374f12f2e82cc965c46f711b12913 /plugins/uml
parent377dcc49bb00df376e1e104ec604b6954e3c1940 (diff)
parent2a2b0d76d49927cef33ed0d3cc4a95c568610ad7 (diff)
downloadorg.eclipse.papyrus-865a46ea335528aa18e17c260d8496c1d7fde770.tar.gz
org.eclipse.papyrus-865a46ea335528aa18e17c260d8496c1d7fde770.tar.xz
org.eclipse.papyrus-865a46ea335528aa18e17c260d8496c1d7fde770.zip
Merge branch 'master' of ssh://fnoyrit@git.eclipse.org:29418/papyrus/org.eclipse.papyrus
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java68
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PropertyLabelEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/ExtendedPluginPaletteProvider.java1316
-rw-r--r--[-rwxr-xr-x]plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java40
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css398
6 files changed, 1115 insertions, 717 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java
index 431b0a4e4fa..159c9348ecb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/parser/custom/CallOperationActionParser.java
@@ -34,20 +34,7 @@ import org.eclipse.uml2.uml.UMLPackage;
*/
public class CallOperationActionParser extends MessageFormatParser implements ISemanticParser {
- /**
- * The String format for displaying an action with its name, class name and
- * operation name
- */
- private static final String NAME_CLASS_OPERATION_FORMAT = "%s\n(%s::%s)";
-
- /**
- * The String format for displaying an action with its name (same as
- * operation name) and class name
- */
- private static final String NAME_CLASS_FORMAT = "%s\n(%s::)";
-
- /** The String format for displaying an action name alone */
- private static final String NAME_FORMAT = "%s";
+ private static final UMLPackage eUML = UMLPackage.eINSTANCE;
public CallOperationActionParser(EAttribute[] features, EAttribute[] editableFeatures) {
super(features, editableFeatures);
@@ -74,7 +61,7 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent
* (java.lang.Object , int)
@@ -82,12 +69,12 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
@Override
public boolean isAffectingEvent(Object event, int flags) {
EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
+ return isAffectingFeature(feature);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
* getPrintString(org.eclipse .core.runtime.IAdaptable, int)
*/
@@ -98,7 +85,6 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
CallOperationAction action = (CallOperationAction) obj;
String name = action.getName();
String operation = "";
- String className = "";
if (name == null) {
name = "";
}
@@ -107,16 +93,10 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
if (operation == null) {
operation = "";
}
- if (action.getOperation().getClass_() != null) {
- className = action.getOperation().getClass_().getName();
- if (className == null) {
- className = "";
- }
- }
}
// name, operation and className are initialized with non null
// values
- return getPrintString(name, operation, className);
+ return getPrintString(name, operation);
}
return " ";
}
@@ -132,27 +112,13 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
* the name of the operation class or ""
* @return the string to print
*/
- private String getPrintString(String name, String operation, String className) {
- if ("".equals(name) || operation.equals(name)) {
- // operation is displayed instead of node name
- if ("".equals(className)) {
- return String.format(NAME_FORMAT, operation);
- } else {
- return String.format(NAME_CLASS_FORMAT, operation, className);
- }
- } else if ("".equals(operation) && "".equals(className)) {
- // name only is displayed
- return String.format(NAME_FORMAT, name);
- } else {
- // all information is displayed (even case when operation or class
- // name is "")
- return String.format(NAME_CLASS_OPERATION_FORMAT, name, className, operation);
- }
+ private String getPrintString(String name, String operation) {
+ return isEmpty(name) ? operation : name;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
* areSemanticElementsAffected (org.eclipse.emf.ecore.EObject,
* java.lang.Object)
@@ -160,12 +126,12 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
@Override
public boolean areSemanticElementsAffected(EObject listener, Object notification) {
EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
+ return isAffectingFeature(feature);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#
* getSemanticElementsBeingParsed (org.eclipse.emf.ecore.EObject)
*/
@@ -178,9 +144,6 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
Operation operation = action.getOperation();
if (operation != null) {
semanticElementsBeingParsed.add(operation);
- if (operation.getClass_() != null) {
- semanticElementsBeingParsed.add(operation.getClass_());
- }
}
}
return semanticElementsBeingParsed;
@@ -194,9 +157,12 @@ public class CallOperationActionParser extends MessageFormatParser implements IS
* the feature to test
* @return true if is valid, false otherwise
*/
- private boolean isValidFeature(EStructuralFeature feature) {
- boolean isName = UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- boolean isPrintedElement = UMLPackage.eINSTANCE.getCallOperationAction_Operation().equals(feature) || UMLPackage.eINSTANCE.getOperation_Class().equals(feature);
- return isName || isPrintedElement;
+ private boolean isAffectingFeature(EStructuralFeature feature) {
+ return eUML.getNamedElement_Name().equals(feature) || //
+ eUML.getCallOperationAction_Operation().equals(feature);
+ }
+
+ private static boolean isEmpty(String text) {
+ return text == null || text.length() == 0;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PropertyLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PropertyLabelEditPolicy.java
index a87b44962f0..e5fc159d70f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PropertyLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PropertyLabelEditPolicy.java
@@ -104,9 +104,9 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
if (object == null || property == null) {
return;
}
- if (notification.getFeature().equals(UMLPackage.eINSTANCE.getLiteralInteger_Value())) {
+ if (UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(notification.getFeature())) {
refreshDisplay();
- } else if (notification.getFeature().equals(UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value())) {
+ } else if (UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(notification.getFeature())) {
refreshDisplay();
}
if (object.equals(property)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/ExtendedPluginPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/ExtendedPluginPaletteProvider.java
index 9f7e8c328f9..7e4edbdb17f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/ExtendedPluginPaletteProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/ExtendedPluginPaletteProvider.java
@@ -1,653 +1,663 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.service;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.gef.Tool;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.PaletteSeparator;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.ContributeToPaletteOperation;
-import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.PaletteToolEntry;
-import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider;
-import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
-import org.eclipse.gmf.runtime.gef.ui.internal.palette.PaletteStack;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Activator;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ChildConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.DrawerConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.IconDescriptor;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.LeafConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationPackage;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.SeparatorConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.StackConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedConnectionToolEntry;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedCreationToolEntry;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedPaletteDrawer;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.IElementTypesBasedTool;
-import org.eclipse.papyrus.uml.diagram.paletteconfiguration.util.PaletteconfigurationSwitch;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Palette provider with enhanced elements types
- */
-public class ExtendedPluginPaletteProvider extends AbstractProvider implements IPaletteProvider, IProfileDependantPaletteProvider {
-
- /** name of the type */
- public static final String TYPE_NAME = "testSpecializationTypeName";
-
- /** palette factory */
- protected ExtendedPaletteFactory paletteFactory = new ExtendedPaletteFactory();
-
- /** path to the palette configuration model in the bundle */
- protected static final String PATH = "path";
-
- /** name of the attribute: id of the palette */
- private static final String ID = "ID";
-
- /** id of the plugin declaring the extension */
- protected String contributorID;
-
- /** unique identifier for this palette contribution */
- protected String paletteID;
-
- /** contributions to the palette */
- protected List<PaletteConfiguration> contributions;
-
- /** map for toolID => extended element type */
- protected Map<String, IElementTypesBasedTool> mapToolId2Entries = new HashMap<String, IElementTypesBasedTool>();
-
- /** default icon for tools */
- protected static final ImageDescriptor DEFAULT_TOOL_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/tool.gif");
-
- /** default icon for stacks */
- protected static final ImageDescriptor DEFAULT_STACK_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/stack.gif");
-
- /** default icon for drawers */
- protected static final ImageDescriptor DEFAULT_DRAWER_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/drawer.gif");
-
- /** cached list of required profiles for this palette to be shown. this will be <code>null</code> until initialized */
- protected Collection<String> requiredProfiles = null;
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean provides(IOperation operation) {
- if (operation instanceof ContributeToPaletteOperation) {
- IEditorPart part = ((ContributeToPaletteOperation) operation).getEditor();
- // check this can be a papyrus one. Otherwise, there should be no contribution
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getRequiredProfiles() {
- if (contributions == null || contributions.size() == 0) {
- return Collections.emptyList();
- }
- if (requiredProfiles == null) {
- requiredProfiles = new HashSet<String>();
-
- // compute. should be at least an empty list as soon as it has been initialized
- for (PaletteConfiguration configuration : contributions) {
- Collection<String> profiles = PaletteConfigurationUtils.getRequiredProfiles(configuration);
- if (profiles != null && profiles.size() > 0) {
- requiredProfiles.addAll(profiles);
- }
- }
- }
- return requiredProfiles;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void contributeToPalette(IEditorPart editor, Object content, PaletteRoot root, Map predefinedEntries) {
- // for each element in the contribution list, create drawers/tools/stacks/etc.
- if (contributions == null || contributions.size() == 0) {
- return;
- }
-
- // work for each configuration
- for (PaletteConfiguration configuration : contributions) {
- List<DrawerConfiguration> drawerConfigurations = configuration.getDrawerConfigurations();
- if (drawerConfigurations != null && drawerConfigurations.size() > 0) {
- for (DrawerConfiguration drawerConfiguration : drawerConfigurations) {
- generateDrawer(root, drawerConfiguration, predefinedEntries);
- }
- }
- }
- }
-
- /**
- * Generates the drawer and its content from its configuration
- *
- * @param root
- * the root container of the palette
- * @param drawerConfiguration
- * the configuration that manages the drawer
- * @param predefinedEntries
- * predefined existing entries
- */
- protected PaletteDrawer generateDrawer(PaletteRoot root, DrawerConfiguration drawerConfiguration, Map predefinedEntries) {
- String id = drawerConfiguration.getId();
- // retrieve drawer or create one if necessary
- PaletteDrawer drawer = retrieveExistingEntry(predefinedEntries, id, PaletteDrawer.class);
- if (drawer == null) {
- String label = drawerConfiguration.getLabel();
- drawer = new ExtendedPaletteDrawer(label, id);
- // complete entry: description and icon
- completeEntry(drawerConfiguration, drawer);
- predefinedEntries.put(id, drawer);
- root.add(drawer);
- }
-
- generateContent(drawer, drawerConfiguration, predefinedEntries);
-
- return drawer;
- }
-
- /**
- * Completes the entry with information like description, icon, etc.
- *
- * @param configuration
- * the configuration of the entry
- * @param entry
- * the entry to customize
- */
- protected void completeEntry(Configuration configuration, PaletteEntry entry) {
- // description
- entry.setDescription(configuration.getDescription());
-
- // icon. If it is not set, the tool should use the icon of the type created by the tool
- ImageDescriptor imageDescriptor = null;
- IconDescriptor iconDescriptor = configuration.getIcon();
- if (iconDescriptor != null) {
- String bundleID = iconDescriptor.getPluginID();
- if (bundleID == null) {
- // by default, try to load images in the plugin that declares the configuration
- bundleID = contributorID;
- }
- String iconPath = iconDescriptor.getIconPath();
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(bundleID, iconPath);
- }
-
- if (imageDescriptor == null && configuration instanceof ToolConfiguration) {
- ToolConfiguration toolConfiguration = ((ToolConfiguration) configuration);
- // FIXME retrieve icon from the element type
- }
-
- // retrieve the default icon for drawers, stacks or tools.
- if (imageDescriptor == null) {
- imageDescriptor = new PaletteconfigurationSwitch<ImageDescriptor>() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ImageDescriptor caseDrawerConfiguration(DrawerConfiguration object) {
- return ExtendedPluginPaletteProvider.DEFAULT_DRAWER_IMAGE_DESCRIPTOR;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ImageDescriptor caseToolConfiguration(ToolConfiguration object) {
- return ExtendedPluginPaletteProvider.DEFAULT_TOOL_IMAGE_DESCRIPTOR;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ImageDescriptor caseStackConfiguration(StackConfiguration object) {
- return ExtendedPluginPaletteProvider.DEFAULT_STACK_IMAGE_DESCRIPTOR;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ImageDescriptor defaultCase(org.eclipse.emf.ecore.EObject object) {
- return null;
- }
- }.doSwitch(configuration);
- }
-
- if (imageDescriptor != null) {
- entry.setLargeIcon(imageDescriptor);
- entry.setSmallIcon(imageDescriptor);
- }
- }
-
- /**
- * Generates the content for a palette drawer
- *
- * @param drawer
- * the drawer to complete
- * @param drawerConfiguration
- * the configuration of the drawer
- * @param predefinedEntries
- * predefined existing entries
- */
- protected void generateContent(PaletteDrawer drawer, DrawerConfiguration drawerConfiguration, Map predefinedEntries) {
- for (ChildConfiguration configuration : drawerConfiguration.getOwnedConfigurations()) {
- if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getStackConfiguration())) {
- generateStack(drawer, (StackConfiguration) configuration, predefinedEntries);
- } else if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getToolConfiguration())) {
- generateTool(drawer, (ToolConfiguration) configuration, predefinedEntries);
- } else if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getSeparatorConfiguration())) {
- generateSeparator(drawer, (SeparatorConfiguration) configuration, predefinedEntries);
- }
- }
- }
-
- /**
- * Generates the tool from its configuration and container
- *
- * @param container
- * the container in which the tool should be added
- * @param configuration
- * the configuration of the tool entry
- * @param predefinedEntries
- * predefined existing entries
- */
- protected CombinedTemplateCreationEntry generateTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
- switch (configuration.getKind()) {
- case CONNECTION_TOOL:
- return generateConnectionTool(container, configuration, predefinedEntries);
- case CREATION_TOOL:
- return generateCreationTool(container, configuration, predefinedEntries);
- }
- return null;
- }
-
- /**
- * Generates the connection tool from its configuration and container
- *
- * @param container
- * the container in which the tool should be added
- * @param configuration
- * the configuration of the tool entry
- * @param predefinedEntries
- * predefined existing entries
- */
- protected CombinedTemplateCreationEntry generateConnectionTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
- String toolID = configuration.getId();
- CombinedTemplateCreationEntry toolEntry = retrieveExistingEntry(predefinedEntries, toolID, CombinedTemplateCreationEntry.class);
-
- if (toolEntry == null) {
- // create a new one from the configuration
- String label = configuration.getLabel();
- // create icon descriptor
- toolEntry = new ExtendedConnectionToolEntry(toolID, label, paletteFactory, configuration.getElementDescriptors());
- completeEntry(configuration, toolEntry);
- container.add(toolEntry);
- // register the tool in the tool predefined entries
- predefinedEntries.put(toolID, toolEntry);
- mapToolId2Entries.put(toolID, (ExtendedConnectionToolEntry) toolEntry);
- }
-
- return toolEntry;
- }
-
- /**
- * Generates the creation tool from its configuration and container
- *
- * @param container
- * the container in which the tool should be added
- * @param configuration
- * the configuration of the tool entry
- * @param predefinedEntries
- * predefined existing entries
- */
- protected CombinedTemplateCreationEntry generateCreationTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
- String toolID = configuration.getId();
- CombinedTemplateCreationEntry toolEntry = retrieveExistingEntry(predefinedEntries, toolID, CombinedTemplateCreationEntry.class);
-
- if (toolEntry == null) {
- // create a new one from the configuration
- String label = configuration.getLabel();
- // create icon descriptor
- toolEntry = new ExtendedCreationToolEntry(toolID, label, paletteFactory, configuration.getElementDescriptors());
- completeEntry(configuration, toolEntry);
- container.add(toolEntry);
- // register the tool in the tool predefined entries
- predefinedEntries.put(toolID, toolEntry);
- mapToolId2Entries.put(toolID, (ExtendedCreationToolEntry) toolEntry);
- }
-
- return toolEntry;
- }
-
-
- /**
- * Try to retrieve a tool entry in the list of predefined entries
- *
- * @param toolID
- * id of the tool to look for
- * @param predefinedEntries
- * predefined existing entries
- * @return the tool found or <code>null</code>
- */
- protected PaletteToolEntry retrieveTool(String toolID, Map predefinedEntries) {
- Object value = predefinedEntries.get(toolID);
- if (value instanceof PaletteToolEntry) {
- return ((PaletteToolEntry) value);
- }
- return null;
- }
-
- /**
- * Generates the stack and its content from its configuration and container
- *
- * @param container
- * the container in which the stack should be added
- * @param configuration
- * the configuration of the stack
- * @param predefinedEntries
- * predefined existing entries
- */
- @SuppressWarnings("restriction")
- protected PaletteStack generateStack(PaletteContainer container, StackConfiguration configuration, Map predefinedEntries) {
- String stackID = configuration.getId();
- PaletteStack stack = retrieveExistingEntry(predefinedEntries, stackID, PaletteStack.class);
-
- if (stack == null) {
- // create a new one from the configuration
- String label = configuration.getLabel();
- String description = configuration.getDescription();
- // create icon descriptor
- stack = new PaletteStack(stackID, label, description, DEFAULT_STACK_IMAGE_DESCRIPTOR);
- completeEntry(configuration, stack); // seems to be not useful, as the constructor has all informations
- predefinedEntries.put(stackID, stack);
- container.add(stack);
- }
-
- // generate the nodes of the stack
- for (LeafConfiguration leafConfiguration : configuration.getOwnedConfigurations()) {
- if (leafConfiguration instanceof SeparatorConfiguration) {
- generateSeparator(stack, (SeparatorConfiguration) leafConfiguration, predefinedEntries);
- } else if (leafConfiguration instanceof ToolConfiguration) {
- generateTool(stack, (ToolConfiguration) leafConfiguration, predefinedEntries);
- }
- }
-
- return stack;
- }
-
- /**
- * Generates a {@link PaletteSeparator}, adds it to a container and returns it
- *
- * @param container
- * the container where to add the created separator
- * @param leafConfiguration
- * the configuration of the element to create
- * @param predefinedEntries
- * the predefined entries (unused here)
- * @return the created separator
- */
- protected PaletteSeparator generateSeparator(PaletteContainer container, SeparatorConfiguration leafConfiguration, Map predefinedEntries) {
- PaletteSeparator separator = new PaletteSeparator(leafConfiguration.getId());
- container.add(separator);
- return separator;
- }
-
- /**
- * Retrieve an existing drawer from the current root node
- *
- * @param predefinedEntries
- * the currently existing palette entries
- * @param id
- * the id of the drawer to retrieve
- * @param entryClass
- * the type of element to retrieve
- * @return the drawer found or <code>null</code> if no drawer was retrieved
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected <T extends PaletteEntry> T retrieveExistingEntry(Map predefinedEntries, String id, Class<T> elementClass) {
- Object value = predefinedEntries.get(id);
- if (value == null) {
- return null;
- }
- if (elementClass.isAssignableFrom(value.getClass())) {
- return (T) value;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setContributions(IConfigurationElement configElement) {
- // retrieve the model file
- contributorID = configElement.getNamespaceIdentifier();
- paletteID = configElement.getAttribute(ID);
- String path = configElement.getAttribute(PATH);
-
- if (paletteID == null) {
- Activator.log.error("Impossible to find the palette identifier for contribution " + configElement.getValue(), null);
- contributions = Collections.emptyList();
- return;
- }
- if (path == null) {
- Activator.log.error("Impossible to find the path for contribution " + configElement.getValue(), null);
- contributions = Collections.emptyList();
- return;
- }
-
- Bundle bundle = Platform.getBundle(contributorID);
- if (bundle == null) {
- Activator.log.error("Impossible to find the bundle with ID: " + contributorID, null);
- contributions = Collections.emptyList();
- return;
- }
-
- try {
- contributions = loadConfigurationModel(bundle, path);
- } catch (FileNotFoundException e) {
- Activator.log.error(e);
- contributions = Collections.emptyList();
- } catch (IOException e) {
- Activator.log.error(e);
- contributions = Collections.emptyList();
- }
- }
-
- /**
- * Loads and returns the model, given the bundle and path of the model file.
- *
- * @param bundle
- * the id of the bundle
- * @param path
- * the path to the file in the bundle
- */
- protected List<PaletteConfiguration> loadConfigurationModel(Bundle bundle, String path) throws FileNotFoundException, IOException {
- // stores the bundle in which the resource is located.
- // warning: in case of fragments, the contributor id can the the plugin, but the file can be localized in the fragment
- // In this case, the real bundle used to load the file is the fragment bundle...
- // String bundleId = null;
-
- // creates a resource set that will load the configuration
- ResourceSet resourceSet = new ResourceSetImpl();
-
- Resource resource = loadResourceFromPreferences(resourceSet);
-
- if (resource == null) {
- resource = loadResourceFromPlugin(bundle, path, resourceSet);
- }
-
- if (resource == null) {
- throw new FileNotFoundException("Loading palette configuration... Impossible to find a resource for path; " + path + " for bundle: " + bundle);
- }
- resource.load(Collections.emptyMap());
- if (resource.getContents().size() > 0) {
-
- return new ArrayList<PaletteConfiguration>(EcoreUtil.<PaletteConfiguration> getObjectsByType(resource.getContents(), PaletteconfigurationPackage.eINSTANCE.getPaletteConfiguration()));
- }
- return Collections.emptyList();
- }
-
- /**
- * Returns the id of the bundle that declares this provider, can be null if not yet initialized
- *
- * @return the id of the bundle, or <code>null</code>
- */
- protected String getContributorID() {
- return contributorID;
- }
-
- /**
- * Returns the list of contribution for this provider
- *
- * @return the list of contribution for this provider
- */
- public List<PaletteConfiguration> getContributions() {
- return contributions;
- }
-
- /**
- * Returns the resource used for the configuration.
- * <P>
- * It checks in the preferences area, then in the plugin area
- * </P>
- */
- protected Resource loadResourceFromPreferences(ResourceSet resourceSet) {
- Resource resource = null;
- // look in preference area
- String path = PapyrusPalettePreferences.getPaletteRedefinition(paletteID);
- if (path != null) {
- // read in preferences area of diagram common! Thus, it can be accessed from the common plugin...
- IPath resourcePath = org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getStateLocation().append(path);
- URI uri = URI.createFileURI(resourcePath.toOSString());
- if (uri != null && uri.isFile()) {
- resource = resourceSet.createResource(uri);
- if (resource != null) {
- return resource;
- }
- }
-
- }
- return resource;
- }
-
- /**
- * Loads the resource from the plugin area
- *
- * @return the resource to load.
- * @throws FileNotFoundException
- */
- protected Resource loadResourceFromPlugin(Bundle bundle, String path, ResourceSet resourceSet) throws FileNotFoundException {
- Resource resource = null;
- String bundleId = null;
- // try to load the resource in the fragments of the bundle, then the bundle itself.
- URL entry = null;
- // try in fragments...
- Bundle[] fragments = Platform.getFragments(bundle);
- if (fragments != null) {
- for (Bundle fragment : fragments) {
- entry = fragment.getEntry(path);
- if (entry != null) {
- bundleId = fragment.getSymbolicName();
- continue;
- }
- }
- }
- // look now in the bundle itself.
- if (entry == null) {
- entry = bundle.getEntry(path);
- // no entry was found in the children fragments, look in the bundle itself
- if (entry == null) {
- throw new FileNotFoundException("Loading palette configuration... Impossible to find a resource for path; " + path + " for bundle: " + bundle);
- } else {
- bundleId = bundle.getSymbolicName();
- }
- }
-
- resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + bundleId + "/" + path, true));
- return resource;
- }
-
-
- /**
- * Loads the resource from the plugin area
- *
- * @return the resource to load.
- * @throws FileNotFoundException
- */
- protected Resource loadResourceFromWorkspace(String path, ResourceSet resourceSet) {
- Resource resource = resourceSet.createResource(URI.createPlatformResourceURI(path, true));
- return resource;
- }
-
- /**
- * factory used to create new tools for the extended palette provider. It will find or create a new element type for each tool which has extended
- * features.
- */
- public class ExtendedPaletteFactory extends PaletteFactory.Adapter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Tool createTool(String toolId) {
- IElementTypesBasedTool toolEntry = mapToolId2Entries.get(toolId);
- if (toolEntry instanceof ExtendedCreationToolEntry) {
- return new AspectUnspecifiedTypeCreationTool(((ExtendedCreationToolEntry) toolEntry).getElementTypes());
- } else if (toolEntry instanceof ExtendedConnectionToolEntry) {
- return new AspectUnspecifiedTypeConnectionTool(((ExtendedConnectionToolEntry) toolEntry).getElementTypes());
- }
- Activator.log.warn("Impossible to create a tool for the given tool id: " + toolId + ". Tool Entry found was :" + toolEntry);
- return null;
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.common.service;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.PaletteSeparator;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.ContributeToPaletteOperation;
+import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.PaletteToolEntry;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
+import org.eclipse.gmf.runtime.gef.ui.internal.palette.PaletteStack;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.uml.diagram.common.part.PapyrusPalettePreferences;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Activator;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ChildConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.Configuration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.DrawerConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.IconDescriptor;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.LeafConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationPackage;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.SeparatorConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.StackConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ToolConfiguration;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedConnectionToolEntry;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedCreationToolEntry;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.ExtendedPaletteDrawer;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.IElementTypesBasedTool;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.util.PaletteconfigurationSwitch;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * Palette provider with enhanced elements types
+ */
+public class ExtendedPluginPaletteProvider extends AbstractProvider implements IPaletteProvider, IProfileDependantPaletteProvider {
+
+ /** name of the type */
+ public static final String TYPE_NAME = "testSpecializationTypeName";
+
+ /** palette factory */
+ protected ExtendedPaletteFactory paletteFactory = new ExtendedPaletteFactory();
+
+ /** path to the palette configuration model in the bundle */
+ protected static final String PATH = "path";
+
+ /** name of the attribute: id of the palette */
+ private static final String ID = "ID";
+
+ /** id of the plugin declaring the extension */
+ protected String contributorID;
+
+ /** unique identifier for this palette contribution */
+ protected String paletteID;
+
+ /** contributions to the palette */
+ protected List<PaletteConfiguration> contributions;
+
+ /** map for toolID => extended element type */
+ protected Map<String, IElementTypesBasedTool> mapToolId2Entries = new HashMap<String, IElementTypesBasedTool>();
+
+ /** default icon for tools */
+ protected static final ImageDescriptor DEFAULT_TOOL_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/tool.gif");
+
+ /** default icon for stacks */
+ protected static final ImageDescriptor DEFAULT_STACK_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/stack.gif");
+
+ /** default icon for drawers */
+ protected static final ImageDescriptor DEFAULT_DRAWER_IMAGE_DESCRIPTOR = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/drawer.gif");
+
+ /** cached list of required profiles for this palette to be shown. this will be <code>null</code> until initialized */
+ protected Collection<String> requiredProfiles = null;
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(IOperation operation) {
+ if (operation instanceof ContributeToPaletteOperation) {
+ IEditorPart part = ((ContributeToPaletteOperation) operation).getEditor();
+ // check this can be a papyrus one. Otherwise, there should be no contribution
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Collection<String> getRequiredProfiles() {
+ if (contributions == null || contributions.size() == 0) {
+ return Collections.emptyList();
+ }
+ if (requiredProfiles == null) {
+ requiredProfiles = new HashSet<String>();
+
+ // compute. should be at least an empty list as soon as it has been initialized
+ for (PaletteConfiguration configuration : contributions) {
+ Collection<String> profiles = PaletteConfigurationUtils.getRequiredProfiles(configuration);
+ if (profiles != null && profiles.size() > 0) {
+ requiredProfiles.addAll(profiles);
+ }
+ }
+ }
+ return requiredProfiles;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contributeToPalette(IEditorPart editor, Object content, PaletteRoot root, Map predefinedEntries) {
+ // for each element in the contribution list, create drawers/tools/stacks/etc.
+ if (contributions == null || contributions.size() == 0) {
+ return;
+ }
+
+ // work for each configuration
+ for (PaletteConfiguration configuration : contributions) {
+ List<DrawerConfiguration> drawerConfigurations = configuration.getDrawerConfigurations();
+ if (drawerConfigurations != null && drawerConfigurations.size() > 0) {
+ for (DrawerConfiguration drawerConfiguration : drawerConfigurations) {
+ generateDrawer(root, drawerConfiguration, predefinedEntries);
+ }
+ }
+ }
+ }
+
+ /**
+ * Generates the drawer and its content from its configuration
+ *
+ * @param root
+ * the root container of the palette
+ * @param drawerConfiguration
+ * the configuration that manages the drawer
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ protected PaletteDrawer generateDrawer(PaletteRoot root, DrawerConfiguration drawerConfiguration, Map predefinedEntries) {
+ String id = drawerConfiguration.getId();
+ // retrieve drawer or create one if necessary
+ PaletteDrawer drawer = retrieveExistingEntry(predefinedEntries, id, PaletteDrawer.class);
+ if (drawer == null) {
+ String label = drawerConfiguration.getLabel();
+ drawer = new ExtendedPaletteDrawer(label, id);
+ // complete entry: description and icon
+ completeEntry(drawerConfiguration, drawer);
+ predefinedEntries.put(id, drawer);
+ root.add(drawer);
+ }
+
+ generateContent(drawer, drawerConfiguration, predefinedEntries);
+
+ return drawer;
+ }
+
+ /**
+ * Completes the entry with information like description, icon, etc.
+ *
+ * @param configuration
+ * the configuration of the entry
+ * @param entry
+ * the entry to customize
+ */
+ protected void completeEntry(Configuration configuration, PaletteEntry entry) {
+ // description
+ entry.setDescription(configuration.getDescription());
+
+ // icon. If it is not set, the tool should use the icon of the type created by the tool
+ ImageDescriptor imageDescriptor = null;
+ IconDescriptor iconDescriptor = configuration.getIcon();
+ if (iconDescriptor != null) {
+ String bundleID = iconDescriptor.getPluginID();
+ if (bundleID == null) {
+ // by default, try to load images in the plugin that declares the configuration
+ bundleID = contributorID;
+ }
+ String iconPath = iconDescriptor.getIconPath();
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(bundleID, iconPath);
+ }
+
+ if (imageDescriptor == null && configuration instanceof ToolConfiguration) {
+ ToolConfiguration toolConfiguration = ((ToolConfiguration) configuration);
+ // FIXME retrieve icon from the element type
+ }
+
+ // retrieve the default icon for drawers, stacks or tools.
+ if (imageDescriptor == null) {
+ imageDescriptor = new PaletteconfigurationSwitch<ImageDescriptor>() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ImageDescriptor caseDrawerConfiguration(DrawerConfiguration object) {
+ return ExtendedPluginPaletteProvider.DEFAULT_DRAWER_IMAGE_DESCRIPTOR;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ImageDescriptor caseToolConfiguration(ToolConfiguration object) {
+ return ExtendedPluginPaletteProvider.DEFAULT_TOOL_IMAGE_DESCRIPTOR;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ImageDescriptor caseStackConfiguration(StackConfiguration object) {
+ return ExtendedPluginPaletteProvider.DEFAULT_STACK_IMAGE_DESCRIPTOR;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ImageDescriptor defaultCase(org.eclipse.emf.ecore.EObject object) {
+ return null;
+ }
+ }.doSwitch(configuration);
+ }
+
+ if (imageDescriptor != null) {
+ entry.setLargeIcon(imageDescriptor);
+ entry.setSmallIcon(imageDescriptor);
+ }
+ }
+
+ /**
+ * Generates the content for a palette drawer
+ *
+ * @param drawer
+ * the drawer to complete
+ * @param drawerConfiguration
+ * the configuration of the drawer
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ protected void generateContent(PaletteDrawer drawer, DrawerConfiguration drawerConfiguration, Map predefinedEntries) {
+ for (ChildConfiguration configuration : drawerConfiguration.getOwnedConfigurations()) {
+ if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getStackConfiguration())) {
+ generateStack(drawer, (StackConfiguration) configuration, predefinedEntries);
+ } else if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getToolConfiguration())) {
+ generateTool(drawer, (ToolConfiguration) configuration, predefinedEntries);
+ } else if (configuration.eClass().equals(PaletteconfigurationPackage.eINSTANCE.getSeparatorConfiguration())) {
+ generateSeparator(drawer, (SeparatorConfiguration) configuration, predefinedEntries);
+ }
+ }
+ }
+
+ /**
+ * Generates the tool from its configuration and container
+ *
+ * @param container
+ * the container in which the tool should be added
+ * @param configuration
+ * the configuration of the tool entry
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ protected CombinedTemplateCreationEntry generateTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
+ switch (configuration.getKind()) {
+ case CONNECTION_TOOL:
+ return generateConnectionTool(container, configuration, predefinedEntries);
+ case CREATION_TOOL:
+ return generateCreationTool(container, configuration, predefinedEntries);
+ }
+ return null;
+ }
+
+ /**
+ * Generates the connection tool from its configuration and container
+ *
+ * @param container
+ * the container in which the tool should be added
+ * @param configuration
+ * the configuration of the tool entry
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ protected CombinedTemplateCreationEntry generateConnectionTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
+ String toolID = configuration.getId();
+ CombinedTemplateCreationEntry toolEntry = retrieveExistingEntry(predefinedEntries, toolID, CombinedTemplateCreationEntry.class);
+
+ if (toolEntry == null) {
+ // create a new one from the configuration
+ String label = configuration.getLabel();
+ // create icon descriptor
+ toolEntry = new ExtendedConnectionToolEntry(toolID, label, paletteFactory, configuration.getElementDescriptors());
+ completeEntry(configuration, toolEntry);
+ container.add(toolEntry);
+ // register the tool in the tool predefined entries
+ predefinedEntries.put(toolID, toolEntry);
+ mapToolId2Entries.put(toolID, (ExtendedConnectionToolEntry) toolEntry);
+ }
+
+ return toolEntry;
+ }
+
+ /**
+ * Generates the creation tool from its configuration and container
+ *
+ * @param container
+ * the container in which the tool should be added
+ * @param configuration
+ * the configuration of the tool entry
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ protected CombinedTemplateCreationEntry generateCreationTool(PaletteContainer container, ToolConfiguration configuration, Map predefinedEntries) {
+ String toolID = configuration.getId();
+ CombinedTemplateCreationEntry toolEntry = retrieveExistingEntry(predefinedEntries, toolID, CombinedTemplateCreationEntry.class);
+
+ if (toolEntry == null) {
+ // create a new one from the configuration
+ String label = configuration.getLabel();
+ // create icon descriptor
+ toolEntry = new ExtendedCreationToolEntry(toolID, label, paletteFactory, configuration.getElementDescriptors());
+ completeEntry(configuration, toolEntry);
+ container.add(toolEntry);
+ // register the tool in the tool predefined entries
+ predefinedEntries.put(toolID, toolEntry);
+ mapToolId2Entries.put(toolID, (ExtendedCreationToolEntry) toolEntry);
+ }
+
+ return toolEntry;
+ }
+
+
+ /**
+ * Try to retrieve a tool entry in the list of predefined entries
+ *
+ * @param toolID
+ * id of the tool to look for
+ * @param predefinedEntries
+ * predefined existing entries
+ * @return the tool found or <code>null</code>
+ */
+ protected PaletteToolEntry retrieveTool(String toolID, Map predefinedEntries) {
+ Object value = predefinedEntries.get(toolID);
+ if (value instanceof PaletteToolEntry) {
+ return ((PaletteToolEntry) value);
+ }
+ return null;
+ }
+
+ /**
+ * Generates the stack and its content from its configuration and container
+ *
+ * @param container
+ * the container in which the stack should be added
+ * @param configuration
+ * the configuration of the stack
+ * @param predefinedEntries
+ * predefined existing entries
+ */
+ @SuppressWarnings("restriction")
+ protected PaletteStack generateStack(PaletteContainer container, StackConfiguration configuration, Map predefinedEntries) {
+ String stackID = configuration.getId();
+ PaletteStack stack = retrieveExistingEntry(predefinedEntries, stackID, PaletteStack.class);
+
+ if (stack == null) {
+ // create a new one from the configuration
+ String label = configuration.getLabel();
+ String description = configuration.getDescription();
+ // create icon descriptor
+ stack = new PaletteStack(stackID, label, description, DEFAULT_STACK_IMAGE_DESCRIPTOR);
+ completeEntry(configuration, stack); // seems to be not useful, as the constructor has all informations
+ predefinedEntries.put(stackID, stack);
+ container.add(stack);
+ }
+
+ // generate the nodes of the stack
+ for (LeafConfiguration leafConfiguration : configuration.getOwnedConfigurations()) {
+ if (leafConfiguration instanceof SeparatorConfiguration) {
+ generateSeparator(stack, (SeparatorConfiguration) leafConfiguration, predefinedEntries);
+ } else if (leafConfiguration instanceof ToolConfiguration) {
+ generateTool(stack, (ToolConfiguration) leafConfiguration, predefinedEntries);
+ }
+ }
+
+ return stack;
+ }
+
+ /**
+ * Generates a {@link PaletteSeparator}, adds it to a container and returns it
+ *
+ * @param container
+ * the container where to add the created separator
+ * @param leafConfiguration
+ * the configuration of the element to create
+ * @param predefinedEntries
+ * the predefined entries (unused here)
+ * @return the created separator
+ */
+ protected PaletteSeparator generateSeparator(PaletteContainer container, SeparatorConfiguration leafConfiguration, Map predefinedEntries) {
+ PaletteSeparator separator = new PaletteSeparator(leafConfiguration.getId());
+ container.add(separator);
+ return separator;
+ }
+
+ /**
+ * Retrieve an existing drawer from the current root node
+ *
+ * @param predefinedEntries
+ * the currently existing palette entries
+ * @param id
+ * the id of the drawer to retrieve
+ * @param entryClass
+ * the type of element to retrieve
+ * @return the drawer found or <code>null</code> if no drawer was retrieved
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected <T extends PaletteEntry> T retrieveExistingEntry(Map predefinedEntries, String id, Class<T> elementClass) {
+ Object value = predefinedEntries.get(id);
+ if (value == null) {
+ return null;
+ }
+ if (elementClass.isAssignableFrom(value.getClass())) {
+ return (T) value;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setContributions(IConfigurationElement configElement) {
+ // retrieve the model file
+ contributorID = configElement.getNamespaceIdentifier();
+ paletteID = configElement.getAttribute(ID);
+ String path = configElement.getAttribute(PATH);
+
+ if (paletteID == null) {
+ Activator.log.error("Impossible to find the palette identifier for contribution " + configElement.getValue(), null);
+ contributions = Collections.emptyList();
+ return;
+ }
+ if (path == null) {
+ Activator.log.error("Impossible to find the path for contribution " + configElement.getValue(), null);
+ contributions = Collections.emptyList();
+ return;
+ }
+
+ Bundle bundle = Platform.getBundle(contributorID);
+ if (bundle == null) {
+ Activator.log.error("Impossible to find the bundle with ID: " + contributorID, null);
+ contributions = Collections.emptyList();
+ return;
+ }
+
+ try {
+ contributions = loadConfigurationModel(bundle, path);
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ contributions = Collections.emptyList();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ contributions = Collections.emptyList();
+ }
+ }
+
+ /**
+ * Loads and returns the model, given the bundle and path of the model file.
+ *
+ * @param bundle
+ * the id of the bundle
+ * @param path
+ * the path to the file in the bundle
+ */
+ protected List<PaletteConfiguration> loadConfigurationModel(Bundle bundle, String path) throws FileNotFoundException, IOException {
+ // stores the bundle in which the resource is located.
+ // warning: in case of fragments, the contributor id can the the plugin, but the file can be localized in the fragment
+ // In this case, the real bundle used to load the file is the fragment bundle...
+ // String bundleId = null;
+
+ // creates a resource set that will load the configuration
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ Resource resource = loadResourceFromPreferences(resourceSet);
+
+ if (resource == null) {
+ resource = loadResourceFromPlugin(bundle, path, resourceSet);
+ }
+
+ if (resource == null) {
+ throw new FileNotFoundException("Loading palette configuration... Impossible to find a resource for path; " + path + " for bundle: " + bundle);
+ }
+ return loadConfigurationModel(resource);
+ }
+
+ /**
+ * Loads and returns the model, given the resource
+ * @param resource
+ * @return
+ * @throws IOException
+ */
+ protected List<PaletteConfiguration> loadConfigurationModel(Resource resource) throws IOException {
+ resource.load(Collections.emptyMap());
+ if (resource.getContents().size() > 0) {
+
+ return new ArrayList<PaletteConfiguration>(EcoreUtil.<PaletteConfiguration> getObjectsByType(resource.getContents(), PaletteconfigurationPackage.eINSTANCE.getPaletteConfiguration()));
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * Returns the id of the bundle that declares this provider, can be null if not yet initialized
+ *
+ * @return the id of the bundle, or <code>null</code>
+ */
+ protected String getContributorID() {
+ return contributorID;
+ }
+
+ /**
+ * Returns the list of contribution for this provider
+ *
+ * @return the list of contribution for this provider
+ */
+ public List<PaletteConfiguration> getContributions() {
+ return contributions;
+ }
+
+ /**
+ * Returns the resource used for the configuration.
+ * <P>
+ * It checks in the preferences area, then in the plugin area
+ * </P>
+ */
+ protected Resource loadResourceFromPreferences(ResourceSet resourceSet) {
+ Resource resource = null;
+ // look in preference area
+ String path = PapyrusPalettePreferences.getPaletteRedefinition(paletteID);
+ if (path != null) {
+ // read in preferences area of diagram common! Thus, it can be accessed from the common plugin...
+ IPath resourcePath = org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getStateLocation().append(path);
+ URI uri = URI.createFileURI(resourcePath.toOSString());
+ if (uri != null && uri.isFile()) {
+ resource = resourceSet.createResource(uri);
+ if (resource != null) {
+ return resource;
+ }
+ }
+
+ }
+ return resource;
+ }
+
+ /**
+ * Loads the resource from the plugin area
+ *
+ * @return the resource to load.
+ * @throws FileNotFoundException
+ */
+ protected Resource loadResourceFromPlugin(Bundle bundle, String path, ResourceSet resourceSet) throws FileNotFoundException {
+ Resource resource = null;
+ String bundleId = null;
+ // try to load the resource in the fragments of the bundle, then the bundle itself.
+ URL entry = null;
+ // try in fragments...
+ Bundle[] fragments = Platform.getFragments(bundle);
+ if (fragments != null) {
+ for (Bundle fragment : fragments) {
+ entry = fragment.getEntry(path);
+ if (entry != null) {
+ bundleId = fragment.getSymbolicName();
+ continue;
+ }
+ }
+ }
+ // look now in the bundle itself.
+ if (entry == null) {
+ entry = bundle.getEntry(path);
+ // no entry was found in the children fragments, look in the bundle itself
+ if (entry == null) {
+ throw new FileNotFoundException("Loading palette configuration... Impossible to find a resource for path; " + path + " for bundle: " + bundle);
+ } else {
+ bundleId = bundle.getSymbolicName();
+ }
+ }
+
+ resource = resourceSet.createResource(URI.createPlatformPluginURI("/" + bundleId + "/" + path, true));
+ return resource;
+ }
+
+
+ /**
+ * Loads the resource from the plugin area
+ *
+ * @return the resource to load.
+ * @throws FileNotFoundException
+ */
+ protected Resource loadResourceFromWorkspace(String path, ResourceSet resourceSet) {
+ Resource resource = resourceSet.createResource(URI.createPlatformResourceURI(path, true));
+ return resource;
+ }
+
+ /**
+ * factory used to create new tools for the extended palette provider. It will find or create a new element type for each tool which has extended
+ * features.
+ */
+ public class ExtendedPaletteFactory extends PaletteFactory.Adapter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Tool createTool(String toolId) {
+ IElementTypesBasedTool toolEntry = mapToolId2Entries.get(toolId);
+ if (toolEntry instanceof ExtendedCreationToolEntry) {
+ return new AspectUnspecifiedTypeCreationTool(((ExtendedCreationToolEntry) toolEntry).getElementTypes());
+ } else if (toolEntry instanceof ExtendedConnectionToolEntry) {
+ return new AspectUnspecifiedTypeConnectionTool(((ExtendedConnectionToolEntry) toolEntry).getElementTypes());
+ }
+ Activator.log.warn("Impossible to create a tool for the given tool id: " + toolId + ". Tool Entry found was :" + toolEntry);
+ return null;
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java
index 1644a7f6e9e..fe0b006ce54 100755..100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java
@@ -18,12 +18,15 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener;
@@ -35,6 +38,7 @@ import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.papyrus.uml.diagram.paletteconfiguration.PaletteconfigurationPackage;
import org.eclipse.ui.IEditorPart;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -252,18 +256,32 @@ public class FilteringPaletteProvider implements IPaletteProvider {
// retrieves the custom palette
String paletteURI = getCustomPalette(diagram);
if (paletteURI != null && !paletteURI.isEmpty()) {
- CustomPaletteProvider provider = new CustomPaletteProvider();
- provider.setContributions(paletteURI);
- contributions = provider.getContributions();
- List<String> nodesID = (new WalkerPaletteContributionHelper(IPapyrusPaletteConstant.ID)).getAllPaletteNodesID(contributions);
- // verify if the elements (nodes) from the custom palette already contributed
- if (!isCustomPaletteContributed(predefinedEntries, nodesID)) {
- // verify if the extended elements (refids) from the custom palette are already contributed
- List<String> refToolsID = (new WalkerPaletteContributionHelper(IPapyrusPaletteConstant.REF_TOOL_ID)).getAllPaletteNodesID(contributions);
- if (isCustomPaletteContributed(predefinedEntries, refToolsID)){
- provider.contributeToPalette(editor, content, root, predefinedEntries);
- }
+ if (!paletteURI.endsWith(PaletteconfigurationPackage.eNAME)) {
+ Activator.log.warn("Old palette configuration, please consider using the new paletteconfiguration framework");
+ CustomPaletteProvider provider = new CustomPaletteProvider();
+ provider.setContributions(paletteURI);
+ contributions = provider.getContributions();
+ List<String> nodesID = (new WalkerPaletteContributionHelper(IPapyrusPaletteConstant.ID)).getAllPaletteNodesID(contributions);
+ // verify if the elements (nodes) from the custom palette already contributed
+ if (!isCustomPaletteContributed(predefinedEntries, nodesID)) {
+ // verify if the extended elements (refids) from the custom palette are already contributed
+ List<String> refToolsID = (new WalkerPaletteContributionHelper(IPapyrusPaletteConstant.REF_TOOL_ID)).getAllPaletteNodesID(contributions);
+ if (isCustomPaletteContributed(predefinedEntries, refToolsID)){
+ provider.contributeToPalette(editor, content, root, predefinedEntries);
+ }
+ }
+ } else {
+ ExtendedPluginPaletteProvider extendedPluginPaletteProvider = new ExtendedPluginPaletteProvider();
+ Resource resource = new ResourceSetImpl().createResource(URI.createURI(paletteURI, true));
+ try {
+ extendedPluginPaletteProvider.contributions = extendedPluginPaletteProvider.loadConfigurationModel(resource);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ extendedPluginPaletteProvider.contributions = Collections.emptyList();
+ }
+ extendedPluginPaletteProvider.contributeToPalette(editor, content, root, predefinedEntries);
}
+
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
index 00008741209..aa3eb368d32 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
@@ -9,6 +9,12 @@
</factory>
</extension>
<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.css.userAgentStyleSheet">
+ <stylesheet
+ stylesheetPath="theme/umlBase.css">
+ </stylesheet>
+ </extension>
+ <extension
point="org.eclipse.papyrus.infra.gmfdiag.css.theme">
<themeContribution
id="org.eclipse.papyrus.css.blacknwhite_theme">
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css
new file mode 100644
index 00000000000..11cbf5faf1d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/theme/umlBase.css
@@ -0,0 +1,398 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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:
+ * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Generic shape default value implementation. Default symbol implementation.
+ *
+ *****************************************************************************/
+
+/* Hide the name label for most links */
+
+Dependency > Label:name,
+Usage > Label:name,
+Realization > Label:name,
+InterfaceRealization > Label:name,
+Abstraction > Label:name,
+Substitution > Label:name,
+Connector > Label:name,
+InformationFlow > Label:name
+{
+ visible: false;
+}
+
+/*
+ * The Actor element icon is not useful either
+ */
+UseCaseDiagram Actor {
+ elementIcon:false;
+}
+
+TimingDiagram * {
+ gradient:none;
+}
+
+
+/*---------- Default SVG symbols ----------*/
+
+/* Round full */
+StateMachineDiagram Pseudostate[kind="initial"],
+StateMachineDiagram Pseudostate[kind="junction"],
+ActivityDiagram InitialNode,
+InteractionOverviewDiagram InitialNode
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/round_full.svg";
+}
+
+ActivityDiagram ActivityFinalNode,
+InteractionOverviewDiagram ActivityFinalNode,
+StateMachineDiagram FinalState
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/round_with_dot.svg";
+}
+
+ActivityDiagram FlowFinalNode,
+InteractionOverviewDiagram FlowFinalNode
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/round_with_cross.svg";
+}
+
+ActivityDiagram SendSignalAction
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/arrow.svg";
+}
+
+StateMachineDiagram Pseudostate[kind="terminate"]
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/cross.svg";
+}
+
+ActivityDiagram MergeNode,
+ActivityDiagram DecisionNode,
+InteractionOverviewDiagram MergeNode,
+InteractionOverviewDiagram DecisionNode,
+StateMachineDiagram Pseudostate[kind="choice"],
+ClassDiagram Association
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/diamond.svg";
+}
+
+Actor
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/icons/symbols/stickman.svg";
+}
+
+DurationObservation
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/symbols/durationObservation.svg";
+}
+
+TimeObservation
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/symbols/timeObservation.svg";
+}
+
+StateMachineDiagram Pseudostate[kind="shallowHistory"]
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/symbols/shallowHistory.svg";
+}
+
+StateMachineDiagram Pseudostate[kind="deepHistory"]
+{
+svgFile:"platform:/plugin/org.eclipse.papyrus.uml.diagram.common/icons/symbols/deepHistory.svg";
+}
+
+/*---------- Activity Diagram ----------*/
+
+ActivityDiagram MergeNode,
+ActivityDiagram InitialNode,
+ActivityDiagram ActivityFinalNode,
+ActivityDiagram FlowFinalNode,
+ActivityDiagram DecisionNode,
+ActivityDiagram SendSignalAction,
+ActivityDiagram AcceptEventAction
+{
+ displayBorder:false;
+ displayName:false;
+ diplayIcon:false;
+ displayTag:false;
+ followSVGSymbol:true;
+ maintainSymbolRatio:true;
+ transparency:100;
+ /*displayFloatingLabel:true;*/
+ maxNumberOfSymbol:1;
+ useOriginalColors:false;
+ gradient:none;
+ fillColor:white;
+}
+
+ActivityDiagram InitialNode{
+ fillColor: black;
+}
+
+/*symbol compartment set to visible */
+ActivityDiagram MergeNode > Compartment[kind="symbol"],
+ActivityDiagram InitialNode > Compartment[kind="symbol"],
+ActivityDiagram ActivityFinalNode > Compartment[kind="symbol"],
+ActivityDiagram FlowFinalNode > Compartment[kind="symbol"],
+ActivityDiagram MergeNode > Compartment[kind="symbol"],
+ActivityDiagram SendSignalAction > Compartment[kind="symbol"],
+ActivityDiagram DecisionNode > Compartment[kind="symbol"],
+ActivityDiagram AcceptEventAction > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+/*External Label set to visible*/
+ActivityDiagram MergeNode > Label,
+ActivityDiagram InitialNode > Label,
+ActivityDiagram ActivityFinalNode > Label,
+ActivityDiagram FlowFinalNode > Label,
+ActivityDiagram DecisionNode > Label,
+ActivityDiagram SendSignalAction > Label,
+ActivityDiagram ForkNode > Label,
+ActivityDiagram JoinNode > Label
+{
+ visible:true;
+}
+
+ActivityDiagram SendSignalAction,
+ActivityDiagram AcceptEventAction
+{
+ maintainSymbolRatio:false;
+ displayName:true;
+}
+
+ActivityDiagram Activity
+{
+ leftMarginLabel:10;
+ rightMarginLabel:5;
+ topMarginLabel:5;
+ bottomMarginLabel:5;
+}
+
+/* For most Activity diagram nodes (e.g. initial, final, fork, decision, ...),
+ * the element icon is displayed next to the actual object.
+ * By default, we prevent this.
+ *
+ * For standard nodes (OpaqueAction, ...), they are not implemented at all,
+ * so a global selector will not have side effects (yet).
+ */
+ActivityDiagram Activity *,InteractionOverviewDiagram Activity * {
+ elementIcon:false;
+}
+
+/*---------- Class Diagram ----------*/
+ClassDiagram Association
+{
+ displayBorder:false;
+ displayName:false;
+ diplayIcon:false;
+ displayTag:false;
+ followSVGSymbol:true;
+ maintainSymbolRatio:true;
+ transparency:100;
+ displayFloatingLabel:true;
+ maxNumberOfSymbol:1;
+ useOriginalColors:false;
+ gradient:none;
+ fillColor:white;
+}
+
+ClassDiagram Association > Compartment[kind="symbol"],
+ClassDiagram DurationObservation > Compartment[kind="symbol"],
+ClassDiagram TimeObservation > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+ClassDiagram Dependency
+{
+ fillColor:Black;
+ gradient:none;
+}
+
+/*---------- UseCase Diagram ----------*/
+UseCaseDiagram UseCase > Compartment {
+ lineLengthRatio:"0.70";
+}
+
+UseCaseDiagram UseCase {
+ topMarginLabel:10;
+}
+
+UseCaseDiagram Actor
+{
+ displayBorder:false;
+ displayName:false;
+ diplayIcon:false;
+ displayTag:false;
+ followSVGSymbol:true;
+ maintainSymbolRatio:true;
+ transparency:100;
+ /*displayFloatingLabel:true;*/
+ maxNumberOfSymbol:1;
+ useOriginalColors:false;
+ gradient:none;
+ fillColor:white;
+}
+
+UseCaseDiagram Actor > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+/*---------- Communication Diagram ----------*/
+CommunicationDiagram DurationObservation > Compartment[kind="symbol"],
+CommunicationDiagram TimeObservation > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+CommunicationDiagram Interaction > Compartment
+{
+ lineLength:0;
+}
+
+/*---------- State Machine Diagram ----------*/
+StateMachineDiagram Pseudostate[kind="initial"],
+StateMachineDiagram Pseudostate[kind="junction"],
+StateMachineDiagram Pseudostate[kind="shallowHistory"],
+StateMachineDiagram Pseudostate[kind="terminate"],
+StateMachineDiagram Pseudostate[kind="deepHistory"],
+StateMachineDiagram Pseudostate[kind="choice"],
+StateMachineDiagram FinalState
+{
+ displayBorder:false;
+ displayName:false;
+ diplayIcon:false;
+ displayTag:false;
+ followSVGSymbol:true;
+ maintainSymbolRatio:true;
+ transparency:100;
+ displayFloatingLabel:true;
+ maxNumberOfSymbol:1;
+ useOriginalColors:false;
+ gradient:none;
+ fillColor:white;
+}
+
+StateMachineDiagram Pseudostate[kind="initial"],
+StateMachineDiagram Pseudostate[kind="junction"]
+{
+ gradient:none;
+ fillColor:black;
+}
+
+StateMachineDiagram Pseudostate[kind="initial"] > Label,
+StateMachineDiagram Pseudostate[kind="junction"] > Label,
+StateMachineDiagram Pseudostate[kind="shallowHistory"] > Label,
+StateMachineDiagram Pseudostate[kind="terminate"] > Label,
+StateMachineDiagram Pseudostate[kind="deepHistory"] > Label,
+StateMachineDiagram Pseudostate[kind="choice"] > Label,
+StateMachineDiagram FinalState> Label,
+StateMachineDiagram Pseudostate[kind="exitPoint"] > Label,
+StateMachineDiagram Pseudostate[kind="entryPoint"] > Label,
+StateMachineDiagram Pseudostate[kind="join"] > Label,
+StateMachineDiagram Pseudostate[kind="fork"] > Label
+{
+ visible:true;
+ textAlignment:"Left";
+}
+
+StateMachineDiagram Pseudostate[kind="initial"] > Compartment[kind="symbol"],
+StateMachineDiagram Pseudostate[kind="shallowHistory"] > Compartment[kind="symbol"],
+StateMachineDiagram Pseudostate[kind="terminate"] > Compartment[kind="symbol"],
+StateMachineDiagram Pseudostate[kind="deepHistory"] > Compartment[kind="symbol"],
+StateMachineDiagram Pseudostate[kind="choice"] > Compartment[kind="symbol"],
+StateMachineDiagram Pseudostate[kind="junction"] > Compartment[kind="symbol"],
+StateMachineDiagram FinalState > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+StateMachineDiagram Pseudostate[kind="choice"]{
+ maintainSymbolRatio:false;
+}
+
+/*---------- Composite Diagram ---------*/
+
+CompositeStructureDiagram Property[aggregation="shared"]{
+ borderStyle: custom;
+}
+
+CompositeStructureDiagram DurationObservation > Compartment[kind="symbol"],
+CompositeStructureDiagram TimeObservation > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+CompositeStructureDiagram DurationObservation > Label,
+CompositeStructureDiagram TimeObservation > Label,
+CompositeStructureDiagram Port > Label
+{
+ visible:true;
+ textAlignment:"left";
+}
+
+
+/*---------- Interaction Overview Diagram ----------*/
+
+InteractionOverviewDiagram MergeNode,
+InteractionOverviewDiagram InitialNode,
+InteractionOverviewDiagram ActivityFinalNode,
+InteractionOverviewDiagram FlowFinalNode,
+InteractionOverviewDiagram DecisionNode
+{
+ displayBorder:false;
+ displayName:false;
+ diplayIcon:false;
+ displayTag:false;
+ followSVGSymbol:true;
+ maintainSymbolRatio:true;
+ transparency:100;
+ maxNumberOfSymbol:1;
+ useOriginalColors:false;
+ gradient:none;
+ fillColor:white;
+}
+
+InteractionOverviewDiagram InitialNode{
+ fillColor:black;
+}
+
+/*symbol compartment set to visible */
+InteractionOverviewDiagram MergeNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram InitialNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram ActivityFinalNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram FlowFinalNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram MergeNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram DecisionNode > Compartment[kind="symbol"],
+InteractionOverviewDiagram SendSignalAction > Compartment[kind="symbol"]
+{
+ visible:true;
+}
+
+/*External Label set to visible*/
+InteractionOverviewDiagram MergeNode > Label,
+InteractionOverviewDiagram InitialNode > Label,
+InteractionOverviewDiagram ActivityFinalNode > Label,
+InteractionOverviewDiagram FlowFinalNode > Label,
+InteractionOverviewDiagram DecisionNode > Label,
+InteractionOverviewDiagram ForkNode > Label,
+InteractionOverviewDiagram JoinNode > Label
+{
+ visible:true;
+}
+
+InteractionOverviewDiagram Activity
+{
+ leftMarginLabel:10;
+ rightMarginLabel:5;
+ topMarginLabel:5;
+ bottomMarginLabel:5;
+}
+

Back to the top