Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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