Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2011-03-16 06:14:22 -0400
committervlorenzo2011-03-16 06:14:22 -0400
commitaac38554a97854b3f178ad7a25aad1f2b11e55c2 (patch)
treeed72aec38a510360a39b55ede90f5bc910741d7e /tests/recipes/plugins
parentdad6b4f82d7ae41feab8ad2671ed0c5d0041707c (diff)
downloadorg.eclipse.papyrus-aac38554a97854b3f178ad7a25aad1f2b11e55c2.tar.gz
org.eclipse.papyrus-aac38554a97854b3f178ad7a25aad1f2b11e55c2.tar.xz
org.eclipse.papyrus-aac38554a97854b3f178ad7a25aad1f2b11e55c2.zip
NEW bug 336371: [Model Explorer] add element to do recipe test
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336371 Add the request GetPackageBackgroundColor and backgroundPackage.uiCustom.
Diffstat (limited to 'tests/recipes/plugins')
-rw-r--r--tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/build.properties3
-rw-r--r--tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/plugin.xml8
-rw-r--r--tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/backgroundPackage.uiCustom14
-rw-r--r--tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/umlModelExplorerRecipe.querySet4
-rw-r--r--tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/src/org/eclipse/papyrus/uml/modelexplorer/recipetest/GetBackgroundPackageColor.java32
5 files changed, 60 insertions, 1 deletions
diff --git a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/build.properties b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/build.properties
index 0c29fad614b..d8b07494fcc 100644
--- a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/build.properties
+++ b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/build.properties
@@ -9,5 +9,6 @@ bin.includes = META-INF/,\
resource/umlModelExplorerRecipe.facetSet,\
resource/LoadRecipeFacet.uiCustom,\
resource/LoadRecipeFacet2.uiCustom,\
- resource/overlayFacet.uiCustom
+ resource/overlayFacet.uiCustom,\
+ resource/backgroundPackage.uiCustom
source.. = src/
diff --git a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/plugin.xml b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/plugin.xml
index 03fc52c8271..91aac4d7574 100644
--- a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/plugin.xml
+++ b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/plugin.xml
@@ -27,4 +27,12 @@
<extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
<browserCustomization file="resource/overlayFacet.uiCustom"/>
</extension>
+ <extension point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset file="resource/My.querySet"/>
+ </extension>
+ <extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization
+ file="resource/backgroundPackage.uiCustom"
+ loadByDefault="true"/>
+ </extension>
</plugin>
diff --git a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/backgroundPackage.uiCustom b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/backgroundPackage.uiCustom
new file mode 100644
index 00000000000..757683952d6
--- /dev/null
+++ b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/backgroundPackage.uiCustom
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/uml2/3.0.0/UML" allQuerySetsAvailable="false">
+ <types metaclassName="uml.Package">
+ <customizedFeatures customizedFeature="color">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="(255,0,0)"/>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="backgroundColor">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/umlModelExplorerRecipe#GetPackageBackgroundColor"/>
+ </defaultValue>
+ </customizedFeatures>
+ </types>
+ <availableQuerySets>umlModelExplorerRecipe</availableQuerySets>
+</uicustom:MetamodelView>
diff --git a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/umlModelExplorerRecipe.querySet b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/umlModelExplorerRecipe.querySet
index 3f765b509ec..2b8afc9c478 100644
--- a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/umlModelExplorerRecipe.querySet
+++ b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/resource/umlModelExplorerRecipe.querySet
@@ -17,4 +17,8 @@
<returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/3.0.0/UML#//Property"/>
<scope href="http://www.eclipse.org/uml2/3.0.0/UML#//Classifier"/>
</queries>
+ <queries xsi:type="query:JavaModelQuery" name="GetPackageBackgroundColor" description="return Cyan if the package contains memebers and yellow if not" implementationClassName="org.eclipse.papyrus.uml.modelexplorer.recipetest.GetBackgroundPackageColor">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/3.0.0/UML#//String"/>
+ <scope href="http://www.eclipse.org/uml2/3.0.0/UML#//Package"/>
+ </queries>
</query:ModelQuerySet>
diff --git a/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/src/org/eclipse/papyrus/uml/modelexplorer/recipetest/GetBackgroundPackageColor.java b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/src/org/eclipse/papyrus/uml/modelexplorer/recipetest/GetBackgroundPackageColor.java
new file mode 100644
index 00000000000..43766c7fb3a
--- /dev/null
+++ b/tests/recipes/plugins/uml/org.eclipse.papyrus.uml.modelexplorer.recipetest/src/org/eclipse/papyrus/uml/modelexplorer/recipetest/GetBackgroundPackageColor.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.modelexplorer.recipetest;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.uml2.uml.Package;
+
+/** return Cyan if the package contains memebers and yellow if not */
+public class GetBackgroundPackageColor implements IJavaModelQuery<Package, String> {
+
+ public String evaluate(final Package context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ if(context.getOwnedElements().size() == 0) {
+ return new String("(255,255,128)"); //yellow
+ } else {
+ return new String("(128,255,255)"); //cyan
+ }
+
+ }
+}

Back to the top