Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick tessier2014-02-10 12:43:29 +0000
committerPatrick tessier2014-02-10 12:43:29 +0000
commit74550693a485c6ff27748a6c5a9bfdae21b8bd5b (patch)
treec47f42dd4f68434598c3bf6b29c7ce3a6fdb5314 /plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui
parentbc56e957da4deded94425181f3288b98407c5764 (diff)
downloadorg.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.tar.gz
org.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.tar.xz
org.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.zip
386118: [EMF Facet] Papyrus should progressively support EMF Facet 0.2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386118 import EMF-FACET
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.options5
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.project51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/.api_filters41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/component.xml7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/l10n/bundle.properties13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/build.properties20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg.gifbin0 -> 68 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg_unidir.gifbin0 -> 91 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attribute_facet.gifbin0 -> 438 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attributes.gifbin0 -> 124 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/feature.gifbin0 -> 294 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/inv_aggreg.gifbin0 -> 70 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link.gifbin0 -> 67 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir.gifbin0 -> 91 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir_facet.gifbin0 -> 375 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/uiCustom.gifbin0 -> 612 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/plugin.xml37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet271
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java77
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java30
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProvider.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java65
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java38
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java57
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java63
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java247
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java124
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java594
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java330
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java182
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java55
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java98
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java181
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java70
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java302
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java490
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java84
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java67
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java699
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java222
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java27
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java168
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java72
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties55
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java127
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java136
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java59
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java37
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java76
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java223
90 files changed, 6899 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.checkstyle
new file mode 100644
index 00000000000..cf229b786b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.checkstyle
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2010 Mia-Software.
+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:
+ Nicolas Guyomar (Mia-Software)
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <local-check-config name="EmfFacet" location="../org.eclipse.emf.facet.archi.tech.rules/checkstyle/EmfFacet.checkstyle" type="project" description=""/>
+ <fileset name="all" enabled="true" check-config-name="EmfFacet" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ <file-match-pattern match-pattern="Messages.java" include-pattern="false"/>
+ </fileset>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.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/facet/org.eclipse.papyrus.emf.facet.custom.ui/.options b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.options
new file mode 100644
index 00000000000..b76ff8c3cf4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.options
@@ -0,0 +1,5 @@
+org.eclipse.emf.facet.custom.ui/debug=false
+org.eclipse.emf.facet.custom.ui/debug/TreeElementAdapter=false
+org.eclipse.emf.facet.custom.ui/debug/CustomizedTreeContentProvider=false
+org.eclipse.emf.facet.custom.ui/debug/CustomizedLabelProvider/font=false
+org.eclipse.emf.facet.custom.ui/debug/CustomizedLabelProvider/color=false \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.pmd
new file mode 100644
index 00000000000..efcd2dbd830
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.pmd
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd>
+ <useProjectRuleSet>true</useProjectRuleSet>
+ <ruleSetFile>../org.eclipse.emf.facet.archi.tech.rules/pmd/ruleset.xml</ruleSetFile>
+ <includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
+</pmd>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.project
new file mode 100644
index 00000000000..69ee6450d97
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.project
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.custom.ui</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>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/.api_filters b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/.api_filters
new file mode 100644
index 00000000000..305bf583a49
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/.api_filters
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.emf.facet.custom.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="Only internal APIs have been modified." id="924844039">
+ <message_arguments>
+ <message_argument value="0.2.0"/>
+ <message_argument value="0.2.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogListener">
+ <filter comment="Only internal API have be modified" id="305324134">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogListener"/>
+ <message_argument value="org.eclipse.emf.facet.custom.ui_0.2.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java" type="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog">
+ <filter comment="This is an internal API." id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog"/>
+ <message_argument value="pressOk()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java" type="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory">
+ <filter comment="This an insternal API." id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory"/>
+ <message_argument value="createLoadCustomizationDialog(Shell, List&lt;Customization&gt;, List&lt;Customization&gt;, ILoadCustomizationsDialogListener)"/>
+ </message_arguments>
+ </filter>
+ <filter comment="This is an internal API" id="405901410">
+ <message_arguments>
+ <message_argument value="org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory"/>
+ <message_argument value="createLoadCustomizationDialog(Shell, List&lt;Customization&gt;, List&lt;Customization&gt;, List&lt;Customization&gt;, ILoadCustomizationsDialogListener, String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..51e9a601b77
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Oct 25 11:21:53 CEST 2011
+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/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..b1a69337e2e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.custom.ui;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.custom.ui.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.2.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0",
+ org.eclipse.papyrus.emf.facet.query.java.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.util.ui;bundle-version="0.2.0",
+ org.eclipse.emf.edit.ui;bundle-version="2.6.0",
+ org.eclipse.papyrus.emf.facet.util.swt;bundle-version="0.4.0",
+ org.eclipse.papyrus.emf.facet.util.jface.ui;bundle-version="0.4.0",
+ org.eclipse.papyrus.emf.facet.common.ui
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.custom.ui,
+ org.eclipse.emf.facet.custom.ui.internal,
+ org.eclipse.emf.facet.custom.ui.internal.exported,
+ org.eclipse.emf.facet.custom.ui.internal.exported.dialog,
+ org.eclipse.emf.facet.custom.ui.internal.exported.exception
+Service-Component: OSGI-INF/component.xml
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/component.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/component.xml
new file mode 100644
index 00000000000..36b169b97d9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.emf.facet.custom.ui">
+ <implementation class="org.eclipse.emf.facet.custom.ui.internal.DefaultCustomOverride"/>
+ <service>
+ <provide interface="org.eclipse.emf.facet.custom.ui.ICustomOverride"/>
+ </service>
+</scr:component>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..2753737aeec
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,13 @@
+#Copyright (c) 2011 Mia-Software.
+#
+#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:
+# Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+#Properties file for org.eclipse.emf.facet.custom.ui
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Customization UI (Incubation)
+view.customizations = Customizations \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/about.html
new file mode 100644
index 00000000000..25f1a82997c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>October 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/build.properties
new file mode 100644
index 00000000000..a71aa3ec9d6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/build.properties
@@ -0,0 +1,20 @@
+#Copyright (c) 2011 Mia-Software.
+#
+#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:
+# Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ plugin.xml,\
+ resources/,\
+ about.html,\
+ icons/,\
+ .options
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg.gif
new file mode 100644
index 00000000000..2c62284e92b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg_unidir.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg_unidir.gif
new file mode 100644
index 00000000000..30bf63ea561
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/aggreg_unidir.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attribute_facet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attribute_facet.gif
new file mode 100644
index 00000000000..bf0e5bec658
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attribute_facet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attributes.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attributes.gif
new file mode 100644
index 00000000000..d4cb4254d92
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/attributes.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/feature.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/feature.gif
new file mode 100644
index 00000000000..46be7a1265a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/feature.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/inv_aggreg.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/inv_aggreg.gif
new file mode 100644
index 00000000000..6f1021d4d1c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/inv_aggreg.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link.gif
new file mode 100644
index 00000000000..94c14024075
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir.gif
new file mode 100644
index 00000000000..c8169bcfbf8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir_facet.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir_facet.gif
new file mode 100644
index 00000000000..143ae199d3e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/link_unidir_facet.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/uiCustom.gif b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/uiCustom.gif
new file mode 100644
index 00000000000..bc86fbc897e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/icons/uiCustom.gif
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/plugin.xml
new file mode 100644
index 00000000000..35074e8c8f0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/plugin.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+Copyright (c) 2011 Mia-Software.
+
+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:
+ Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+-->
+<plugin>
+ <extension point="org.eclipse.emf.facet.util.emf.core.modeldeclaration">
+ <modeldeclaration file="resources/customproperties.efacet"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.emf.facet.common.ui.views"
+ class="org.eclipse.emf.facet.custom.ui.internal.view.CustomizationsCatalogView"
+ icon="icons/uiCustom.gif"
+ id="org.eclipse.emf.facet.custom.ui.view.catalog"
+ name="%view.customizations"
+ restorable="true">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.efacet.core.queryImplementationRegistration">
+ <queryImplementationRegistration
+ class="org.eclipse.emf.facet.custom.ui.internal.query.URIImageQueryImplementationFactory">
+ </queryImplementationRegistration>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet
new file mode 100644
index 00000000000..f6d654d5a3f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<efacet:FacetSet
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:efacet="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"
+ xmlns:query="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/query"
+ xmlns:javaQuery2="http://www.eclipse.org/emf/facet/query/java/0.2.incubation"
+ name="commoncustomproperties"
+ nsURI="http://www.eclipse.org/emf/facet/custom/0.2.incubation/commoncustomproperties"
+ nsPrefix="commoncustomproperties">
+ <eClassifiers xsi:type="efacet:Facet" name="CustomizedEObject">
+ <extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ <facetOperations name="label" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.LabelQuery"/>
+ </facetOperations>
+ <facetOperations name="image" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ImageQuery"/>
+ </facetOperations>
+ <facetOperations name="fontName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.FontNameQuery"/>
+ </facetOperations>
+ <facetOperations name="fontSize" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.FontSizeQuery"/>
+ </facetOperations>
+ <facetOperations name="isBold" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="isItalic" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="background" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Color"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.BackgroundQuery"/>
+ </facetOperations>
+ <facetOperations name="foreground" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Color"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ForegroundQuery"/>
+ </facetOperations>
+ <facetOperations name="isUnderlined" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="isStruckthrough" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="topLeftOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="topMiddleOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="topRightOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomLeftOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomMiddleOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomRightOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="isVisible" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:TrueLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="selection" lowerBound="0" upperBound="-1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.SelectionQuery"/>
+ </facetOperations>
+ </eClassifiers>
+ <eClassifiers xsi:type="efacet:Facet" name="CustomizedToolTipEObject">
+ <extendedMetaclass href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ <facetOperations name="text" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipTextQuery"/>
+ </facetOperations>
+ <facetOperations name="image" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="fontName" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.FontNameQuery"/>
+ </facetOperations>
+ <facetOperations name="fontSize" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.FontSizeQuery"/>
+ </facetOperations>
+ <facetOperations name="isBold" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="isItalic" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:FalseLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="background" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Color"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipBackgroundQuery"/>
+ </facetOperations>
+ <facetOperations name="foreground" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Color"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ForegroundQuery"/>
+ </facetOperations>
+ <facetOperations name="topLeftOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="topMiddleOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="topRightOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomLeftOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomMiddleOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="bottomRightOverlay" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="query:NullLiteralQuery" />
+ </facetOperations>
+ <facetOperations name="displayDelayTime" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipDelayQuery"/>
+ </facetOperations>
+ <facetOperations name="timeDisplayed" lowerBound="1">
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipDelayQuery"/>
+ </facetOperations>
+ <facetOperations name="alignment" lowerBound="1">
+ <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Alignment"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipAlignmentQuery"/>
+ </facetOperations>
+ <facetOperations name="shadow" lowerBound="1">
+ <eType xsi:type="ecore:EEnum" href="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types#//Shadow"/>
+ <eParameters name="eStructuralFeature">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query xsi:type="javaQuery2:JavaQuery" implementationClassName="org.eclipse.emf.facet.custom.ui.internal.query.ToolTipShadowQuery"/>
+ </facetOperations>
+ </eClassifiers>
+</efacet:FacetSet>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java
new file mode 100644
index 00000000000..42d400014f2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ * Nicolas Bros (Mia-Software) - Bug 380407 - Missing since tag on CustomizedContentProviderUtils
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+/**
+ * A companion utility class for {@link ICustomizedTreeContentProvider}
+ *
+ * @since 0.2
+ */
+public final class CustomizedContentProviderUtils {
+ private CustomizedContentProviderUtils() {
+ // utility class
+ }
+
+ /**
+ * Replace proxy objects by their underlying model elements in the given selection
+ *
+ * @return the unwrapped version of the selection
+ */
+ public static ISelection resolveSelection(final ISelection selection) {
+ Assert.isNotNull(selection);
+ ISelection result;
+ if (selection instanceof IStructuredSelection) {
+ final IStructuredSelection strSelection = (IStructuredSelection) selection;
+ final List<Object> resolvedElements = new ArrayList<Object>();
+ final Iterator<?> iterator = strSelection.iterator();
+ while (iterator.hasNext()) {
+ final Object element = iterator.next();
+ resolvedElements.add(resolve(element));
+ }
+ result = new StructuredSelection(resolvedElements);
+ } else {
+ throw new IllegalArgumentException("Unhandled selection type: " + selection.getClass().getName()); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ /**
+ * Resolve the given UI element into the underlying model element.
+ *
+ * @param element
+ * a UI element, that may be a proxy for a model element
+ * @return the corresponding model element, or the given element if it is not a proxy
+ */
+ public static Object resolve(final Object element) {
+ Object resolved = element;
+ if (element instanceof EObjectTreeElement) {
+ resolved = ((EObjectTreeElement) element).getEObject();
+ } else if (element instanceof EAttributeTreeElement) {
+ resolved = ((EAttributeTreeElement) element).getEAttribute();
+ } else if (element instanceof EReferenceTreeElement) {
+ resolved = ((EReferenceTreeElement) element).getEReference();
+ }
+ return resolved;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java
new file mode 100644
index 00000000000..4c0e63a6a3f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+
+/**
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IContentPropertiesHandler {
+ FacetOperation getIsVisible();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java
new file mode 100644
index 00000000000..6ba0241106a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory;
+
+/**
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IContentPropertiesHandlerFactory {
+
+ IContentPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory();
+
+ IContentPropertiesHandler createIContentPropertiesHandler(
+ ICustomizationManager customizationMgr);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java
new file mode 100644
index 00000000000..f0eccfeab34
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.swt.graphics.FontData;
+
+/**
+ * @since 0.4
+ */
+public interface ICustomOverride {
+
+ String getText(String result, Object object,
+ ICustomizationManager customManager,
+ IFontPropertiesHandler propertiesHandler) throws CustomizationException;
+
+ FontData getFont(FontData fontData, Object object,
+ ICustomizationManager customManager,
+ IFontPropertiesHandler propertiesHandler) throws CustomizationException;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProvider.java
new file mode 100644
index 00000000000..27f7ba8d41e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProvider.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * This interface allow to used a {@link IContentProvider} which is implemented
+ * and customizable using the EMF Facet customization mechanism.
+ *
+ * @author Gregoire Dupe
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @deprecated use {@link ICustomizedTreeContentProvider} (Bug 380229 - [deprecated] ICustomizedContentProvider)
+ */
+@Deprecated
+public interface ICustomizedContentProvider extends IContentProvider {
+ /**
+ * This method returns the customization manager used by the content provider. The
+ * customization stack update have to be done using this
+ * {@link ICustomizationManager}.
+ *
+ * @return the customization manager used by the content provider.
+ */
+ ICustomizationManager getCustomizationManager();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java
new file mode 100644
index 00000000000..ced6cf1d4f1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.CustomizedContentProviderFactory;
+
+/**
+ * This is a factory for {@link ICustomizedContentProvider} and {@link ICustomizedTreeContentProvider}.
+ *
+ * @author Gregoire Dupe
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ *
+ */
+public interface ICustomizedContentProviderFactory {
+ /**
+ * The default factory instance
+ */
+ ICustomizedContentProviderFactory DEFAULT = new CustomizedContentProviderFactory();
+
+ /**
+ * This method is used to instantiate a {@link ICustomizedContentProvider}
+ *
+ * @param customizationMgr
+ * the customization manager which has to be used by the content provider.
+ * @return a content provider
+ * @deprecated Bug 380229 - [deprecated] ICustomizedContentProvider
+ */
+ @Deprecated
+ ICustomizedContentProvider createCustomizedContentProvider(ICustomizationManager customizationMgr);
+
+ /**
+ * Instantiate an {@link ICustomizedTreeContentProvider}. With this content provider, your viewer's input has to be
+ * an EObject or an array or collection of EObjects.F
+ *
+ * @param customManager
+ * the customization manager used by the content provider
+ * @return a tree content provider
+ * @since 0.2
+ */
+ ICustomizedTreeContentProvider createCustomizedTreeContentProvider(ICustomizationManager customManager);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java
new file mode 100644
index 00000000000..1a5ddb85e9d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This interface allows to use a {@link ILabelProvider}, an
+ * {@link IColorProvider} and an {@link IFontProvider} which is implemented and
+ * customizable using the EMF Facet customization mechanism.
+ *
+ * @author Gregoire Dupe
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizedLabelProvider extends ILabelProvider,
+ IColorProvider, IFontProvider , ICustomizedToolTipLabelProvider {
+ /**
+ * This method returns the customization manager used by the label provider. The
+ * customization stack updates have to be done using this
+ * {@link ICustomizationManager}.
+ *
+ * @return the customization manager used by the content provider.
+ */
+ ICustomizationManager getCustomizationManager();
+
+ boolean isUnderlined(Object element, ETypedElement eTypedElement);
+
+ boolean isStruckthrough(Object element, ETypedElement eTypedElement);
+
+ Image getTopLeftOverlay(Object element, ETypedElement eTypedElement);
+ Image getTopMiddleOverlay(Object element, ETypedElement eTypedElement);
+ Image getTopRightOverlay(Object element, ETypedElement eTypedElement);
+
+ Image getBottomLeftOverlay(Object element, ETypedElement eTypedElement);
+ Image getBottomMiddleOverlay(Object element, ETypedElement eTypedElement);
+ Image getBottomRightOverlay(Object element, ETypedElement eTypedElement);
+
+ String getText(Object element, ETypedElement eTypedElement);
+
+ Image getImage(Object element, ETypedElement eTypedElement);
+
+ /**
+ * @since 0.2
+ */
+ ICustomizedLabelProvider cloneLabelProvider();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java
new file mode 100644
index 00000000000..08893579b99
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.CustomizedLabelProviderFactory;
+
+/**
+ * This class is the factory allowing to get a instance of
+ * {@link ICustomizedLabelProvider}.
+ *
+ * @author Gregoire Dupe
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizedLabelProviderFactory {
+ ICustomizedLabelProviderFactory DEFAULT = new CustomizedLabelProviderFactory();
+
+ /**
+ * This method is used to instantiate a {@link ICustomizedLabelProvider}.
+ *
+ * @param customizationManager
+ * the customization manager which has to used by the content
+ * provider.
+ * @return a label provider
+ */
+ ICustomizedLabelProvider createCustomizedLabelProvider(
+ ICustomizationManager customizationMgr);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java
new file mode 100644
index 00000000000..4b82620582b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java
@@ -0,0 +1,68 @@
+/**
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * This interface provides methods to customize tooltips
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizedToolTipLabelProvider {
+
+ void update(ViewerCell cell);
+
+ String getToolTipText(Object element, ETypedElement eTypedElement);
+
+ Image getToolTipImage(Object element, ETypedElement eTypedElement);
+
+ Font getToolTipFont(Object element, ETypedElement eTypedElement);
+
+ Color getToolTipBackgroundColor(Object element, ETypedElement eTypedElement);
+
+ Color getToolTipForegroundColor(Object element, ETypedElement eTypedElement);
+
+ Image getToolTipTopLeftOverlay(Object element, ETypedElement eTypedElement);
+
+ Image getToolTipTopMiddleOverlay(Object element, ETypedElement eTypedElement);
+
+ Image getToolTipTopRightOverlay(Object element, ETypedElement eTypedElement);
+
+ Image getToolTipBottomLeftOverlay(Object element,
+ ETypedElement eTypedElement);
+
+ Image getToolTipBottomMiddleOverlay(Object element,
+ ETypedElement eTypedElement);
+
+ Image getToolTipBottomRightOverlay(Object element,
+ ETypedElement eTypedElement);
+
+ int getToolTipTimeDisplayed(Object element, ETypedElement eTypedElement);
+
+ int getToolTipDisplayDelayTime(Object element, ETypedElement eTypedElement);
+
+ /**
+ * The style can be : SWT.LEFT, SWT.CENTER, SWT.RIGHT, SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE.
+ *
+ * @param element
+ * @return
+ */
+ int getToolTipStyle(Object element, ETypedElement eTypedElement);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java
new file mode 100644
index 00000000000..753c29fed0c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * An {@link ITreeContentProvider} which is implemented and customizable using the EMF Facet customization mechanisms.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2
+ */
+public interface ICustomizedTreeContentProvider extends ITreeContentProvider {
+ /**
+ * This method returns the customization manager used by the content provider. Updates to the list of loaded
+ * customizations have to be done using the {@link ICustomizationManager} returned by this method.
+ *
+ * @return the customization manager used by this content provider.
+ */
+ ICustomizationManager getCustomizationManager();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java
new file mode 100644
index 00000000000..d78f859fcd9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider
+ */
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+
+/**
+ * @since 0.4
+ */
+public interface IFontPropertiesHandler {
+
+ FacetOperation getBackgroundProperty();
+
+ FacetOperation getForegroundProperty();
+
+ FacetOperation getFontNameProperty();
+
+ FacetOperation getFontSizeProperty();
+
+ FacetOperation getIsBoldProperty();
+
+ FacetOperation getIsItalicProperty();
+
+ FacetOperation getIsVisible();
+
+ FacetOperation getIsUnderlinedProperty();
+
+ FacetOperation getIsStruckthroughProperty();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java
new file mode 100644
index 00000000000..c6982ac6f34
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.ResolvingCustomizedLabelProviderFactory;
+
+/**
+ * A factory to create instances of {@link ICustomizedLabelProvider} that work on proxy UI elements, by customizing the
+ * resolved elements.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2
+ */
+public interface IResolvingCustomizedLabelProviderFactory {
+ IResolvingCustomizedLabelProviderFactory DEFAULT = new ResolvingCustomizedLabelProviderFactory();
+
+ /**
+ * This method is used to instantiate a {@link ICustomizedLabelProvider}.
+ *
+ * @param customizationManager
+ * the customization manager which has to used by the content provider.
+ * @return a label provider
+ */
+ ICustomizedLabelProvider createCustomizedLabelProvider(ICustomizationManager customizationMgr);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java
new file mode 100644
index 00000000000..746db07ce30
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+
+/**
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ISelectionPropertiesHandler {
+ /** This customization property returns the selection for a given source EObject and a given ETypedElement parameter */
+ FacetOperation getSelectionProperty();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java
new file mode 100644
index 00000000000..704c14f1e63
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory;
+
+/**
+ * Factory for {@link ISelectionPropertiesHandler}
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ISelectionPropertiesHandlerFactory {
+
+ ISelectionPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory();
+
+ ISelectionPropertiesHandler createSelectionPropertiesHandler(
+ ICustomizationManager customManager);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java
new file mode 100644
index 00000000000..23886e81b66
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass
+ * Nicolas Bros (Mia-Software) - Bug 375388 - Cell editor for IImage
+ * Nicolas Rault (Soft-Maint) - Bug 412565 - Need an URIImage Constructor
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui;
+
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @since 0.2
+ */
+public final class ImageUtils {
+
+ private ImageUtils() {
+ // Must not be used
+ }
+
+ /** Creates an {@link IImage} that wraps the given SWT {@link Image} */
+ public static IImage wrap(final Image image) {
+ return new ImageWrapper(image);
+ }
+
+ /**
+ * Returns the SWT {@link Image} represented by this {@link IImage}
+ *
+ * @param image
+ * the image to unwrap
+ * @return the SWT image, or <code>null</code> if the {@link IImage} doesn't wrap a SWT image
+ */
+ public static Image unwrap(final IImage image) {
+ Image result = null;
+ if (image instanceof ImageWrapper) {
+ final ImageWrapper imageWrapper = (ImageWrapper) image;
+ result = imageWrapper.getImage();
+ }
+ return result;
+ }
+
+ /**
+ * Creates an {@link IImage} that wraps the given uri
+ * @since 0.4
+ */
+ public static IImage wrap(final String uri) {
+ return new URIImage(uri);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java
new file mode 100644
index 00000000000..5d631fdd52f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+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.emf.facet.custom.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java
new file mode 100644
index 00000000000..87922a6a882
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java
@@ -0,0 +1,247 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomFactory;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.custom.ui.internal.exception.CustomizationEditRuntimeException;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResultFactory;
+import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory;
+
+public class CustomizationCommandFactory implements ICustomizationCommandFactory {
+
+ private static final String CONFORM_ATT_NAME = "isConforming"; //$NON-NLS-1$
+ private final EditingDomain editingDomain;
+ private final ICommandFactory commandFactory;
+
+ public CustomizationCommandFactory(final EditingDomain editingDomain, final ICommandFactory commandFactory) {
+ this.editingDomain = editingDomain;
+ this.commandFactory = commandFactory;
+ }
+
+ public ICommandFactoryResult<EClassCustomization> createEClassCustomization(
+ final Customization customization, final EClass customedEClass,
+ final Query conformanceQuery) {
+ final EClassCustomization eClassCustom = CustomFactory.eINSTANCE.createEClassCustomization();
+ final CompoundCommand resultCmd = new CompoundCommand(
+ "Create one instance of EClassCustomization for " + customedEClass.getName()); //$NON-NLS-1$
+ final Command linkToContainer = this.commandFactory
+ .createAddCommand(
+ this.editingDomain,
+ customization,
+ EcorePackage.eINSTANCE
+ .getEPackage_EClassifiers(),
+ eClassCustom);
+ resultCmd.append(linkToContainer);
+ final Command linkToEClass = this.commandFactory
+ .createSetCommand(
+ this.editingDomain,
+ eClassCustom,
+ EFacetPackage.eINSTANCE
+ .getFacet_ExtendedMetaclass(),
+ customedEClass);
+ resultCmd.append(linkToEClass);
+ if (conformanceQuery != null) {
+ final ICommandFactoryResult<FacetAttribute> attResult = createConformanceOperation(eClassCustom, conformanceQuery);
+ resultCmd.append(attResult.getCommand());
+ }
+
+ return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eClassCustom);
+ }
+
+ //TODO Move to FacetCommandFactory
+ private ICommandFactoryResult<FacetAttribute> createConformanceOperation(final Facet facet, final Query query) {
+ final CompoundCommand resultCmd = new CompoundCommand("Creates a facet conformance attribute"); //$NON-NLS-1$
+ final FacetAttribute conformanceAtt = EFacetFactory.eINSTANCE.createFacetAttribute();
+ conformanceAtt.setName(CustomizationCommandFactory.CONFORM_ATT_NAME);
+ conformanceAtt.setEType(EcorePackage.eINSTANCE.getEBoolean());
+ conformanceAtt.setQuery(query);
+ conformanceAtt.setDerived(true);
+
+ final Command conformance = this.commandFactory.createSetCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(), conformanceAtt);
+ resultCmd.append(conformance);
+ final Command addToFacet = this.commandFactory.createAddCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_FacetElements(), conformanceAtt);
+ resultCmd.append(addToFacet);
+ return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, conformanceAtt);
+ }
+
+ public ICommandFactoryResult<FacetCustomization> createFacetCustomization(
+ final Customization customization, final Facet customizedFacet) {
+ final FacetCustomization eFacetCustom = CustomFactory.eINSTANCE.createFacetCustomization();
+ final CompoundCommand resultCmd = new CompoundCommand(
+ "Create one instance of FacetCustomization for " + customizedFacet.getName()); //$NON-NLS-1$
+ final Command linkToContainer = this.commandFactory
+ .createAddCommand(this.editingDomain, customization,
+ EcorePackage.eINSTANCE.getEPackage_EClassifiers(),
+ eFacetCustom);
+ resultCmd.append(linkToContainer);
+ final Command linkToFacet = this.commandFactory
+ .createAddCommand(
+ this.editingDomain,
+ customization,
+ CustomPackage.eINSTANCE
+ .getFacetCustomization_CustomizedFacet(),
+ customizedFacet);
+ resultCmd.append(linkToFacet);
+ return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eFacetCustom);
+ }
+
+ public ICommandFactoryResult<Facet> setPropertyConfig(
+ final Facet typeCustomization,
+ final ETypedElement customizedTElt, // customized typed element
+ final FacetOperation customProperty, final Query query) {
+ final CompoundCommand resultCmd = new CompoundCommand(
+ "Set the value of the customization property '" + customProperty.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$
+ FacetOperation fOpToModifiy = null; // Facet operation to modify
+ for (FacetOperation facetOperation : typeCustomization
+ .getFacetOperations()) {
+ if (facetOperation.getOverride().equals(customProperty)) {
+ fOpToModifiy = facetOperation;
+ }
+ }
+ if (fOpToModifiy == null) {
+ createPropertySetting(typeCustomization, customizedTElt,
+ customProperty, query, resultCmd);
+ } else {
+ final Query fOpQuery = fOpToModifiy.getQuery();
+ if (fOpQuery instanceof ETypedElementSwitchQuery) {
+ final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) fOpQuery;
+ final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query);
+ resultCmd.append(setCase);
+ } else {
+ throw new CustomizationEditRuntimeException();
+ }
+ }
+ return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, typeCustomization);
+ }
+
+ private void createPropertySetting(
+ final Facet typeCustomization,
+ final ETypedElement customizedTElt,
+ final FacetOperation customProperty, final Query query,
+ final CompoundCommand resultCmd) {
+ FacetOperation facetOperation = EFacetFactory.eINSTANCE.createFacetOperation();
+ // link the instance of FacetOperation to its parent
+ final Command linkFOpToParent = this.commandFactory.createAddCommand(
+ this.editingDomain, typeCustomization,
+ EFacetPackage.eINSTANCE.getFacet_FacetOperations(),
+ facetOperation);
+ resultCmd.append(linkFOpToParent);
+ // Link the instance of FacetOperation to the overridden custom property operation.
+ final Command linkToOverride = this.commandFactory.createSetCommand(
+ this.editingDomain, facetOperation,
+ EFacetPackage.eINSTANCE.getDerivedTypedElement_Override(),
+ customProperty);
+ resultCmd.append(linkToOverride);
+ facetOperation.setName(customProperty.getName());
+ facetOperation.setEType(customProperty.getEType());
+ facetOperation.setLowerBound(customProperty.getLowerBound());
+ facetOperation.setUpperBound(customProperty.getUpperBound());
+
+ // add the "eStructuralFeature" EParameter that every customization operation must have
+ final EParameter eParameter = EcoreFactory.eINSTANCE.createEParameter();
+ eParameter.setName("eStructuralFeature"); //$NON-NLS-1$
+ eParameter.setEType(EcorePackage.eINSTANCE.getETypedElement());
+ facetOperation.getEParameters().add(eParameter);
+
+ final ETypedElementSwitchQuery switchQuery = CustomFactory.eINSTANCE.createETypedElementSwitchQuery();
+ // Link the instance of ETypedElementSwitchQuery to its parent
+ final Command switchToParent = this.commandFactory
+ .createSetCommand(this.editingDomain, facetOperation,
+ EFacetPackage.eINSTANCE
+ .getDerivedTypedElement_Query(),
+ switchQuery);
+ resultCmd.append(switchToParent);
+ final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query);
+ resultCmd.append(setCase);
+ }
+
+ private Command setOrCreateETypedElementCase(
+ final ETypedElementSwitchQuery switchQuery,
+ final ETypedElement customizedTElt, final Query query) {
+ final CompoundCommand resultCmd = new CompoundCommand("Set or create an instance of ETypedElementCase"); //$NON-NLS-1$
+ ETypedElementCase caseToModify = getCaseByETypedElement(switchQuery, customizedTElt);
+ if (caseToModify == null) {
+ caseToModify = CustomFactory.eINSTANCE.createETypedElementCase();
+ final Command linkToParent = this.commandFactory.createAddCommand(
+ this.editingDomain, switchQuery,
+ CustomPackage.eINSTANCE.getETypedElementSwitchQuery_Cases(),
+ caseToModify);
+ resultCmd.append(linkToParent);
+ }
+ final Command setCase = this.commandFactory.createSetCommand(
+ this.editingDomain, caseToModify,
+ CustomPackage.eINSTANCE.getETypedElementCase_Case(),
+ customizedTElt);
+ resultCmd.append(setCase);
+ final Command setQuery = this.commandFactory.createSetCommand(
+ this.editingDomain, caseToModify,
+ CustomPackage.eINSTANCE.getETypedElementCase_Value(),
+ query);
+ resultCmd.append(setQuery);
+ return resultCmd;
+ }
+
+ private static ETypedElementCase getCaseByETypedElement(
+ final ETypedElementSwitchQuery switchQuery,
+ final ETypedElement customizedTElt) {
+ ETypedElementCase caseToModify = null;
+ for (ETypedElementCase casee : switchQuery.getCases()) {
+ //casee has to be null if we want to customize the EObject itself.
+ if (casee.getCase() == null) {
+ if (customizedTElt == null) {
+ caseToModify = casee;
+ }
+ } else {
+ if (casee.getCase().equals(customizedTElt)) {
+ caseToModify = casee;
+ break;
+ }
+ }
+ }
+ return caseToModify;
+ }
+
+ public ICommandFactoryResult<Customization> createCustomization(
+ final String name) {
+ final Customization customization = CustomFactory.eINSTANCE
+ .createCustomization();
+ final Command setName = this.commandFactory.createSetCommand(
+ this.editingDomain, customization,
+ EcorePackage.eINSTANCE.getENamedElement_Name(), name);
+ return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(setName, customization);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java
new file mode 100644
index 00000000000..6bb53aa42bd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactoryFactory;
+import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory;
+
+public class CustomizationCommandFactoryFactory implements
+ ICustomizationCommandFactoryFactory {
+
+ public ICustomizationCommandFactory createCustomizationCommandFactory(
+ final EditingDomain editingDomain,
+ final ICommandFactory commandFactory) {
+ return new CustomizationCommandFactory(editingDomain, commandFactory);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java
new file mode 100644
index 00000000000..9276cd8b9aa
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.ICustomizedContentProvider;
+import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory;
+import org.eclipse.emf.facet.custom.ui.ICustomizedTreeContentProvider;
+
+@SuppressWarnings("deprecation")
+//@SuppressWarnings("deprecation") : Bug 380229 - [deprecated] ICustomizedContentProvider
+public class CustomizedContentProviderFactory implements ICustomizedContentProviderFactory {
+
+ public ICustomizedContentProvider createCustomizedContentProvider(final ICustomizationManager customManager) {
+ return new CustomizedTreeContentProvider(customManager);
+ }
+
+ public ICustomizedTreeContentProvider createCustomizedTreeContentProvider(final ICustomizationManager customManager) {
+ return new CustomizedTreeContentProvider(customManager);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java
new file mode 100644
index 00000000000..d7c1f78d84d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Soft-Maint.
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ * David Couvrand (Soft-Maint) - [Customization] NPE for CustomizableLabelProvider when no image found for image customization
+ * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images
+ * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProviderFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.IDecorationContext;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelDecorator;
+import org.eclipse.swt.graphics.Image;
+
+public class CustomizedLabelDecorator extends LabelDecorator {
+
+ private final ICustomizationManager customizationMgr;
+ private final PropertiesHandler propertiesHandler;
+ private final ImageManager imageManager;
+
+ public CustomizedLabelDecorator(final ICustomizationManager customizationMgr) {
+ super();
+ this.customizationMgr = customizationMgr;
+ this.propertiesHandler = new PropertiesHandler(customizationMgr);
+ this.imageManager = new ImageManager();
+ }
+
+ public Image decorateImage(final Image image, final Object element) {
+ return null;
+ }
+
+ public String decorateText(final String text, final Object element) {
+ return null;
+ }
+
+ public void addListener(final ILabelProviderListener listener) {
+ // Nothing to do
+ }
+
+ public void dispose() {
+ // Nothing to do
+ }
+
+ public boolean isLabelProperty(final Object element, final String property) {
+ return false;
+ }
+
+ public void removeListener(final ILabelProviderListener listener) {
+ // Nothing to do
+ }
+
+ @Override
+ public Image decorateImage(final Image image, final Object element,
+ final IDecorationContext context) {
+ Image result = null;
+ if ((image != null) && (element instanceof EObject)) {
+ final IImage bLeftIImage = getPropertyValue(element,
+ this.propertiesHandler.getBottomLeftOverlayProperty(),
+ null, IImage.class);
+ final ImageDescriptor bottomLeftImDesc = this.imageManager
+ .getImageDescriptor(bLeftIImage);
+ final IImage tLeftIImage = getPropertyValue(element,
+ this.propertiesHandler.getTopLeftOverlayProperty(), null,
+ IImage.class);
+ final ImageDescriptor topLeftImDesc = this.imageManager
+ .getImageDescriptor(tLeftIImage);
+ final IImage bRightIImage = getPropertyValue(element,
+ this.propertiesHandler.getBottomRightOverlayProperty(),
+ null, IImage.class);
+ final ImageDescriptor bottomRightImDesc = this.imageManager
+ .getImageDescriptor(bRightIImage);
+ final IImage tRightIImage = getPropertyValue(element,
+ this.propertiesHandler.getTopRightOverlayProperty(), null,
+ IImage.class);
+ final ImageDescriptor topRightImDesc = this.imageManager
+ .getImageDescriptor(tRightIImage);
+ final ImageDescriptor[] overlaysArray = new ImageDescriptor[] {
+ topLeftImDesc, topRightImDesc, bottomLeftImDesc,
+ bottomRightImDesc, null };
+ final DecorationOverlayIcon overlayIcon = new DecorationOverlayIcon(
+ image, overlaysArray);
+ final IImageProvider imageProvider = IImageProviderFactory.DEFAULT
+ .createIImageProvider(Activator.getDefault());
+ result = imageProvider.getImage(overlayIcon);
+ }
+ return result;
+ }
+
+ @Override
+ public String decorateText(final String text, final Object element,
+ final IDecorationContext context) {
+ return null;
+ }
+
+ @Override
+ public boolean prepareDecoration(final Object element,
+ final String originalText, final IDecorationContext context) {
+ return false;
+ }
+
+ private <T> T getPropertyValue(final Object element,
+ final FacetOperation property, final ETypedElement eTypedElement,
+ final Class<T> classs) {
+ return CustomizationUtils.getPropertyValue(this.customizationMgr,
+ element, property, eTypedElement, classs);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java
new file mode 100644
index 00000000000..d9666996d41
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java
@@ -0,0 +1,594 @@
+/**
+ * Copyright (c) 2011, 2012, 2013 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 372198 - resource leak in org.eclipse.emf.facet.custom.ui.internal.CustomizedLabelProvider
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass
+ * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass
+ * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
+ * Vincent Lorenzo (CEA-LIST) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor
+ * Grégoire Dupé(Mia-Software) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor
+ * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider
+ * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IColor;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow;
+import org.eclipse.emf.facet.custom.ui.ICustomOverride;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider;
+import org.eclipse.emf.facet.util.swt.colorprovider.IColorProviderFactory;
+import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider;
+import org.eclipse.emf.facet.util.swt.fontprovider.IFontProviderFactory;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class CustomizedLabelProvider extends CellLabelProvider implements
+ ICustomizedLabelProvider, IStyledLabelProvider {
+
+ private static final boolean DEBUG_FONT = DebugUtils.getDebugStatus(Activator.getDefault(), "font"); //$NON-NLS-1$
+ private static final boolean DEBUG_COLOR = DebugUtils.getDebugStatus(Activator.getDefault(), "color"); //$NON-NLS-1$
+ private static final int RGB_MAX = 255;
+ private static final RGB DEFAULT_BCKGND = new RGB(
+ CustomizedLabelProvider.RGB_MAX, CustomizedLabelProvider.RGB_MAX,
+ CustomizedLabelProvider.RGB_MAX);
+ private static final RGB DEFAULT_FOREGND = new RGB(0, 0, 0);
+ private final ICustomizationManager customManager;
+ private final PropertiesHandler propertiesHandler;
+ private final List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
+ private final ImageManager imageManager;
+ private final ICustomOverride customOverride;
+
+ @Deprecated
+ public CustomizedLabelProvider(final ResourceSet resourceSet) {
+ this(ICustomizationManagerFactory.DEFAULT
+ .getOrCreateICustomizationManager(resourceSet));
+ }
+
+ public CustomizedLabelProvider(final ICustomizationManager customManager) {
+ super();
+ this.customManager = customManager;
+ this.propertiesHandler = new PropertiesHandler(customManager);
+ this.imageManager = new ImageManager();
+ this.customOverride = getICustomOverride();
+ }
+
+ private <T> T getPropertyValue(final Object element,
+ final FacetOperation property, final ETypedElement eTypedElement, final Class<T> classs) {
+ return CustomizationUtils.getPropertyValue(this.customManager, element,
+ property, eTypedElement, classs);
+ }
+
+ public String getText(final Object element) {
+ String result;
+ if (element instanceof EObject) {
+ result = getPropertyValue(element,
+ this.propertiesHandler.getLabelProperty(), null, String.class);
+ } else if (element == null) {
+ result = Messages.CustomizedLabelProvider_null;
+ } else if (element instanceof List<?>) {
+ // Here we do not add any square brackets because the square
+ // brackets are useful to emphases the sublists and here we will non
+ // meet any sublists.
+ final StringBuffer strBuffer = new StringBuffer();
+ final List<?> list = (List<?>) element;
+ final Iterator<?> iter = list.iterator();
+ while (iter.hasNext()) {
+ final Object current = iter.next();
+ strBuffer.append(getText(current));
+ if (iter.hasNext()) {
+ strBuffer.append(", "); //$NON-NLS-1$
+ }
+ }
+ result = strBuffer.toString();
+ } else {
+ result = element.toString();
+ }
+ if (this.customOverride != null) {
+ try {
+ result = this.customOverride.getText(result, element,
+ this.customManager, this.propertiesHandler);
+ } catch (final CustomizationException e) {
+ result = "ERROR, cf. log"; //$NON-NLS-1$
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return result;
+ }
+
+ private static ICustomOverride getICustomOverride() {
+ final Bundle bundle = Activator.getDefault().getBundle();
+ final BundleContext bundleContext = bundle.getBundleContext();
+ final ServiceReference serviceReference = bundleContext
+ .getServiceReference(ICustomOverride.class.getName());
+ final ICustomOverride customOverride = (ICustomOverride) bundleContext
+ .getService(serviceReference);
+ return customOverride;
+ }
+
+ public String getText(final Object object, final ETypedElement eTypedElement) {
+ String result;
+ if (object == null) {
+ result = Messages.CustomizedLabelProvider_null;
+ } else {
+ if (object instanceof EObject) {
+ final EObject eObject = (EObject) object;
+ try {
+ result = this.customManager.getCustomValueOf(eObject,
+ eTypedElement,
+ this.propertiesHandler.getLabelProperty(),
+ String.class);
+ } catch (CustomizationException e) {
+ Logger.logError(e, Activator.getDefault());
+ result = "!!! Error, cf log !!!";
+ }
+ } else {
+ result = object.toString();
+ }
+
+ }
+ return result;
+
+//TODO Remove before to commit
+// if (structuralFeature.getUpperBound() == 1) {
+// final Object object = this.customManager.getFacetManager().get(eObject,
+// structuralFeature, Object.class);
+// result = getText(object);
+// } else {
+// final StringBuffer stringBuffer = new StringBuffer();
+// final List<Object> objects = this.customManager.getFacetManager()
+// .getMultiValued(eObject, structuralFeature, Object.class);
+// final Iterator<Object> objectsIter = objects.iterator();
+// while (objectsIter.hasNext()) {
+// final Object object = objectsIter.next();
+// stringBuffer.append(this.getText(object));
+// if (objectsIter.hasNext()) {
+// stringBuffer.append(", ");
+// }
+// }
+// result = stringBuffer.toString();
+// }
+//TODO (end)
+ }
+
+ @Override
+ public void addListener(final ILabelProviderListener listener) {
+ this.listeners.add(listener);
+ }
+
+ @Override
+ public void dispose() {
+ this.listeners.clear();
+ }
+
+ @Override
+ public boolean isLabelProperty(final Object element, final String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(final ILabelProviderListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ private static Color getColor(final RGB rgb) {
+ final Display display = Display.getDefault();
+ final IColorProvider colorProvider = IColorProviderFactory.DEFAULT
+ .getOrCreateIColorProvider(display);
+ return colorProvider.getColor(rgb);
+ }
+
+ public Color getForeground(final Object element) {
+ final IColor color = getPropertyValue(element,
+ this.propertiesHandler.getForegroundProperty(),
+ null, IColor.class);
+ Color result;
+ if (color == null) {
+ result = getColor(CustomizedLabelProvider.DEFAULT_FOREGND);
+ } else {
+ result = getColor(new RGB(color.getRed(), color.getGreen(),
+ color.getBlue()));
+ }
+ return result;
+ }
+
+ public Color getBackground(final Object element) {
+ final IColor color = getPropertyValue(element,
+ this.propertiesHandler.getBackgroundProperty(), null, IColor.class);
+ Color result;
+ if (color == null) {
+ result = getColor(CustomizedLabelProvider.DEFAULT_BCKGND);
+ } else {
+ result = getColor(new RGB(color.getRed(), color.getGreen(),
+ color.getBlue()));
+ }
+ return result;
+ }
+
+ private Font getFont(final FontData fontData) {
+ final IFontProvider fontProvider = IFontProviderFactory.DEFAULT
+ .getOrCreateIFontProvider(Display.getDefault());
+ return fontProvider.getFont(fontData);
+ }
+
+ public Font getFont(final Object element) {
+
+ String fontName = getPropertyValue(element,
+ this.propertiesHandler.getFontNameProperty(), null, String.class);
+ if (fontName == null) {
+ final FontData[] fontData = Display.getDefault().getSystemFont()
+ .getFontData();
+ fontName = fontData[0].getName();
+ }
+
+ Integer fontSize = getPropertyValue(element,
+ this.propertiesHandler.getFontSizeProperty(), null, Integer.class);
+ if (fontSize == null) {
+ final FontData[] fontData = Display.getDefault().getSystemFont()
+ .getFontData();
+ fontSize = Integer.valueOf(fontData[0].getHeight());
+ }
+
+ Boolean isBold = getPropertyValue(element,
+ this.propertiesHandler.getIsBoldProperty(), null, Boolean.class);
+ if (isBold == null) {
+ isBold = Boolean.FALSE;
+ }
+
+ Boolean isItalic = getPropertyValue(element,
+ this.propertiesHandler.getIsItalicProperty(), null, Boolean.class);
+ if (isItalic == null) {
+ isItalic = Boolean.FALSE;
+ }
+
+ int fontStyle = 0;
+ if (isBold.booleanValue()) {
+ fontStyle = fontStyle | SWT.BOLD;
+ }
+ if (isItalic.booleanValue()) {
+ fontStyle = fontStyle | SWT.ITALIC;
+ }
+ FontData fontData = new FontData(fontName, fontSize.intValue(),
+ fontStyle);
+ try {
+ fontData = this.customOverride.getFont(fontData, element,
+ this.customManager, this.propertiesHandler);
+ } catch (final CustomizationException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ return getFont(fontData);
+ }
+
+ public Image getImage(final Object element) {
+ final IImage image = getPropertyValue(element,
+ this.propertiesHandler.getImageProperty(), null, IImage.class);
+ return this.imageManager.getImage(image);
+ }
+
+ public Image getImage(final Object element, final ETypedElement featureColumn) {
+ return getImage(element, this.propertiesHandler.getImageProperty(), featureColumn);
+ }
+
+ public ICustomizationManager getCustomizationManager() {
+ return this.customManager;
+ }
+
+ public boolean isUnderlined(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getIsUnderlinedProperty(), null, Boolean.class).booleanValue();
+ }
+
+ public boolean isStruckthrough(final Object element,
+ final ETypedElement eTypedElement) {
+ final Boolean propertyValue = getPropertyValue(element,
+ this.propertiesHandler.getIsStruckthroughProperty(),
+ eTypedElement, Boolean.class);
+ boolean result = false;
+ if (propertyValue != null) {
+ result = propertyValue.booleanValue();
+ }
+ return result;
+ }
+
+ private Image getImage(final Object element, final FacetOperation operation, final ETypedElement feature) {
+ final IImage iimage = getPropertyValue(element, operation, feature,
+ IImage.class);
+ return this.imageManager.getImage(iimage);
+ }
+
+ public Image getTopLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getTopLeftOverlayProperty(), eTypedElement);
+ }
+
+ public Image getTopMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getTopMiddleOverlayProperty(), eTypedElement);
+ }
+
+ public Image getTopRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getTopRightOverlayProperty(), eTypedElement);
+ }
+
+ public Image getBottomLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getBottomLeftOverlayProperty(), eTypedElement);
+ }
+
+ public Image getBottomMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getBottomMiddleOverlayProperty(), eTypedElement);
+ }
+
+ public Image getBottomRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getImage(element, this.propertiesHandler.getBottomRightOverlayProperty(), eTypedElement);
+ }
+
+
+ @Override
+ public String getToolTipText(final Object element) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipTextProperty(), null, String.class);
+ }
+
+ @Override
+ public int getToolTipStyle(final Object element) {
+ int style = 0;
+ final Shadow shadow = getPropertyValue(element,
+ this.propertiesHandler.getToolTipShadowProperty(), null,
+ Shadow.class);
+ switch (shadow) {
+ case NONE :
+ style = SWT.SHADOW_NONE;
+ break;
+ case IN :
+ style = SWT.SHADOW_IN;
+ break;
+ case OUT:
+ style = SWT.SHADOW_OUT;
+ break;
+ default:
+ throw new IllegalStateException("Un expected value"); //$NON-NLS-1$
+ }
+
+ final Alignment alignment = getPropertyValue(element,
+ this.propertiesHandler.getToolTipAlignmentProperty(), null,
+ Alignment.class);
+ switch (alignment) {
+ case LEFT:
+ style |= SWT.LEFT;
+ break;
+ case CENTER:
+ style |= SWT.CENTER;
+ break;
+ case RIGHT:
+ style |= SWT.RIGHT;
+ break;
+ default:
+ throw new IllegalStateException("Un expected value"); //$NON-NLS-1$
+ }
+
+ return style;
+ }
+
+ @Override
+ public Image getToolTipImage(final Object element) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipImageProperty(), null, Image.class);
+ }
+
+ @Override
+ public Color getToolTipBackgroundColor(final Object element) {
+ final IColor color = getPropertyValue(element,
+ this.propertiesHandler.getToolTipBackgroundProperty(),
+ null, IColor.class);
+ return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
+ }
+
+ @Override
+ public Color getToolTipForegroundColor(final Object element) {
+ final IColor color = getPropertyValue(element,
+ this.propertiesHandler.getToolTipForegroundProperty(),
+ null, IColor.class);
+ return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
+ }
+
+ public Image getToolTipTopLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipTopLeftOverlayProperty(),
+ null, Image.class);
+ }
+
+ public Image getToolTipTopMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipTopMiddleOverlayProperty(),
+ null, Image.class);
+ }
+
+ public Image getToolTipTopRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipTopRightOverlayProperty(),
+ null, Image.class);
+ }
+
+ public Image getToolTipBottomLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipBottomLeftOverlayProperty(),
+ null, Image.class);
+ }
+
+ public Image getToolTipBottomMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipBottomMiddleOverlayProperty(),
+ null, Image.class);
+ }
+
+ public Image getToolTipBottomRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipBottomRightOverlayProperty(),
+ null, Image.class);
+ }
+
+ @Override
+ public int getToolTipDisplayDelayTime(final Object element) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipDisplayDelayTimeProperty(),
+ null, Integer.class).intValue();
+ }
+
+ @Override
+ public int getToolTipTimeDisplayed(final Object element) {
+ return getPropertyValue(element,
+ this.propertiesHandler.getToolTipTimeDisplayedProperty(), null,
+ Integer.class).intValue();
+
+ }
+
+ @Override
+ public Font getToolTipFont(final Object element) {
+
+ final String fontName = getPropertyValue(element,
+ this.propertiesHandler.getToolTipFontNameProperty(), null,
+ String.class);
+ final Integer fontSize = getPropertyValue(element,
+ this.propertiesHandler.getToolTipFontSizeProperty(), null,
+ Integer.class);
+ final Boolean isBold = getPropertyValue(element,
+ this.propertiesHandler.getToolTipIsBoldProperty(), null,
+ Boolean.class);
+ final Boolean isItalic = getPropertyValue(element,
+ this.propertiesHandler.getToolTipIsItalicProperty(), null,
+ Boolean.class);
+ int fontStyle = 0;
+ if (isBold.booleanValue()) {
+ fontStyle = fontStyle | SWT.BOLD;
+ }
+ if (isItalic.booleanValue()) {
+ fontStyle = fontStyle | SWT.ITALIC;
+ }
+ final FontData fontData = new FontData(fontName, fontSize.intValue(),
+ fontStyle);
+ final IFontProvider fontProvider = IFontProviderFactory.DEFAULT
+ .getOrCreateIFontProvider(Display.getDefault());
+ return fontProvider.getFont(fontData);
+ }
+
+ @Override
+ public void update(final ViewerCell cell) {
+ final Object element = cell.getElement();
+ cell.setText(getText(element));
+ cell.setBackground(getBackground(element));
+ cell.setFont(getFont(element));
+ cell.setForeground(getForeground(element));
+ cell.setImage(getImage(element));
+ }
+
+ public String getToolTipText(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Image getToolTipImage(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Font getToolTipFont(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Color getToolTipBackgroundColor(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Color getToolTipForegroundColor(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getToolTipTimeDisplayed(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getToolTipDisplayDelayTime(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getToolTipStyle(final Object element,
+ final ETypedElement eTypedElement) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public ICustomizedLabelProvider cloneLabelProvider() {
+ return new CustomizedLabelProvider(this.customManager);
+ }
+
+ public StyledString getStyledText(final Object element) {
+ return new StyledString(getText(element));
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java
new file mode 100644
index 00000000000..f0a3cec3a5a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProviderFactory;
+
+public class CustomizedLabelProviderFactory implements
+ ICustomizedLabelProviderFactory {
+
+ public ICustomizedLabelProvider createCustomizedLabelProvider(
+ final ICustomizationManager customizationMgr) {
+ return new DecoratingCustomizedLabelProvider(
+ customizationMgr);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java
new file mode 100644
index 00000000000..31bab479a1e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ * Gregoire Dupe (Mia-Software) - Bug 385292 - [CustomizedTreeContentProvider] StackOverFlow when refreshing a TreeViewer with ICustomizedTreeContentProvider
+ * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory;
+import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandlerFactory;
+import org.eclipse.emf.facet.custom.ui.ICustomizedContentProvider;
+import org.eclipse.emf.facet.custom.ui.ICustomizedTreeContentProvider;
+import org.eclipse.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.viewers.Viewer;
+
+@SuppressWarnings("deprecation")
+// @SuppressWarnings("deprecation") : Bug 380229 - [deprecated] ICustomizedContentProvider
+public class CustomizedTreeContentProvider implements ICustomizedTreeContentProvider, ICustomizedContentProvider {
+
+ private final ICustomizationManager customManager;
+ private final IContentPropertiesHandler contentHandler;
+ private Object previousInput;
+ private Object[] rootElements;
+
+ public CustomizedTreeContentProvider(final ICustomizationManager customManager) {
+ this.customManager = customManager;
+ this.contentHandler = IContentPropertiesHandlerFactory.DEFAULT.createIContentPropertiesHandler(customManager);
+ }
+
+ protected Object[] getRootElements(final Object inputElement) {
+ Object[] result;
+ if (inputElement == null) {
+ result = new Object[0];
+ } else if (inputElement instanceof EObject) {
+ result = new EObject[] { (EObject) inputElement };
+ } else if (inputElement instanceof Collection<?>) {
+ result = ((Collection<?>) inputElement).toArray();
+ } else if (inputElement instanceof EObject[]) {
+ result = (EObject[]) inputElement;
+ } else {
+ throw new IllegalArgumentException("Unhandled input element type: " + inputElement.getClass().getSimpleName()); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public Object[] getElements(final Object inputElement) {
+ Object[] result;
+ if (this.previousInput == inputElement) {
+ result = this.rootElements;
+ } else {
+ this.previousInput = inputElement;
+ final Object[] elements = getRootElements(inputElement);
+ final List<Object> elementList = new ArrayList<Object>();
+ for (final Object element : elements) {
+ if (!isVisible(element, null)) {
+ continue;
+ }
+ if (element instanceof EObject) {
+ final EObjectTreeElement eObjectProxy = createEObjectProxy(element, null);
+ elementList.add(eObjectProxy);
+ } else {
+ elementList.add(element);
+ }
+ }
+ result = elementList.toArray();
+ this.rootElements = result;
+ }
+ return result;
+ }
+
+ protected static EObjectTreeElement createEObjectProxy(
+ final Object element, final EStructuralFeatureTreeElement parent) {
+ final EObject eObject = (EObject) element;
+ final EObjectTreeElement eObjectProxy = TreeproxyFactory.eINSTANCE.createEObjectTreeElement();
+ eObjectProxy.setEObject(eObject);
+ eObjectProxy.setParent(parent);
+ eObject.eAdapters().add(new TreeElementAdapter(eObjectProxy));
+ return eObjectProxy;
+ }
+
+ public Object[] getChildren(final Object parentElement) {
+ Object[] result;
+ if (parentElement == null) {
+ result = new Object[0];
+ } else if (parentElement instanceof EObjectTreeElement) {
+ final EObjectTreeElement eObjectProxy = (EObjectTreeElement) parentElement;
+ result = getChildren(eObjectProxy);
+ } else if (parentElement instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement attributeProxy = (EAttributeTreeElement) parentElement;
+ result = getChildren(attributeProxy);
+ } else if (parentElement instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement referenceProxy = (EReferenceTreeElement) parentElement;
+ result = getChildren(referenceProxy);
+ } else {
+ Logger.logError("Unknown element in tree: " + parentElement.getClass(), Activator.getDefault()); //$NON-NLS-1$
+ result = new Object[0];
+ }
+ return result;
+ }
+
+ private Object[] getChildren(final EObjectTreeElement treeElement) {
+ List<EStructuralFeatureTreeElement> children = treeElement.getSfTreeElmement();
+ if (children == null || children.isEmpty()) {
+ children = new ArrayList<EStructuralFeatureTreeElement>();
+ children.addAll(createAttributes(treeElement));
+ children.addAll(createReferences(treeElement));
+ }
+ return children.toArray();
+ }
+
+ public Object[] getChildren(final EAttributeTreeElement attributeProxy) {
+ final List<Object> children = new ArrayList<Object>();
+ final EAttribute eAttribute = attributeProxy.getEAttribute();
+ if (eAttribute.isMany()) {
+ final TreeElement parent = attributeProxy.getParent();
+ if (!(parent instanceof EObjectTreeElement)) {
+ throw new IllegalStateException("An attribute should appear only under a model element"); //$NON-NLS-1$
+ }
+ final EObjectTreeElement parentProxy = (EObjectTreeElement) parent;
+ final EObject eObject = parentProxy.getEObject();
+
+ try {
+ final IFacetManager facetManager = this.customManager.getFacetManager();
+ final List<Object> result = facetManager.getOrInvokeMultiValued(eObject, eAttribute, null);
+ for (final Object object : result) {
+ if (object instanceof EObject) {
+ final EObject childEObject = (EObject) object;
+ children.add(createEObjectProxy(childEObject, attributeProxy));
+ }
+ children.add(object);
+ }
+ } catch (final FacetManagerException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return children.toArray();
+ }
+
+ public Object[] getChildren(final EReferenceTreeElement referenceProxy) {
+ List<? extends Object> result;
+ final EReference eReference = referenceProxy.getEReference();
+ final TreeElement parent = referenceProxy.getParent();
+ if (!(parent instanceof EObjectTreeElement)) {
+ throw new IllegalStateException("A reference should appear only under a model element"); //$NON-NLS-1$
+ }
+ final EObjectTreeElement parentProxy = (EObjectTreeElement) parent;
+ final EObject eObject = parentProxy.getEObject();
+ if (eReference.isMany()) {
+ result = getMultiValuedReferenceChildren(eReference, eObject, referenceProxy);
+ } else {
+ final Object child = getSingleValuedReferenceChild(eReference, eObject, referenceProxy);
+ if (child == null) {
+ result = Collections.emptyList();
+ } else {
+ result = Collections.singletonList(child);
+ }
+ }
+ return result.toArray();
+ }
+
+ private TreeElement getSingleValuedReferenceChild(final EReference eReference,
+ final EObject eObject, final EReferenceTreeElement parent) {
+ TreeElement child = null;
+ if (parent.getReferedEObjectTE() == null || parent.getReferedEObjectTE().size() == 0) {
+ try {
+ final IFacetManager facetManager = this.customManager
+ .getFacetManager();
+ final EObject referedEObject = facetManager.getOrInvoke(
+ eObject, eReference, EObject.class);
+ if (referedEObject != null) {
+ child = createEObjectProxy(referedEObject, parent);
+ }
+ } catch (final FacetManagerException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ } else {
+ child = parent.getReferedEObjectTE().get(0);
+ }
+ return child;
+ }
+
+ private List<EObjectTreeElement> getMultiValuedReferenceChildren(
+ final EReference eReference, final EObject eObject,
+ final EReferenceTreeElement parent) {
+ List<EObjectTreeElement> children = new ArrayList<EObjectTreeElement>();
+ if (parent.getReferedEObjectTE() == null || parent.getReferedEObjectTE().size() == 0) {
+ try {
+ final IFacetManager facetManager = this.customManager
+ .getFacetManager();
+ final List<Object> result = facetManager
+ .getOrInvokeMultiValued(eObject, eReference, null);
+ for (final Object object : result) {
+ if (object instanceof EObject) {
+ final EObject childEObject = (EObject) object;
+ children.add(createEObjectProxy(childEObject, parent));
+ }
+ }
+ } catch (final FacetManagerException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ } else {
+ children = parent.getReferedEObjectTE();
+ }
+ return children;
+ }
+
+ private Collection<EAttributeTreeElement> createAttributes(final EObjectTreeElement treeElement) {
+ final EObject eObject = treeElement.getEObject();
+ final EClass eClass = eObject.eClass();
+ final IFacetManager facetManager = this.customManager.getFacetManager();
+ final List<EAttribute> allAttributes = new ArrayList<EAttribute>();
+ allAttributes.addAll(eClass.getEAllAttributes());
+ try {
+ final Set<EAttribute> facetAttributes = FacetUtils.getETypedElements(eObject, EAttribute.class, facetManager);
+ allAttributes.addAll(facetAttributes);
+ } catch (final FacetManagerException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ return createAttributeProxies(allAttributes, treeElement);
+ }
+
+ private Collection<EAttributeTreeElement> createAttributeProxies(final List<EAttribute> allAttributes, final EObjectTreeElement parent) {
+ final EObject eObject = parent.getEObject();
+ final List<EAttributeTreeElement> result = new ArrayList<EAttributeTreeElement>();
+ for (final EAttribute eAttribute : allAttributes) {
+ if (isVisible(eObject, eAttribute)) {
+ final EAttributeTreeElement attributeProxy = TreeproxyFactory.eINSTANCE.createEAttributeTreeElement();
+ attributeProxy.setEAttribute(eAttribute);
+ attributeProxy.setParent(parent);
+ result.add(attributeProxy);
+ }
+ }
+ return result;
+ }
+
+ private Collection<EReferenceTreeElement> createReferences(final EObjectTreeElement treeElement) {
+ final EObject eObject = treeElement.getEObject();
+ final EClass eClass = eObject.eClass();
+ final IFacetManager facetManager = this.customManager.getFacetManager();
+ final List<EReference> allReferences = new ArrayList<EReference>();
+ allReferences.addAll(eClass.getEAllReferences());
+ try {
+ final Set<EReference> facetReferences = FacetUtils.getETypedElements(eObject, EReference.class, facetManager);
+ allReferences.addAll(facetReferences);
+ } catch (final FacetManagerException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ return createReferenceProxies(allReferences, treeElement);
+ }
+
+ private Collection<EReferenceTreeElement> createReferenceProxies(final List<EReference> allReferences, final EObjectTreeElement parent) {
+ final EObject eObject = parent.getEObject();
+ final List<EReferenceTreeElement> result = new ArrayList<EReferenceTreeElement>();
+ for (final EReference eReference : allReferences) {
+ if (isVisible(eObject, eReference)) {
+ final EReferenceTreeElement referenceProxy = TreeproxyFactory.eINSTANCE.createEReferenceTreeElement();
+ referenceProxy.setEReference(eReference);
+ referenceProxy.setParent(parent);
+ result.add(referenceProxy);
+ }
+ }
+ return result;
+ }
+
+ public Object getParent(final Object element) {
+ Object result = null;
+ if (element instanceof TreeElement) {
+ final TreeElement treeElement = (TreeElement) element;
+ result = treeElement.eContainer();
+ }
+ return result;
+ }
+
+ public boolean hasChildren(final Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ // nothing to do
+ }
+
+ public ICustomizationManager getCustomizationManager() {
+ return this.customManager;
+ }
+
+ public boolean isVisible(final Object object, final ETypedElement eTypedElement) {
+ Boolean result = Boolean.TRUE;
+ if (object instanceof EObject) {
+ final EObject eObject = (EObject) object;
+ try {
+ result = this.customManager.getCustomValueOf(eObject, eTypedElement, this.contentHandler.getIsVisible(), Boolean.class);
+ } catch (final CustomizationException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return result.booleanValue();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java
new file mode 100644
index 00000000000..55297087f4e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Soft-Maint.
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider;
+import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.IDecorationContext;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+public class DecoratingCustomizedLabelProvider extends
+ DecoratingStyledCellLabelProvider implements ICustomizedLabelProvider {
+
+ private ICustomizedLabelProvider lblProvider;
+
+ private DecoratingCustomizedLabelProvider(
+ final IStyledLabelProvider labelProvider,
+ final ILabelDecorator decorator,
+ final IDecorationContext decorationContext) {
+ super(labelProvider, decorator, decorationContext);
+ }
+
+ public DecoratingCustomizedLabelProvider(
+ final ICustomizationManager customizationMgr) {
+ this(new CustomizedLabelProvider(customizationMgr),
+ new CustomizedLabelDecorator(customizationMgr), null);
+ this.lblProvider = (ICustomizedLabelProvider) getStyledStringProvider();
+ }
+
+ public String getText(final Object element) {
+ return this.lblProvider.getText(element);
+ }
+
+ public String getToolTipText(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipText(element, eTypedElement);
+ }
+
+ public Image getToolTipImage(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipImage(element, eTypedElement);
+ }
+
+ public Font getToolTipFont(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipFont(element, eTypedElement);
+ }
+
+ public Color getToolTipBackgroundColor(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipBackgroundColor(element,
+ eTypedElement);
+ }
+
+ public Color getToolTipForegroundColor(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipForegroundColor(element,
+ eTypedElement);
+ }
+
+ public Image getToolTipTopLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider
+ .getToolTipTopLeftOverlay(element, eTypedElement);
+ }
+
+ public Image getToolTipTopMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipTopMiddleOverlay(element,
+ eTypedElement);
+ }
+
+ public Image getToolTipTopRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipTopRightOverlay(element,
+ eTypedElement);
+ }
+
+ public Image getToolTipBottomLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipBottomLeftOverlay(element,
+ eTypedElement);
+ }
+
+ public Image getToolTipBottomMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipBottomMiddleOverlay(element,
+ eTypedElement);
+ }
+
+ public Image getToolTipBottomRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipBottomRightOverlay(element,
+ eTypedElement);
+ }
+
+ public int getToolTipTimeDisplayed(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipTimeDisplayed(element, eTypedElement);
+ }
+
+ public int getToolTipDisplayDelayTime(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipDisplayDelayTime(element,
+ eTypedElement);
+ }
+
+ public int getToolTipStyle(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getToolTipStyle(element, eTypedElement);
+ }
+
+ public ICustomizationManager getCustomizationManager() {
+ return this.lblProvider.getCustomizationManager();
+ }
+
+ public boolean isUnderlined(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.isUnderlined(element, eTypedElement);
+ }
+
+ public boolean isStruckthrough(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.isStruckthrough(element, eTypedElement);
+ }
+
+ public Image getTopLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getTopLeftOverlay(element, eTypedElement);
+ }
+
+ public Image getTopMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getTopMiddleOverlay(element, eTypedElement);
+ }
+
+ public Image getTopRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getTopRightOverlay(element, eTypedElement);
+ }
+
+ public Image getBottomLeftOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getBottomLeftOverlay(element, eTypedElement);
+ }
+
+ public Image getBottomMiddleOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getBottomMiddleOverlay(element, eTypedElement);
+ }
+
+ public Image getBottomRightOverlay(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getBottomRightOverlay(element, eTypedElement);
+ }
+
+ public String getText(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getText(element, eTypedElement);
+ }
+
+ public Image getImage(final Object element,
+ final ETypedElement eTypedElement) {
+ return this.lblProvider.getImage(element, eTypedElement);
+ }
+
+ public ICustomizedLabelProvider cloneLabelProvider() {
+ return this.lblProvider.cloneLabelProvider();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java
new file mode 100644
index 00000000000..56c7bef23b5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.ui.ICustomOverride;
+import org.eclipse.emf.facet.custom.ui.IFontPropertiesHandler;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.swt.graphics.FontData;
+
+public class DefaultCustomOverride implements ICustomOverride {
+
+ public String getText(final String result, final Object object,
+ final ICustomizationManager customManager,
+ final IFontPropertiesHandler propertiesHandler)
+ throws CustomizationException {
+ String newResult = result;
+ if (object instanceof EObject) {
+ final EObject eObject = (EObject) object;
+ final FacetOperation isStruckProp = propertiesHandler
+ .getIsStruckthroughProperty();
+ final boolean isStruckthrough = customManager.getCustomValueOf(
+ eObject, isStruckProp, Boolean.class).booleanValue();
+ if (isStruckthrough) {
+ newResult = String.format("--%s--", newResult); //$NON-NLS-1$
+ }
+ final FacetOperation isUnderlinedProp = propertiesHandler
+ .getIsUnderlinedProperty();
+ final boolean isUnderlined = customManager.getCustomValueOf(
+ eObject, isUnderlinedProp, Boolean.class).booleanValue();
+ if (isUnderlined) {
+ newResult = String.format("__%s__", newResult); //$NON-NLS-1$
+ }
+ }
+ return newResult;
+ }
+
+ public FontData getFont(final FontData fontData, final Object object,
+ final ICustomizationManager customManager,
+ final IFontPropertiesHandler propertiesHandler) {
+ return fontData;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java
new file mode 100644
index 00000000000..256a26fb565
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Soft-Maint.
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
+
+public class ImageManager {
+
+ private final Map<String, ImageDescriptor> uriImageCache = new HashMap<String, ImageDescriptor>();
+
+ private Image getImage(final URIImage uriImage) {
+ Image result;
+ final String uriStr = uriImage.getUri();
+ ImageDescriptor imageDescriptor;
+ if (this.uriImageCache.keySet().contains(uriStr)) {
+ imageDescriptor = this.uriImageCache.get(uriStr);
+ } else {
+ imageDescriptor = createImageDescriptor(uriStr);
+ this.uriImageCache.put(uriStr, imageDescriptor);
+ }
+ final IImageProvider imageProvider = IImageProviderFactory.DEFAULT
+ .createIImageProvider(Activator.getDefault());
+ result = imageProvider.getImage(imageDescriptor);
+ return result;
+ }
+
+
+ private ImageDescriptor createImageDescriptor(final String uriStr) {
+ ImageDescriptor imgDecriptor;
+ final URI uri = URI.createURI(uriStr);
+ final String bundleId = uri.segment(1);
+ final Bundle bundle = Platform.getBundle(bundleId);
+ final URI baseURI = URI.createPlatformPluginURI(bundleId + '/',
+ false);
+ final String resourcePath = uri.deresolve(baseURI).toString();
+ final URL url = bundle.getResource(resourcePath);
+
+ if (url == null) {
+ Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$
+ resourcePath), Activator.getDefault());
+ imgDecriptor = ImageDescriptor.getMissingImageDescriptor();
+ } else {
+ imgDecriptor = ImageDescriptor.createFromURL(url);
+ }
+ return imgDecriptor;
+ }
+
+
+ public Image getImage(final IImage image) {
+ Image result = null;
+ final Device device = PlatformUI.getWorkbench().getDisplay();
+ if (image instanceof ImageWrapper) {
+ final ImageWrapper wrapper = (ImageWrapper) image;
+ result = wrapper.getImage();
+ } else if (image instanceof URIImage) {
+ final URIImage uriImage = (URIImage) image;
+ result = getImage(uriImage);
+ } else if (image != null) {
+ result = new Image(device, image.getInputStream());
+ }
+ return result;
+ }
+
+ public ImageDescriptor getImageDescriptor(final IImage image) {
+ ImageDescriptor result = null;
+ if (image instanceof URIImage) {
+ final URIImage uriImage = (URIImage) image;
+ result = createImageDescriptor(uriImage.getUri());
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java
new file mode 100644
index 00000000000..a8bfc3eabda
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) - bug 341238 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import java.net.URL;
+
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/** A singleton image provider, which caches image descriptors */
+public final class ImageProvider {
+
+ private ImageProvider() {
+ // This class must only be instantiated by getInstance().
+ }
+
+ private static ImageProvider instance;
+
+ public static ImageProvider getInstance() {
+ if (ImageProvider.instance == null) {
+ ImageProvider.instance = new ImageProvider();
+ }
+ return ImageProvider.instance;
+ }
+
+ private Image uiCustomIcon = null;
+ private Image grayedUiCustomIcon;
+
+ private Image linkIcon = null;
+ private Image linkUniDirIcon = null;
+ private Image linkFacetIcon = null;
+ private Image aggregIcon = null;
+ private Image aggregUniDirIcon = null;
+ private Image invAggregIcon = null;
+
+ private Image attributeIcon = null;
+ private Image attribFacetIcon = null;
+ private Image featureIcon = null;
+
+ private static final String UI_CUSTOM = "icons/uiCustom.gif"; //$NON-NLS-1$
+
+ private static final String AGGREG_UNIDIR = "icons/aggreg_unidir.gif"; //$NON-NLS-1$
+ private static final String AGGREG_ICON_PATH = "icons/aggreg.gif"; //$NON-NLS-1$
+ private static final String ATTRIBUTE_FACET = "icons/attribute_facet"; //$NON-NLS-1$
+ private static final String ATTRIBUTE = "icons/attributes.gif"; //$NON-NLS-1$
+ private static final String INV_AGGREG = "icons/inv_aggreg.gif"; //$NON-NLS-1$
+ private static final String LINK_FACET = "icons/link_unidir_facet.gif"; //$NON-NLS-1$
+ private static final String LINK_UNIDIR = "icons/link_unidir.gif"; //$NON-NLS-1$
+ private static final String LINK_ICON_PATH = "icons/link.gif"; //$NON-NLS-1$
+ private static final String FEATURE_ICON_PATH = "icons/feature.gif"; //$NON-NLS-1$
+
+ /**
+ * Create an image descriptor from a resource
+ *
+ * @param resourcePath
+ * the path of the resource (in the bundle)
+ * @return the image descriptor
+ */
+ private static ImageDescriptor createImageDescriptor(final String resourcePath) {
+ final URL url = Activator.getDefault().getBundle().getResource(resourcePath);
+ ImageDescriptor result;
+ if (url == null) {
+ Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$
+ resourcePath), Activator.getDefault());
+ result = ImageDescriptor.getMissingImageDescriptor();
+ } else {
+ result = ImageDescriptor.createFromURL(url);
+ }
+ return result;
+ }
+
+ /** Return an icon for "uiCustom" */
+ public Image getUiCustomIcon() {
+ if (this.uiCustomIcon == null) {
+ this.uiCustomIcon = createImageDescriptor(ImageProvider.UI_CUSTOM)
+ .createImage();
+ }
+ return this.uiCustomIcon;
+ }
+
+ public Image getGrayedUiCustomIcon() {
+ if (this.grayedUiCustomIcon == null) {
+ this.grayedUiCustomIcon = new Image(Display.getCurrent(), getUiCustomIcon(), SWT.IMAGE_GRAY);
+ }
+ return this.grayedUiCustomIcon;
+ }
+
+ /** Return the icon representing a bidirectional link */
+ public Image getLinkIcon() {
+ if (this.linkIcon == null) {
+ this.linkIcon = createImageDescriptor(ImageProvider.LINK_ICON_PATH).createImage();
+ }
+ return this.linkIcon;
+ }
+
+ /** Return the icon representing an unidirectional link */
+ public Image getUnidirectionalLinkIcon() {
+ if (this.linkUniDirIcon == null) {
+ this.linkUniDirIcon = createImageDescriptor(ImageProvider.LINK_UNIDIR)
+ .createImage();
+ }
+ return this.linkUniDirIcon;
+ }
+
+ /** Return the icon representing a facet reference */
+ public Image getFacetLinkIcon() {
+ if (this.linkFacetIcon == null) {
+ this.linkFacetIcon = createImageDescriptor(ImageProvider.LINK_FACET)
+ .createImage();
+ }
+ return this.linkFacetIcon;
+ }
+
+ /** Return the icon representing a composition link */
+ public Image getAggregIcon() {
+ if (this.aggregIcon == null) {
+ this.aggregIcon = createImageDescriptor(ImageProvider.AGGREG_ICON_PATH).createImage();
+ }
+ return this.aggregIcon;
+ }
+
+ /** Return the icon representing an unidirectional composition link */
+ public Image getUnidirectionalAggregIcon() {
+ if (this.aggregUniDirIcon == null) {
+ this.aggregUniDirIcon = createImageDescriptor(ImageProvider.AGGREG_UNIDIR)
+ .createImage();
+ }
+ return this.aggregUniDirIcon;
+ }
+
+ /** Return the icon representing a reverse composition link */
+ public Image getInvAggregIcon() {
+ if (this.invAggregIcon == null) {
+ this.invAggregIcon = createImageDescriptor(ImageProvider.INV_AGGREG)
+ .createImage();
+ }
+ return this.invAggregIcon;
+ }
+
+ /** Return the "attribute" icon */
+ public Image getAttributeIcon() {
+ if (this.attributeIcon == null) {
+ this.attributeIcon = createImageDescriptor(ImageProvider.ATTRIBUTE)
+ .createImage();
+ }
+ return this.attributeIcon;
+ }
+
+ /** Return the "facet attribute" icon */
+ public Image getFacetAttributeIcon() {
+ if (this.attribFacetIcon == null) {
+ this.attribFacetIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_FACET)
+ .createImage();
+ }
+ return this.attribFacetIcon;
+ }
+
+ /** Return the "feature" icon */
+ public Image getFeatureIcon() {
+ if (this.featureIcon == null) {
+ this.featureIcon = createImageDescriptor(ImageProvider.FEATURE_ICON_PATH).createImage();
+ }
+ return this.featureIcon;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java
new file mode 100644
index 00000000000..7ec996a3eae
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.emf.facet.custom.ui.internal.messages"; //$NON-NLS-1$
+ public static String CustomizationsCatalogView_title;
+ public static String CustomizationsView_allQuerySets;
+ public static String CustomizationsView_jobName_RefreshCustomizationsView;
+ public static String CustomizationsView_extendsColumn;
+ public static String CustomizationsView_nameColumn;
+ public static String CustomizationsView_documentationColumn;
+ public static String CustomizedLabelProvider_null;
+ public static String NewCustomizationFilePage_browserCustomization;
+ public static String NewCustomizationFilePage_createsBrowserCustomization;
+ public static String NewCustomizationFilePage_customizationInNonEmfFacetProject;
+ public static String NewCustomizationWizard_newBrowserCustomization;
+ public static String QuerySetsSelectionControl_allExistingQuerySets;
+ public static String QuerySetsSelectionControl_availableQuerySets;
+ public static String QuerySetsSelectionControl_deselectAll;
+ public static String QuerySetsSelectionControl_querySetsSelectedBelowOnly;
+ public static String QuerySetsSelectionControl_selectAll;
+ public static String SelectMetamodelsPage_selectMetamodel;
+ public static String SelectMetamodelsPage_selectMetamodelToCustomize;
+ public static String SelectQuerySetsPage_selectAvailableQuerySets;
+ public static String SelectQuerySetsPage_selectAvailableQuerySetsInCustomization;
+ public static String LoadCustomizationsDialog_Add;
+ public static String LoadCustomizationsDialog_Add2;
+ public static String LoadCustomizationsDialog_AddAll;
+ public static String LoadCustomizationsDialog_AddAll2;
+ public static String LoadCustomizationsDialog_AvailiableCustom;
+ public static String LoadCustomizationsDialog_Can_not_be_unload;
+ public static String LoadCustomizationsDialog_Down;
+ public static String LoadCustomizationsDialog_LoadedCustomizations;
+ public static String LoadCustomizationsDialog_LoadCustomizationWarning;
+ public static String LoadCustomizationsDialog_Loading;
+ public static String LoadCustomizationsDialog_loadReferencedFacetsCheckbox;
+ public static String LoadCustomizationsDialog_OK;
+ public static String LoadCustomizationsDialog_Remove;
+ public static String LoadCustomizationsDialog_Remove2;
+ public static String LoadCustomizationsDialog_RemoveAll;
+ public static String LoadCustomizationsDialog_RemoveAll2;
+ public static String LoadCustomizationsDialog_title_LoadCustomizations;
+ public static String LoadCustomizationsDialog_type_filter_test;
+ public static String LoadCustomizationsDialog_Up;
+ public static String ToolTipTextQuery_Documentation;
+ public static String ToolTipTextQuery_NoDocumentation;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ // cannot be instantiated
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java
new file mode 100644
index 00000000000..a409999742a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java
@@ -0,0 +1,302 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization
+ * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.IFontPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandler;
+import org.eclipse.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+public class PropertiesHandler implements IContentPropertiesHandler,
+ ILabelPropertiesHandler, ISelectionPropertiesHandler, IFontPropertiesHandler {
+ private static final String SEPARATOR = "::"; //$NON-NLS-1$
+ private static final String CUSTOM_PROPERTIES = "resources/customproperties.efacet"; //$NON-NLS-1$
+
+ private static final String CUSTOM = "CustomizedEObject"; //$NON-NLS-1$
+ private static final String TT_CUSTOM = "CustomizedToolTipEObject"; //$NON-NLS-1$
+
+ private static final String IMAGE = "image"; //$NON-NLS-1$
+ private static final String LABEL = "label"; //$NON-NLS-1$
+ private static final String BACKGROUND = "background"; //$NON-NLS-1$
+ private static final String FOREGROUND = "foreground"; //$NON-NLS-1$
+ private static final String FONT = "fontName"; //$NON-NLS-1$
+ private static final String FONT_SIZE = "fontSize"; //$NON-NLS-1$
+ private static final String IS_BOLD = "isBold"; //$NON-NLS-1$
+ private static final String IS_ITALIC = "isItalic"; //$NON-NLS-1$
+ private static final String IS_VISIBLE = "isVisible"; //$NON-NLS-1$
+ private static final String IS_UNDERLINED = "isUnderlined"; //$NON-NLS-1$
+ private static final String IS_STRUCKTHROUGH = "isStruckthrough"; //$NON-NLS-1$
+ private static final String TOP_L_OVERLAY = "topLeftOverlay"; //$NON-NLS-1$
+ private static final String TOP_M_OVERLAY = "topMiddleOverlay"; //$NON-NLS-1$
+ private static final String TOP_R_OVERLAY = "topRightOverlay"; //$NON-NLS-1$
+ private static final String BOTTOM_L_OVERLAY = "bottomLeftOverlay"; //$NON-NLS-1$
+ private static final String BOTTOM_M_OVERLAY = "bottomMiddleOverlay"; //$NON-NLS-1$
+ private static final String BOTTOM_R_OVERLAY = "bottomRightOverlay"; //$NON-NLS-1$
+ private static final String SELECTION = "selection"; //$NON-NLS-1$
+
+ //for tooltips
+ private static final String TEXT = "text"; //$NON-NLS-1$
+ private static final String TIME_DISPLAYED = "timeDisplayed"; //$NON-NLS-1$
+ private static final String DISPLAY_DELAY = "displayDelayTime"; //$NON-NLS-1$
+ private static final String SHADOW = "shadow"; //$NON-NLS-1$
+ private static final String ALIGNMENT = "alignment"; //$NON-NLS-1$
+
+ private final Resource resource;
+ private final Map<String, FacetOperation> map = new HashMap<String, FacetOperation>();
+
+ /**
+ *
+ * @deprecated Must be replaced by
+ * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandler
+ * .PropertiesHandler(ICustomizationManager)
+ */
+ @Deprecated
+ public PropertiesHandler(final ResourceSet resourceSet) {
+ final String bundleName = Activator.getDefault().getBundle().getSymbolicName();
+ URI propertiesUri = URI.createPlatformPluginURI(bundleName, true);
+ propertiesUri = propertiesUri
+ .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$
+ this.resource = resourceSet.getResource(propertiesUri, true);
+ }
+
+ public PropertiesHandler(final ICustomizationManager customizationMgr) {
+ final String bundleName = Activator.getDefault().getBundle().getSymbolicName();
+ URI propertiesUri = URI.createPlatformPluginURI(bundleName, true);
+ propertiesUri = propertiesUri
+ .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$
+ final ResourceSet resourceSet = customizationMgr.getResourceSet();
+ this.resource = resourceSet.getResource(propertiesUri, true);
+ final FacetSet facetSet = (FacetSet) this.resource.getContents().get(0);
+ customizationMgr.getFacetManager().getManagedFacetSets()
+ .add(0, facetSet);
+ }
+
+ private FacetOperation getPropertyByName(final String facetName,
+ final String propertyName) {
+ final String key = facetName + PropertiesHandler.SEPARATOR + propertyName;
+ FacetOperation result = this.map.get(key);
+ if (result == null) {
+ final FacetSet facetSet = (FacetSet) this.resource.getContents()
+ .get(0);
+ final Facet facet = FacetUtils.getFacet(
+ FacetUtils.getFacets(facetSet),
+ facetName);
+ final ETypedElement eTypedElement = FacetUtils
+ .getETypedElement(facet, propertyName,
+ ETypedElement.class);
+ if (eTypedElement instanceof FacetOperation) {
+ result = (FacetOperation) eTypedElement;
+ this.map.put(key, result);
+ }
+ }
+ return result;
+ }
+
+ public FacetOperation getImageProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IMAGE);
+ }
+
+ public FacetOperation getLabelProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.LABEL);
+ }
+
+ public FacetOperation getBackgroundProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.BACKGROUND);
+ }
+
+ public FacetOperation getForegroundProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.FOREGROUND);
+ }
+
+ public FacetOperation getFontNameProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.FONT);
+ }
+
+ public FacetOperation getFontSizeProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.FONT_SIZE);
+ }
+
+ public FacetOperation getIsBoldProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IS_BOLD);
+ }
+
+ public FacetOperation getIsItalicProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IS_ITALIC);
+ }
+
+ public FacetOperation getIsVisible() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IS_VISIBLE);
+ }
+
+ public FacetOperation getIsUnderlinedProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IS_UNDERLINED);
+ }
+
+ public FacetOperation getIsStruckthroughProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.IS_STRUCKTHROUGH);
+ }
+
+ public FacetOperation getTopLeftOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.TOP_L_OVERLAY);
+ }
+
+ public FacetOperation getTopMiddleOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.TOP_M_OVERLAY);
+ }
+
+ public FacetOperation getTopRightOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.TOP_R_OVERLAY);
+ }
+
+ public FacetOperation getBottomLeftOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.BOTTOM_L_OVERLAY);
+ }
+
+ public FacetOperation getBottomMiddleOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.BOTTOM_M_OVERLAY);
+ }
+
+ public FacetOperation getBottomRightOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.BOTTOM_R_OVERLAY);
+ }
+
+ public FacetOperation getSelectionProperty() {
+ return getPropertyByName(PropertiesHandler.CUSTOM,
+ PropertiesHandler.SELECTION);
+ }
+
+ // methods for tooltips
+ public FacetOperation getToolTipTextProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.TEXT);
+ }
+
+ public FacetOperation getToolTipImageProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.IMAGE);
+ }
+
+ public FacetOperation getToolTipFontNameProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.FONT);
+ }
+
+ public FacetOperation getToolTipFontSizeProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.FONT_SIZE);
+ }
+
+ public FacetOperation getToolTipIsBoldProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.IS_BOLD);
+ }
+
+ public FacetOperation getToolTipIsItalicProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.IS_ITALIC);
+ }
+
+ public FacetOperation getToolTipBackgroundProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.BACKGROUND);
+ }
+
+ public FacetOperation getToolTipForegroundProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.FOREGROUND);
+ }
+
+ public FacetOperation getToolTipTopLeftOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.TOP_L_OVERLAY);
+ }
+
+ public FacetOperation getToolTipTopMiddleOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.TOP_M_OVERLAY);
+ }
+
+ public FacetOperation getToolTipTopRightOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.TOP_R_OVERLAY);
+ }
+
+ public FacetOperation getToolTipBottomLeftOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.BOTTOM_L_OVERLAY);
+ }
+
+ public FacetOperation getToolTipBottomMiddleOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.BOTTOM_M_OVERLAY);
+ }
+
+ public FacetOperation getToolTipBottomRightOverlayProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.BOTTOM_R_OVERLAY);
+ }
+
+ public FacetOperation getToolTipTimeDisplayedProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.TIME_DISPLAYED);
+ }
+
+ public FacetOperation getToolTipDisplayDelayTimeProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.DISPLAY_DELAY);
+ }
+
+ public FacetOperation getToolTipAlignmentProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.ALIGNMENT);
+ }
+
+ public FacetOperation getToolTipShadowProperty() {
+ return getPropertyByName(PropertiesHandler.TT_CUSTOM,
+ PropertiesHandler.SHADOW);
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java
new file mode 100644
index 00000000000..cc545fc4445
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization
+ */
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandlerFactory;
+import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandlerFactory;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandler;
+import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandlerFactory;
+
+public class PropertiesHandlerFactory implements
+ IContentPropertiesHandlerFactory, ILabelPropertiesHandlerFactory, ISelectionPropertiesHandlerFactory {
+
+ /**
+ * @deprecated must be replaced by
+ * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory
+ * .createIContentPropertiesHandler(ICustomizationManager)
+ */
+ @Deprecated
+ public IContentPropertiesHandler createIContentPropertiesHandler(
+ final ResourceSet resourceSet) {
+ return new PropertiesHandler(resourceSet);
+ }
+
+ public IContentPropertiesHandler createIContentPropertiesHandler(
+ final ICustomizationManager customizationMgr) {
+ return new PropertiesHandler(customizationMgr);
+ }
+
+ public ILabelPropertiesHandler createLabelPropertiesHandler(
+ final ICustomizationManager customizationMgr) {
+ return new PropertiesHandler(customizationMgr);
+ }
+
+ public ISelectionPropertiesHandler createSelectionPropertiesHandler(final ICustomizationManager customManager) {
+ return new PropertiesHandler(customManager);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java
new file mode 100644
index 00000000000..d7780646b26
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
+import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+public class ResolvingCustomizedLabelProvider implements ICustomizedLabelProvider {
+
+ private final ICustomizedLabelProvider delegate;
+
+ public ResolvingCustomizedLabelProvider(final ICustomizedLabelProvider delegate) {
+ super();
+ this.delegate = delegate;
+ }
+
+ public Image getImage(final Object element) {
+ Image image;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ image = this.delegate.getImage(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ image = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ image = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element));
+ }
+ return image;
+ }
+
+ public String getText(final Object element) {
+ String result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getText(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element));
+ }
+ return result;
+ }
+
+ public void addListener(final ILabelProviderListener listener) {
+ this.delegate.addListener(listener);
+ }
+
+ public void dispose() {
+ this.delegate.dispose();
+ }
+
+ public boolean isLabelProperty(final Object element, final String property) {
+ return this.delegate.isLabelProperty(CustomizedContentProviderUtils.resolve(element), property);
+ }
+
+ public void removeListener(final ILabelProviderListener listener) {
+ this.delegate.removeListener(listener);
+ }
+
+ public Color getForeground(final Object element) {
+ return this.delegate.getForeground(CustomizedContentProviderUtils.resolve(element));
+ }
+
+ public Color getBackground(final Object element) {
+ return this.delegate.getBackground(CustomizedContentProviderUtils.resolve(element));
+ }
+
+ public Font getFont(final Object element) {
+ return this.delegate.getFont(CustomizedContentProviderUtils.resolve(element));
+ }
+
+ public void update(final ViewerCell cell) {
+ this.delegate.update(cell);
+ }
+
+ public String getToolTipText(final Object element, final ETypedElement eTypedElement) {
+ String result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipText(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipImage(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipImage(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Font getToolTipFont(final Object element, final ETypedElement eTypedElement) {
+ Font result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipFont(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Color getToolTipBackgroundColor(final Object element, final ETypedElement eTypedElement) {
+ Color result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipBackgroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Color getToolTipForegroundColor(final Object element, final ETypedElement eTypedElement) {
+ Color result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipForegroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipTopLeftOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipTopRightOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getToolTipBottomRightOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public int getToolTipTimeDisplayed(final Object element, final ETypedElement eTypedElement) {
+ int result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipTimeDisplayed(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public int getToolTipDisplayDelayTime(final Object element, final ETypedElement eTypedElement) {
+ int result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipDisplayDelayTime(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public int getToolTipStyle(final Object element, final ETypedElement eTypedElement) {
+ int result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getToolTipStyle(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public ICustomizationManager getCustomizationManager() {
+ return this.delegate.getCustomizationManager();
+ }
+
+ public boolean isUnderlined(final Object element, final ETypedElement eTypedElement) {
+ boolean result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.isUnderlined(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public boolean isStruckthrough(final Object element, final ETypedElement eTypedElement) {
+ boolean result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.isStruckthrough(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getTopLeftOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getTopRightOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getBottomRightOverlay(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public String getText(final Object element, final ETypedElement eTypedElement) {
+ String result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getText(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public Image getImage(final Object element, final ETypedElement eTypedElement) {
+ Image result;
+ if (element instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement treeElement = (EReferenceTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getImage(parent.getEObject(), treeElement.getEReference());
+ } else if (element instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement treeElement = (EAttributeTreeElement) element;
+ final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent();
+ result = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute());
+ } else {
+ result = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element), eTypedElement);
+ }
+ return result;
+ }
+
+ public ICustomizedLabelProvider cloneLabelProvider() {
+ return new ResolvingCustomizedLabelProvider(this.delegate.cloneLabelProvider());
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java
new file mode 100644
index 00000000000..3fc33a36cfd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider;
+import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory;
+
+public class ResolvingCustomizedLabelProviderFactory implements IResolvingCustomizedLabelProviderFactory {
+
+ public ICustomizedLabelProvider createCustomizedLabelProvider(final ICustomizationManager customManager) {
+ return new ResolvingCustomizedLabelProvider(
+ new DecoratingCustomizedLabelProvider(
+ customManager));
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java
new file mode 100644
index 00000000000..1598f4bff78
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement;
+import org.eclipse.emf.facet.custom.ui.internal.exception.CustomizedContentProviderRuntimeException;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.osgi.util.NLS;
+
+public class TreeElementAdapter implements Adapter {
+
+ private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator
+ .getDefault());
+
+ private final EObjectTreeElement treeElement;
+
+ public TreeElementAdapter(final EObjectTreeElement treeElement) {
+ this.treeElement = treeElement;
+ }
+
+ public void notifyChanged(final Notification notification) {
+ DebugUtils.debug(DEBUG,
+ "Modified element=" + this.treeElement.getEObject()); //$NON-NLS-1$
+ DebugUtils.debug(DEBUG,
+ "Notification feature=" + notification.getFeature()); //$NON-NLS-1$
+ for (EStructuralFeatureTreeElement subElement : this.treeElement
+ .getSfTreeElmement()) {
+ final EStructuralFeature feature = getSF(subElement);
+ if (feature.equals(notification.getFeature())) {
+ subElement.getReferedEObjectTE().clear();
+ DebugUtils.debug(
+ DEBUG,
+ NLS.bind(
+ "Cleanning= {0}::{1}", //$NON-NLS-1$
+ feature.getContainerClass().getName(),
+ feature.getName()));
+ }
+ }
+ }
+
+ private static EStructuralFeature getSF(
+ final EStructuralFeatureTreeElement structFeatuteTE) {
+ EStructuralFeature result;
+ if (structFeatuteTE instanceof EAttributeTreeElement) {
+ final EAttributeTreeElement eAttributeTE = (EAttributeTreeElement) structFeatuteTE;
+ result = eAttributeTE.getEAttribute();
+ } else if (structFeatuteTE instanceof EReferenceTreeElement) {
+ final EReferenceTreeElement eReferenceTE = (EReferenceTreeElement) structFeatuteTE;
+ result = eReferenceTE.getEReference();
+ } else {
+ throw new CustomizedContentProviderRuntimeException(
+ "Illegal agrument: " + structFeatuteTE); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public Notifier getTarget() {
+ return null;
+ }
+
+ public void setTarget(final Notifier newTarget) {
+ // Nothing to do
+ }
+
+ public boolean isAdapterForType(final Object type) {
+ return false;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java
new file mode 100644
index 00000000000..fb8208b4f6a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ */
+package org.eclipse.emf.facet.custom.ui.internal.custompt;
+
+import org.eclipse.emf.facet.custom.metamodel.custompt.IColor;
+
+public class Color implements IColor {
+
+ private static final long serialVersionUID = 240076770346261769L;
+ private static final int BYTE_SIZE = Byte.SIZE;
+ private static final int TWO_BYTE_SIZE = Byte.SIZE * 2;
+ public static final int MAX_VALUE = 255;
+
+ private final int red;
+ private final int green;
+ private final int blue;
+
+ public Color(final int red, final int green, final int blue) {
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
+ }
+
+ public Color getColor() {
+ return this.getColor();
+ }
+
+ public int getRed() {
+ return this.red;
+ }
+
+ public int getGreen() {
+ return this.green;
+ }
+
+ public int getBlue() {
+ return this.blue;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ boolean result = false;
+ if (obj instanceof Color) {
+ final Color color = (Color) obj;
+ result = (color.getRed() == this.red)
+ && (color.getGreen() == this.green)
+ && (color.getBlue() == this.blue);
+ }
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.red & (this.green << Color.BYTE_SIZE)
+ & (this.blue << Color.TWO_BYTE_SIZE);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java
new file mode 100644
index 00000000000..d625315610c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass
+ */
+package org.eclipse.emf.facet.custom.ui.internal.custompt;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+
+public class ImageWrapper implements IImage {
+
+ private static final long serialVersionUID = -2538802017710069448L;
+ private final Image wrappedImage;
+
+ public ImageWrapper(final Image image) {
+ this.wrappedImage = image;
+ }
+
+ public InputStream getInputStream() {
+ // note: this is an inefficient way to get an inputStream from the wrapped Image
+ final ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ final ImageLoader loader = new ImageLoader();
+ loader.data = new ImageData[] { this.wrappedImage.getImageData() };
+ loader.save(stream, SWT.IMAGE_PNG);
+ final byte[] byteArray = stream.toByteArray();
+ return new ByteArrayInputStream(byteArray);
+ }
+
+ public Image getImage() {
+ return this.wrappedImage;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java
new file mode 100644
index 00000000000..281d2341668
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ */
+package org.eclipse.emf.facet.custom.ui.internal.custompt;
+
+import java.io.InputStream;
+
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+
+public class URIImage implements IImage {
+
+ private static final long serialVersionUID = 6801140731857137834L;
+ private String uri;
+
+ public URIImage(final String uri) {
+ this.uri = uri;
+ }
+
+ public InputStream getInputStream() {
+ return null;
+ }
+
+ public String getUri() {
+ return this.uri;
+ }
+
+ public void setUri(final String uri) {
+ this.uri = uri;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java
new file mode 100644
index 00000000000..b26f4d8636c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.dialog;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.ImageProvider;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+public class ColorLabelProvider extends LabelProvider implements IColorProvider {
+
+ private final LoadCustomizationsDialog loadCustomDialog;
+
+ public ColorLabelProvider(final LoadCustomizationsDialog loadCustomDialog) {
+ super();
+ this.loadCustomDialog = loadCustomDialog;
+ }
+
+ @Override
+ public String getText(final Object element) {
+ final Customization customization = (Customization) element;
+ return customization.getName();
+ }
+
+ @Override
+ public Image getImage(final Object element) {
+ Image result;
+ if (this.loadCustomDialog.getLockedCustoms().contains(element)) {
+ result = ImageProvider.getInstance().getGrayedUiCustomIcon();
+ } else {
+ result = ImageProvider.getInstance().getUiCustomIcon();
+ }
+ return result;
+ }
+
+ public Color getForeground(final Object element) {
+ Color result = null;
+ if (this.loadCustomDialog.getLockedCustoms().contains(element)) {
+ result = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY);
+ }
+ return result;
+ }
+
+ public Color getBackground(final Object element) {
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java
new file mode 100644
index 00000000000..11fb06c9481
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java
@@ -0,0 +1,699 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010, 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) - Bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.Messages;
+import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog;
+import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+public class LoadCustomizationsDialog<D> extends Dialog implements
+ ILoadCustomizationsDialog<D> {
+
+ private static final int TREE_WIDTH = 300;
+ private static final int TREE_HEIGHT = 250;
+ private static final int NUM_COLUMNS = 4;
+ private final List<Customization> availableCustoms;
+ private final LabelProvider labelProvider;
+ private final IContentProvider contentProvider = new ITreeContentProvider() {
+
+ public Object[] getElements(final Object inputElement) {
+ @SuppressWarnings("unchecked")
+ final List<Customization> customizations = (List<Customization>) inputElement;
+ return customizations.toArray();
+ }
+
+ public void inputChanged(final Viewer viewer, final Object oldInput,
+ final Object newInput) {
+ // nothing
+ }
+
+ public void dispose() {
+ // nothing
+ }
+
+ public Object[] getChildren(final Object parentElement) {
+ return new Object[]{};
+ }
+
+ public Object getParent(final Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(final Object element) {
+ return false;
+ }
+ };
+ private final EList<Customization> selectedCustomizations;
+ private TreeViewer availableCustomizationsTreeViewer;
+ private TreeViewer selectedCustomizationsTreeViewer;
+ private Button addButton;
+ private Button removeButton;
+ private Button addAllButton;
+ private Button removeAllButton;
+ private Button upButton;
+ private Button downButton;
+ private Button loadRequiredFacetsCheckbox;
+ private boolean loadRequiredFacetsSelected = false;
+ private final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback;
+ private final List<Customization> lockedCustoms;
+ private final String lockMsg;
+
+ public LoadCustomizationsDialog(final Shell parent,
+ final List<Customization> availableCustomizations,
+ final List<Customization> selectedCustoms,
+ final List<Customization> lockedCustoms,
+ final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback,
+ final String lockMsg) {
+ super(parent);
+ this.labelProvider = new ColorLabelProvider(this);
+ this.callback = callback;
+ this.selectedCustomizations = new BasicEList<Customization>();
+ this.availableCustoms = new ArrayList<Customization>(availableCustomizations);
+ this.lockedCustoms = lockedCustoms;
+ this.lockMsg = lockMsg;
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
+ // initial selection
+ for (final Customization initiallySelectedCustomization : selectedCustoms) {
+ final URI initiallySelectedCustomizationURI = EcoreUtil
+ .getURI(initiallySelectedCustomization);
+ final ListIterator<Customization> availableCustomizationsIterator = this.availableCustoms
+ .listIterator();
+ while (availableCustomizationsIterator.hasNext()) {
+ final Customization availableCustomization = availableCustomizationsIterator
+ .next();
+ final URI availableCustomizationURI = EcoreUtil
+ .getURI(availableCustomization);
+ if (availableCustomizationURI
+ .equals(initiallySelectedCustomizationURI)) {
+ availableCustomizationsIterator.remove();
+ LoadCustomizationsDialog.this.selectedCustomizations
+ .add(initiallySelectedCustomization);
+ }
+
+ }
+ }
+ for (Customization lockedCustom : this.lockedCustoms) {
+ if (!this.selectedCustomizations.contains(lockedCustom)) {
+ this.selectedCustomizations.add(lockedCustom);
+ }
+ }
+//TODO: Remove before to commit
+// LoadCustomizationsDialog.this.availableCustomizationsTreeViewer
+// .refresh();
+// LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer
+// .refresh();
+//TODO(end): Remove before to commit
+ }
+
+ //TODO Remove before to commit
+ /** Keep only customizations that apply to the given metamodel */
+ /*
+ private List<Customization> filterForMetamodel(
+ final Collection<Customization> allCustomizations, final Collection<EPackage> ePackages) {
+ List<Customization> filteredCustomizations = new ArrayList<Customization>();
+
+ // show only Customizations corresponding to the current EPackages or
+ // referenced EPackages
+ final Set<EPackage> allReferencedPackages = new HashSet<EPackage>();
+
+ for (EPackage ePackage : ePackages) {
+ allReferencedPackages.add(ePackage);
+ final Set<EPackage> referencedPackages = ModelUtils.computeReferencedPackages(ePackage);
+ allReferencedPackages.addAll(referencedPackages);
+ }
+
+ for (Customization metamodelView : Customization) {
+ String nsURI = metamodelView.getMetamodelURI();
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
+ while (ePackage != null) {
+ if (allReferencedPackages.contains(ePackage)) {
+ filteredCustomizations.add(metamodelView);
+ break;
+ }
+ // allow customizations on Facets
+ if (ePackage instanceof FacetSet) {
+ FacetSet facetSet = (FacetSet) ePackage;
+ ePackage = facetSet.getExtendedPackage();
+ } else {
+ // allow customizations on sub-packages
+ ePackage = ePackage.getESuperPackage();
+ }
+ }
+ }
+ return filteredCustomizations;
+ }
+ */
+ //TODO (end) Remove before to commit
+
+ @Override
+ protected void configureShell(final Shell shell) {
+ super.configureShell(shell);
+ shell.setText(Messages.LoadCustomizationsDialog_title_LoadCustomizations);
+ }
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ final Composite contents = (Composite) super.createDialogArea(parent);
+
+ final GridLayout contentsGridLayout = (GridLayout) contents.getLayout();
+ contentsGridLayout.numColumns = LoadCustomizationsDialog.NUM_COLUMNS;
+
+ final GridData contentsGridData = (GridData) contents.getLayoutData();
+ contentsGridData.horizontalAlignment = SWT.FILL;
+ contentsGridData.verticalAlignment = SWT.FILL;
+
+ createLeftPane(contents);
+ createMiddleButtonsPane(contents);
+ createRightPane(contents);
+ createRightButtonsPane(contents);
+ createLoadRequiredFacetsCheckbox(contents);
+
+ this.availableCustomizationsTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(final DoubleClickEvent event) {
+ loadSelectedCustoms();
+ }
+ });
+
+ this.selectedCustomizationsTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(final DoubleClickEvent event) {
+ unloadSelectedCustoms();
+ }
+ });
+
+ this.upButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ upButtonClicked();
+ }
+ });
+
+ this.downButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ downButtonClicked();
+ }
+ });
+
+ this.addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ loadSelectedCustoms();
+ }
+ });
+
+ this.addAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ addAllButtonClicked();
+ }
+ });
+
+ this.removeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ unloadSelectedCustoms();
+ }
+ });
+
+ this.removeAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ removeAllButtonClicked();
+ }
+ });
+
+ return contents;
+ }
+
+ public final void upButtonClicked() {
+ final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer
+ .getSelection();
+ int minIndex = 0;
+ for (Object selectedObject : selection.toList()) {
+ if (selectedObject instanceof Customization) {
+ final Customization customization = (Customization) selectedObject;
+ final int index = this.selectedCustomizations
+ .indexOf(customization);
+ this.selectedCustomizations.move(
+ Math.max(index - 1, minIndex++), customization);
+ }
+ }
+ LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.refresh();
+ }
+
+ public final void downButtonClicked() {
+ final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer
+ .getSelection();
+ final ArrayList<Object> selectedObjects = new ArrayList<Object>();
+ for (final Object selectedObject : selection.toArray()) {
+ selectedObjects.add(selectedObject);
+ }
+
+ // prevent the last two elements from swapping
+ boolean canMove = !selectedObjects
+ .contains(LoadCustomizationsDialog.this.selectedCustomizations
+ .get(LoadCustomizationsDialog.this.selectedCustomizations.size() - 1));
+ for (int i = LoadCustomizationsDialog.this.selectedCustomizations.size() - 2; i >= 0; i--) {
+ final Customization selectedCustomization = LoadCustomizationsDialog.this.selectedCustomizations
+ .get(i);
+ if (selectedObjects.contains(selectedCustomization)) {
+ if (canMove) {
+ LoadCustomizationsDialog.this.selectedCustomizations.move(i + 1,
+ selectedCustomization);
+ }
+ } else {
+ canMove = true;
+ }
+
+ }
+
+ LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.refresh();
+ }
+
+ public final void loadSelectedCustoms() {
+ final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.availableCustomizationsTreeViewer
+ .getSelection();
+ for (Object object : selection.toList()) {
+ if (object instanceof Customization) {
+ final Customization custom = (Customization) object;
+ if (!this.selectedCustomizations.contains(custom)) {
+ this.selectedCustomizations.add(custom);
+ this.availableCustoms.remove(custom);
+ }
+ }
+ }
+ refresh();
+ this.selectedCustomizationsTreeViewer.setSelection(selection);
+ }
+
+ public final void addAllButtonClicked() {
+ final ListIterator<Customization> listIterator = this.availableCustoms
+ .listIterator();
+ while (listIterator.hasNext()) {
+ final Customization element = listIterator.next();
+ this.selectedCustomizations.add(element);
+ listIterator.remove();
+ }
+ refresh();
+ }
+
+ public final void unloadSelectedCustoms() {
+ final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer
+ .getSelection();
+ final List<Customization> toBeRemoved = new ArrayList<Customization>();
+ boolean lockedCustomFound = false;
+ for (Object object : selection.toList()) {
+ if (this.lockedCustoms.contains(object)) {
+ lockedCustomFound = true;
+ } else if (object instanceof Customization) {
+ final Customization element = (Customization) object;
+ toBeRemoved.add(element);
+ }
+ }
+ if (lockedCustomFound) {
+ final MessageDialog dialog = new MessageDialog(
+ null,
+ Messages.LoadCustomizationsDialog_LoadCustomizationWarning,
+ null,
+ Messages.LoadCustomizationsDialog_Can_not_be_unload + this.lockMsg,
+ MessageDialog.WARNING, new String[] { Messages.LoadCustomizationsDialog_OK }, 1);
+ dialog.open();
+ }
+ removeFromSelection(toBeRemoved);
+ refresh();
+ }
+
+ protected void removeFromSelection(final List<Customization> toBeRemoved) {
+ for (final Customization element : toBeRemoved) {
+ LoadCustomizationsDialog.this.selectedCustomizations.remove(element);
+ LoadCustomizationsDialog.this.availableCustoms.add(element);
+ }
+ if (LoadCustomizationsDialog.this.selectedCustomizations.size() > 0) {
+ LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer
+ .setSelection(new StructuredSelection(
+ LoadCustomizationsDialog.this.selectedCustomizations.get(0)));
+ }
+ }
+
+ public final void removeAllButtonClicked() {
+ removeFromSelection(this.selectedCustomizations);
+ refresh();
+ }
+
+ private void createLeftPane(final Composite contents) {
+ final Composite choiceComposite = new Composite(contents, SWT.NONE);
+ final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.horizontalAlignment = SWT.END;
+ choiceComposite.setLayoutData(data);
+
+ final GridLayout layout = new GridLayout();
+ data.horizontalAlignment = SWT.FILL;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 1;
+ choiceComposite.setLayout(layout);
+
+ final Label choiceLabel = new Label(choiceComposite, SWT.NONE);
+ choiceLabel.setText(Messages.LoadCustomizationsDialog_AvailiableCustom);
+
+ final GridData choiceLabelGridData = new GridData();
+ choiceLabelGridData.verticalAlignment = SWT.FILL;
+ choiceLabelGridData.horizontalAlignment = SWT.FILL;
+ choiceLabel.setLayoutData(choiceLabelGridData);
+
+ final Text patternText = createFilterText(choiceComposite);
+
+ final Tree availableCustomizationsTree = new Tree(choiceComposite, SWT.MULTI | SWT.BORDER);
+ final GridData availableCustomizationsGridData = new GridData();
+ availableCustomizationsGridData.widthHint = LoadCustomizationsDialog.TREE_WIDTH;
+ availableCustomizationsGridData.heightHint = LoadCustomizationsDialog.TREE_HEIGHT;
+ availableCustomizationsGridData.horizontalAlignment = SWT.FILL;
+ availableCustomizationsGridData.verticalAlignment = SWT.FILL;
+ availableCustomizationsGridData.grabExcessHorizontalSpace = true;
+ availableCustomizationsGridData.grabExcessVerticalSpace = true;
+ availableCustomizationsTree.setLayoutData(availableCustomizationsGridData);
+
+ this.availableCustomizationsTreeViewer = new TreeViewer(availableCustomizationsTree);
+ this.availableCustomizationsTreeViewer.setContentProvider(this.contentProvider);
+ this.availableCustomizationsTreeViewer.setLabelProvider(this.labelProvider);
+ final PatternFilter filter = new PatternFilter();
+ this.availableCustomizationsTreeViewer.addFilter(filter);
+
+ this.availableCustomizationsTreeViewer.setInput(this.availableCustoms);
+
+ //TODO Remove before to commit
+// final TreeItem treeItem = new TreeItem(availableCustomizationsTree, SWT.NONE);
+// treeItem.setText(Messages.LoadCustomizationsDialog_Loading);
+ //TODO (end) Remove before to commit
+
+ patternText.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ filter.setPattern(patternText.getText());
+ LoadCustomizationsDialog.this.availableCustomizationsTreeViewer.refresh();
+ }
+ });
+ }
+
+ private void createMiddleButtonsPane(final Composite contents) {
+ final Composite buttonsComposite = new Composite(contents, SWT.NONE);
+ final GridData buttonsCompositeGridData = new GridData();
+ buttonsCompositeGridData.verticalAlignment = SWT.CENTER;
+ buttonsCompositeGridData.horizontalAlignment = SWT.FILL;
+ buttonsComposite.setLayoutData(buttonsCompositeGridData);
+ buttonsComposite.setLayout(new GridLayout());
+
+ // new Label(buttonsComposite, SWT.NONE);
+
+ this.addButton = new Button(buttonsComposite, SWT.PUSH);
+ this.addButton.setText(Messages.LoadCustomizationsDialog_Add);
+ this.addButton.setToolTipText(Messages.LoadCustomizationsDialog_Add2);
+ final GridData addButtonGridData = new GridData();
+ addButtonGridData.verticalAlignment = SWT.FILL;
+ addButtonGridData.horizontalAlignment = SWT.FILL;
+ this.addButton.setLayoutData(addButtonGridData);
+
+ this.removeButton = new Button(buttonsComposite, SWT.PUSH);
+ this.removeButton.setText(Messages.LoadCustomizationsDialog_Remove);
+ this.removeButton.setToolTipText(Messages.LoadCustomizationsDialog_Remove2);
+ final GridData removeButtonGridData = new GridData();
+ removeButtonGridData.verticalAlignment = SWT.FILL;
+ removeButtonGridData.horizontalAlignment = SWT.FILL;
+ this.removeButton.setLayoutData(removeButtonGridData);
+
+ spacer(buttonsComposite);
+
+ this.addAllButton = new Button(buttonsComposite, SWT.PUSH);
+ this.addAllButton.setText(Messages.LoadCustomizationsDialog_AddAll);
+ this.addAllButton.setToolTipText(Messages.LoadCustomizationsDialog_AddAll2);
+
+ this.removeAllButton = new Button(buttonsComposite, SWT.PUSH);
+ this.removeAllButton.setText(Messages.LoadCustomizationsDialog_RemoveAll);
+ this.removeAllButton.setToolTipText(Messages.LoadCustomizationsDialog_RemoveAll2);
+ }
+
+ private static void spacer(final Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ }
+
+ private void createRightButtonsPane(final Composite contents) {
+ final Composite buttonsComposite = new Composite(contents, SWT.NONE);
+ final GridData buttonsCompositeGridData = new GridData();
+ buttonsCompositeGridData.verticalAlignment = SWT.FILL;
+ buttonsCompositeGridData.horizontalAlignment = SWT.FILL;
+ buttonsComposite.setLayoutData(buttonsCompositeGridData);
+ buttonsComposite.setLayout(new GridLayout());
+
+ // spacer
+ spacer(buttonsComposite);
+
+ this.upButton = new Button(buttonsComposite, SWT.PUSH);
+ this.upButton.setText(Messages.LoadCustomizationsDialog_Up);
+ final GridData upButtonGridData = new GridData();
+ upButtonGridData.verticalAlignment = SWT.FILL;
+ upButtonGridData.horizontalAlignment = SWT.FILL;
+ this.upButton.setLayoutData(upButtonGridData);
+
+ this.downButton = new Button(buttonsComposite, SWT.PUSH);
+ this.downButton.setText(Messages.LoadCustomizationsDialog_Down);
+ final GridData downButtonGridData = new GridData();
+ downButtonGridData.verticalAlignment = SWT.FILL;
+ downButtonGridData.horizontalAlignment = SWT.FILL;
+ this.downButton.setLayoutData(downButtonGridData);
+ }
+
+ private void createRightPane(final Composite contents) {
+ final Composite featureComposite = new Composite(contents, SWT.NONE);
+ final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ featureCompositeData.horizontalAlignment = SWT.END;
+ featureComposite.setLayoutData(featureCompositeData);
+
+ final GridLayout featureCompositeLayout = new GridLayout();
+ featureCompositeData.horizontalAlignment = SWT.FILL;
+ featureCompositeLayout.marginHeight = 0;
+ featureCompositeLayout.marginWidth = 0;
+ featureCompositeLayout.numColumns = 1;
+ featureComposite.setLayout(featureCompositeLayout);
+
+ final Label featureLabel = new Label(featureComposite, SWT.NONE);
+ featureLabel.setText(Messages.LoadCustomizationsDialog_LoadedCustomizations);
+ final GridData featureLabelGridData = new GridData();
+ featureLabelGridData.horizontalSpan = 2;
+ featureLabelGridData.horizontalAlignment = SWT.FILL;
+ featureLabelGridData.verticalAlignment = SWT.FILL;
+ featureLabel.setLayoutData(featureLabelGridData);
+
+ final Tree loadedCustomizationsTree = new Tree(featureComposite, SWT.MULTI | SWT.BORDER);
+ final GridData loadedCustomizationsGridData = new GridData();
+ loadedCustomizationsGridData.widthHint = LoadCustomizationsDialog.TREE_WIDTH;
+ loadedCustomizationsGridData.heightHint = LoadCustomizationsDialog.TREE_HEIGHT;
+ loadedCustomizationsGridData.verticalAlignment = SWT.FILL;
+ loadedCustomizationsGridData.horizontalAlignment = SWT.FILL;
+ loadedCustomizationsGridData.grabExcessHorizontalSpace = true;
+ loadedCustomizationsGridData.grabExcessVerticalSpace = true;
+ loadedCustomizationsTree.setLayoutData(loadedCustomizationsGridData);
+
+ this.selectedCustomizationsTreeViewer = new TreeViewer(loadedCustomizationsTree);
+ this.selectedCustomizationsTreeViewer.setContentProvider(this.contentProvider);
+ this.selectedCustomizationsTreeViewer.setLabelProvider(this.labelProvider);
+ this.selectedCustomizationsTreeViewer.setInput(this.selectedCustomizations);
+ }
+
+ private void createLoadRequiredFacetsCheckbox(final Composite contents) {
+ spacer(contents);
+ spacer(contents);
+ this.loadRequiredFacetsCheckbox = new Button(contents, SWT.CHECK);
+ this.loadRequiredFacetsCheckbox
+ .setText(Messages.LoadCustomizationsDialog_loadReferencedFacetsCheckbox);
+ this.loadRequiredFacetsCheckbox.setSelection(true);
+ this.loadRequiredFacetsCheckbox
+ .setLayoutData(new GridData(SWT.END, SWT.FILL, false, false));
+
+ }
+
+ private static Text createFilterText(final Composite contents) {
+ final Text patternText = new Text(contents, SWT.BORDER | SWT.SEARCH);
+ patternText.setMessage(Messages.LoadCustomizationsDialog_type_filter_test);
+ patternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return patternText;
+ }
+
+ @Override
+ protected void okPressed() {
+ pressOk();
+ }
+
+ public void commit(final Boolean result) {
+ this.callback.committed(this.selectedCustomizations, result);
+ super.okPressed();
+ }
+
+ public boolean isLoadRequiredFacetsSelected() {
+ return this.loadRequiredFacetsSelected;
+ }
+
+ // @Override
+ // public boolean close() {
+ // fContentProvider.dispose();
+ // return super.close();
+ // }
+
+ public List<Customization> getSelectedCustomizations() {
+ return this.selectedCustomizations;
+ }
+
+ private void refresh() {
+ LoadCustomizationsDialog.this.availableCustomizationsTreeViewer.refresh();
+ LoadCustomizationsDialog.this.selectedCustomizationsTreeViewer.refresh();
+ }
+
+ public void asyncOpen() {
+ Display display;
+ if (this.getShell() == null) {
+ display = Display.getDefault();
+ } else {
+ display = this.getShell().getDisplay();
+ }
+ display.asyncExec(new Runnable() {
+ public void run() {
+ LoadCustomizationsDialog.this.open();
+ }
+ });
+ }
+
+ public D pressOk() {
+ this.loadRequiredFacetsSelected = this.loadRequiredFacetsCheckbox
+ .getSelection();
+ final D preCommitDialog = this.callback
+ .openPrecommitDialog(this.selectedCustomizations,
+ new IDialogCallback<Boolean>() {
+ public void committed(final Boolean result) {
+ if (result.booleanValue()) {
+ LoadCustomizationsDialog.this
+ .commit(result);
+ }
+ }
+ });
+ if (preCommitDialog == null) {
+ this.callback.committed(this.selectedCustomizations, Boolean.TRUE);
+ super.okPressed();
+ }
+ return preCommitDialog;
+ }
+
+ public void selectAvailableCustom(final Customization customization) {
+ final ISelection selection = new StructuredSelection(customization);
+ this.availableCustomizationsTreeViewer.setSelection(selection);
+ }
+
+ public void selectSelectedCustom(final Customization customization) {
+ final ISelection selection = new StructuredSelection(customization);
+ this.selectedCustomizationsTreeViewer.setSelection(selection);
+
+ }
+
+ public List<Customization> getLockedCustoms() {
+ return this.lockedCustoms;
+ }
+
+ public void addCustomization(final Customization customization)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCustomizations(final List<Customization> customizations)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeCustomization(final Customization customization)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeCustomizations(final List<Customization> customizations)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void cancel() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void validate() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public List<Customization> getAvailableCustomizations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void pushUp(final Customization customization)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void pushDown(final Customization customization)
+ throws IllegalParameterException {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java
new file mode 100644
index 00000000000..63173a9d2cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.dialog;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog;
+import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.swt.widgets.Shell;
+
+public class LoadCustomizationsDialogFactory implements ILoadCustomizationsDialogFactory {
+
+ public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(
+ final Shell parent,
+ final List<Customization> availableCustoms,
+ final List<Customization> selectedCustoms,
+ final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback) {
+ return new SynchronizedLoadCustomizationsDialog(parent,
+ availableCustoms, selectedCustoms,
+ Collections.<Customization> emptyList(), callback, ""); //$NON-NLS-1$
+ }
+
+ public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(
+ final Shell parent,
+ final List<Customization> availableCustoms,
+ final List<Customization> selectedCustoms,
+ final List<Customization> lockedCustoms,
+ final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback,
+ final String lockMsg) {
+ return new SynchronizedLoadCustomizationsDialog(parent,
+ availableCustoms, selectedCustoms, lockedCustoms, callback,
+ lockMsg);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java
new file mode 100644
index 00000000000..0090c63ee36
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java
@@ -0,0 +1,222 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.emf.facet.custom.ui.internal.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog;
+import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidRunnable;
+import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class SynchronizedLoadCustomizationsDialog<D> extends
+ SynchronizedObject<LoadCustomizationsDialog<D>> implements
+ ILoadCustomizationsDialog<D> { // NOPMD by gdupe on 03/02/12 12:13 - We cannot do more. This class is a facade/wrapper of an other class.
+
+ public SynchronizedLoadCustomizationsDialog(final Shell parent,
+ final List<Customization> availableCustoms,
+ final List<Customization> selectedCustoms,
+ final List<Customization> lockedCustoms,
+ final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback,
+ final String lockMsg) {
+ super(new LoadCustomizationsDialog(parent, availableCustoms,
+ selectedCustoms, lockedCustoms, callback, lockMsg),
+ initDisplay(parent));
+ }
+
+ private static Display initDisplay(final Shell parent) {
+ Display display;
+ if (parent == null) {
+ display = Display.getDefault();
+ } else {
+ display = parent.getDisplay();
+ }
+ return display;
+ }
+
+ public int open() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() {
+ @Override
+ public Integer safeRun() {
+ return Integer.valueOf(SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().open());
+ }
+ }).intValue();
+ }
+
+ public void asyncOpen() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().asyncOpen();
+ }
+ });
+ }
+
+ public D pressOk() {
+ return this.safeSyncExec(new AbstractExceptionFreeRunnable<D>() {
+ @Override
+ public D safeRun() {
+ return SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().pressOk();
+ }
+ });
+ }
+
+ public void selectAvailableCustom(final Customization customization) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().selectAvailableCustom(
+ customization);
+ }
+ });
+ }
+
+ public void loadSelectedCustoms() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().loadSelectedCustoms();
+ }
+ });
+ }
+
+ public void selectSelectedCustom(final Customization customization) {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().selectSelectedCustom(
+ customization);
+ }
+ });
+ }
+
+ public void unloadSelectedCustoms() {
+ this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ SynchronizedLoadCustomizationsDialog.this
+ .getSynchronizedObject().unloadSelectedCustoms();
+ }
+ });
+ }
+
+ public void addCustomization(final Customization customization)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().addCustomization(customization);
+ }
+ });
+ }
+
+ public void addCustomizations(final List<Customization> customizations)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().addCustomizations(customizations);
+ }
+ });
+ }
+
+ public void removeCustomization(final Customization customization)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().removeCustomization(customization);
+ }
+ });
+ }
+
+ public void removeCustomizations(final List<Customization> customizations)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().removeCustomizations(customizations);
+ }
+ });
+ }
+
+ public void cancel() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ getSynchronizedObject().cancel();
+ }
+ });
+ }
+
+ public void validate() {
+ voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() {
+ @Override
+ public void voidSafeRun() {
+ getSynchronizedObject().validate();
+ }
+ });
+ }
+
+ public List<Customization> getSelectedCustomizations() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() {
+ @Override
+ public List<Customization> safeRun() {
+ return getSynchronizedObject().getSelectedCustomizations();
+ }
+ });
+ }
+
+ public List<Customization> getAvailableCustomizations() {
+ return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() {
+ @Override
+ public List<Customization> safeRun() {
+ return getSynchronizedObject().getAvailableCustomizations();
+ }
+ });
+ }
+
+ public void pushUp(final Customization customization)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().pushUp(customization);
+ }
+ });
+ }
+
+ public void pushDown(final Customization customization)
+ throws IllegalParameterException {
+ voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() {
+ @Override
+ public void voidRun() throws IllegalParameterException {
+ getSynchronizedObject().pushDown(customization);
+ }
+ });
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java
new file mode 100644
index 00000000000..611c7050bff
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java
@@ -0,0 +1,35 @@
+
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exception;
+
+public class CustomizationEditRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -632229513667261515L;
+
+ public CustomizationEditRuntimeException() {
+ super();
+ }
+
+ public CustomizationEditRuntimeException(final String message) {
+ super(message);
+ }
+
+ public CustomizationEditRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public CustomizationEditRuntimeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java
new file mode 100644
index 00000000000..6aa3a9eae21
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.exception;
+
+public class CustomizedContentProviderRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 6962461313131533003L;
+
+ public CustomizedContentProviderRuntimeException() {
+ super();
+ }
+
+ public CustomizedContentProviderRuntimeException(final String message) {
+ super(message);
+ }
+
+ public CustomizedContentProviderRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public CustomizedContentProviderRuntimeException(final String message,
+ final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java
new file mode 100644
index 00000000000..91e19a330eb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.exported;
+
+/**
+ * @since 0.2
+ */
+public final class CustomizationUIConstants {
+
+ private static final String CATALOG_VIEW_ID = "org.eclipse.emf.facet.custom.ui.view.catalog"; //$NON-NLS-1$
+
+ private CustomizationUIConstants() {
+ // utility class
+ }
+
+ public static String getCustomizationCatalogViewId() {
+ return CustomizationUIConstants.CATALOG_VIEW_ID;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java
new file mode 100644
index 00000000000..bf65605d96e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+
+public interface ICustomizationCommandFactory {
+
+ ICommandFactoryResult<Customization> createCustomization(
+ String name);
+
+ ICommandFactoryResult<EClassCustomization> createEClassCustomization(
+ Customization customization, EClass customedEClass, Query conformanceQuery);
+
+ ICommandFactoryResult<FacetCustomization> createFacetCustomization(
+ Customization customization, Facet customizedFacet);
+
+ ICommandFactoryResult<Facet> setPropertyConfig(Facet typeCustomization,
+ ETypedElement customizedTElt, // customized typed element
+ FacetOperation customProperty,
+ Query query);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java
new file mode 100644
index 00000000000..0f01063623f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.ui.internal.CustomizationCommandFactoryFactory;
+import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory;
+
+public interface ICustomizationCommandFactoryFactory {
+
+ ICustomizationCommandFactoryFactory DEFAULT = new CustomizationCommandFactoryFactory();
+
+ ICustomizationCommandFactory createCustomizationCommandFactory(
+ EditingDomain editingDomain, ICommandFactory commandFactory);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java
new file mode 100644
index 00000000000..9cab557ed30
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+
+/**
+ *
+ * @since 0.2
+ *
+ */
+public interface ILabelPropertiesHandler {
+ FacetOperation getLabelProperty();
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java
new file mode 100644
index 00000000000..9d0684710f3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported;
+
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory;
+
+/**
+ *
+ * @since 0.2
+ *
+ */
+public interface ILabelPropertiesHandlerFactory {
+
+ ILabelPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory();
+
+ ILabelPropertiesHandler createLabelPropertiesHandler(
+ ICustomizationManager customizationMgr);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java
new file mode 100644
index 00000000000..e6303ae5666
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException;
+
+/**
+ * A dialog to load {@link Customization}s.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface ILoadCustomizationsDialog<D> {
+
+ /**
+ * Opens the dialog and blocks until it closes.
+ *
+ * @return the dialog's return code
+ */
+ int open();
+
+ /** Opens the dialog asynchronously */
+ void asyncOpen();
+
+ /**
+ * Emulate a press on the OK button
+ *
+ * @since 0.2
+ */
+ D pressOk();
+
+ /** Selects the given customization in the left "available customizations" pane */
+ void selectAvailableCustom(Customization customization);
+
+ /**
+ * Moves the customizations selected in the left "available customizations" pane to the right
+ * "loaded customizations" pane.
+ */
+ void loadSelectedCustoms();
+
+ /** Selects the given customization in the right "loaded customizations" pane */
+ void selectSelectedCustom(Customization customization);
+
+ /**
+ * Moves the customizations selected in the right "loaded customizations" pane to the left
+ * "available customizations" pane.
+ */
+ void unloadSelectedCustoms();
+
+ /**
+ * This method is used to add a customization on the top of the
+ * customization stack.
+ *
+ * @param customization
+ * must be one element of the list returned by {@link
+ * ICustomizationLoaderDialo.getAvailableCustomizations()}
+ * @throws IllegalParameterException
+ * when the parameter is not one element of the list returned by
+ * {@link
+ * ICustomizationLoaderDialo.getAvailableCustomizations()}
+ */
+ void addCustomization(Customization customization)
+ throws IllegalParameterException;
+
+ /**
+ * This method is used to add customizations on the top of the customization
+ * stack.
+ *
+ * @param customizations
+ * must be one element of the list returned by {@link
+ * ICustomizationLoaderDialo.getAvailableCustomizations()}
+ * @throws IllegalParameterException
+ * when one of the element of the parameter list in not one
+ * element of the list returned by {@link
+ * ICustomizationLoaderDialo.getAvailableCustomizations()}
+ */
+ void addCustomizations(List<Customization> customizations)
+ throws IllegalParameterException;
+
+ /**
+ * This method is used to remove a customization from the list.
+ *
+ * @param customization
+ * must be one element of the list returned by {@link
+ * ICustomizationLoaderDialo.getSelectedCustomizations()}
+ * @throws IllegalParameterException
+ * when the parameter is not one element of the list returned by
+ * {@link ICustomizationLoaderDialo.getSelectedCustomizations()}
+ */
+ void removeCustomization(Customization customization)
+ throws IllegalParameterException;
+
+ /**
+ * This method is used to remove a list of customization from the list.
+ *
+ * @param customizations
+ * must be one element of the list returned by {@link
+ * ICustomizationLoaderDialo.getSelectedCustomizations()}
+ * @throws IllegalParameterException
+ * when one of the element of the parameter list in not one
+ * element of the list returned by {@link
+ * ICustomizationLoaderDialo.getSelectedCustomizations()}
+ */
+ void removeCustomizations(List<Customization> customizations)
+ throws IllegalParameterException;
+
+ /**
+ * Cancel the dialog
+ */
+ void cancel();
+
+ /**
+ * Validate the dialog
+ */
+ void validate();
+
+ /**
+ * The intersection between getSelectedCustomizations() and
+ * getAvailableCustomizations') has to be empty.
+ *
+ * @return the customizations selected using the dialog.
+ */
+ List<Customization> getSelectedCustomizations();
+
+ /**
+ * The intersection between getSelectedCustomizations() and
+ * getAvailableCustomizations') has to be empty.
+ *
+ * @return the available and not yet selected customizations
+ */
+ List<Customization> getAvailableCustomizations();
+
+ /**
+ * This method is used to push up a customization.
+ *
+ * @param customization
+ * a selected customization.
+ * @throws IllegalParameterException
+ * when the parameter in not on element of the list returned by
+ * getSelectedCustomizations().
+ */
+ void pushUp(Customization customization) throws IllegalParameterException;
+
+ /**
+ * This method is used to push down a customization.
+ *
+ * @param customization
+ * a selected customization.
+ * @throws IllegalParameterException
+ * when the parameter in not on element of the list returned by
+ * getSelectedCustomizations().
+ */
+ void pushDown(Customization customization) throws IllegalParameterException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java
new file mode 100644
index 00000000000..126ce512c00
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported.dialog;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.dialog.LoadCustomizationsDialogFactory;
+import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Factory for {@link ILoadCustomizationsDialog}.
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 0.2.0
+ */
+public interface ILoadCustomizationsDialogFactory {
+ /** The default implementation */
+ ILoadCustomizationsDialogFactory DEFAULT = new LoadCustomizationsDialogFactory();
+
+ /**
+ * @param parent
+ * the parent shell
+ * @param availableCustoms
+ * the customizations that the user will be able to select
+ * @param selectedCustoms
+ * the customizations that will be selected when the dialog opens
+ * @param listener
+ * called when the dialog closes
+ * @return the dialog
+ * @since 0.2
+ */
+ <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent,
+ final List<Customization> availableCustoms,
+ final List<Customization> selectedCustoms,
+ IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback);
+
+ /**
+ * @param parent
+ * the parent shell
+ * @param availableCustoms
+ * the customizations that the user will be able to select
+ * @param selectedCustoms
+ * the customizations that will be selected when the dialog opens
+ * @param lockedCustoms
+ * a list of customizations that the user will not be able to unload
+ * @param listener
+ * called when the dialog closes
+ * @param lockMsg
+ * a message indicating why certain customizations cannot be unloaded
+ * @return the dialog
+ * @since 0.2
+ */
+ <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent,
+ final List<Customization> availableCustoms,
+ final List<Customization> selectedCustoms,
+ final List<Customization> lockedCustoms,
+ IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback,
+ String lockMsg);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java
new file mode 100644
index 00000000000..dbf51a20f27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ */
+package org.eclipse.emf.facet.custom.ui.internal.exported.exception;
+
+import java.util.List;
+
+public class IllegalParameterException extends Exception {
+
+ private static final long serialVersionUID = 2470355059500176931L;
+ private final List<? extends Object> illegalParameters;
+
+ public IllegalParameterException(
+ final List<? extends Object> illegalParameters) {
+ super();
+ this.illegalParameters = illegalParameters;
+ }
+
+ public IllegalParameterException(final String message,
+ final List<? extends Object> illegalParameters) {
+ super(message);
+ this.illegalParameters = illegalParameters;
+ }
+
+ public IllegalParameterException(final Throwable cause,
+ final List<? extends Object> illegalParameters) {
+ super(cause);
+ this.illegalParameters = illegalParameters;
+ }
+
+ public IllegalParameterException(final String message,
+ final Throwable cause,
+ final List<? extends Object> illegalParameters) {
+ super(message, cause);
+ this.illegalParameters = illegalParameters;
+ }
+
+ /**
+ * @return the illegalParameters
+ */
+ public List<? extends Object> getIllegalParameters() {
+ return this.illegalParameters;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties
new file mode 100644
index 00000000000..2c6eb227231
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties
@@ -0,0 +1,55 @@
+###############################################################################
+# Copyright (c) 2009 Mia-Software.
+# 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:
+# Nicolas Bros (Mia-Software) - initial API and implementation
+# Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+# Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2
+# Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+# Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog
+###############################################################################
+CustomizationsCatalogView_title=Customizations
+CustomizationsView_allQuerySets=all
+CustomizationsView_jobName_RefreshCustomizationsView=Refresh Customizations View
+CustomizationsView_extendsColumn=Extends
+CustomizationsView_nameColumn=Name
+CustomizationsView_documentationColumn=Documentation
+CustomizedLabelProvider_null=null
+NewCustomizationFilePage_browserCustomization=Browser Customization
+NewCustomizationFilePage_createsBrowserCustomization=Creates a new Browser Customization
+NewCustomizationFilePage_customizationInNonEmfFacetProject=Warning : you are creating this Customization in a non-EmfFacet project. It will not be available until moved to a EmfFacet project.
+NewCustomizationWizard_newBrowserCustomization=New Browser Customization
+QuerySetsSelectionControl_allExistingQuerySets=all existing query sets
+QuerySetsSelectionControl_availableQuerySets=Available query sets:
+QuerySetsSelectionControl_deselectAll=Deselect All
+QuerySetsSelectionControl_querySetsSelectedBelowOnly=query sets selected below only
+QuerySetsSelectionControl_selectAll=Select All
+SelectMetamodelsPage_selectMetamodel=Select Metamodel
+SelectMetamodelsPage_selectMetamodelToCustomize=Select the metamodel to which the new browser customization will apply
+SelectQuerySetsPage_selectAvailableQuerySets=Select Available Query Sets
+SelectQuerySetsPage_selectAvailableQuerySetsInCustomization=Select the query sets that will be available in the customization
+ToolTipTextQuery_Documentation={0}
+ToolTipTextQuery_NoDocumentation=No documentation
+LoadCustomizationsDialog_Add=>
+LoadCustomizationsDialog_Add2=Add
+LoadCustomizationsDialog_AddAll=>>
+LoadCustomizationsDialog_AddAll2=Add All
+LoadCustomizationsDialog_AvailiableCustom=Available Customizations
+LoadCustomizationsDialog_Can_not_be_unload=The local customization can't be unloaded.
+LoadCustomizationsDialog_Down=Down
+LoadCustomizationsDialog_LoadedCustomizations=Loaded Customizations
+LoadCustomizationsDialog_LoadCustomizationWarning=Load Customizations Warning
+LoadCustomizationsDialog_Loading=Loading...
+LoadCustomizationsDialog_loadReferencedFacetsCheckbox=Load referenced facets
+LoadCustomizationsDialog_OK=OK
+LoadCustomizationsDialog_Remove=<
+LoadCustomizationsDialog_Remove2=Remove
+LoadCustomizationsDialog_RemoveAll=<<
+LoadCustomizationsDialog_RemoveAll2=Remove All
+LoadCustomizationsDialog_title_LoadCustomizations=Load Customizations
+LoadCustomizationsDialog_type_filter_test=type filter text
+LoadCustomizationsDialog_Up=Up
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java
new file mode 100644
index 00000000000..b759212194e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IColor;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.Color;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+public class BackgroundQuery implements IJavaQuery2<EObject, IColor> {
+
+ public IColor evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return new Color(Color.MAX_VALUE, Color.MAX_VALUE, Color.MAX_VALUE);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java
new file mode 100644
index 00000000000..e338177bc61
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.swt.widgets.Display;
+
+public class FontNameQuery implements IJavaQuery2<EObject, String> {
+
+ public String evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Display.getDefault().getSystemFont().getFontData()[0].getName();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java
new file mode 100644
index 00000000000..0429f5cf358
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.swt.widgets.Display;
+
+public class FontSizeQuery implements IJavaQuery2<EObject, Integer> {
+
+ public Integer evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Integer.valueOf(Display.getDefault().getSystemFont().getFontData()[0].getHeight());
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java
new file mode 100644
index 00000000000..a4ecb4db938
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IColor;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.Color;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+public class ForegroundQuery implements IJavaQuery2<EObject, IColor> {
+
+ public IColor evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return new Color(0, 0, 0);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java
new file mode 100644
index 00000000000..2397e2bf1b8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java
@@ -0,0 +1,127 @@
+/**
+ * Copyright (c) 2011, 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IImage;
+import org.eclipse.emf.facet.custom.ui.internal.Activator;
+import org.eclipse.emf.facet.custom.ui.internal.ImageProvider;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider;
+import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public class ImageQuery implements IJavaQuery2<EObject, IImage> {
+
+ public IImage evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ IImage result = null;
+ ETypedElement sfParam = null;
+ if (parameterValues != null) {
+ sfParam = (ETypedElement) parameterValues
+ .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$
+ }
+ if (sfParam == null) {
+ result = getEObjectImage(source);
+ } else {
+ result = getLinkImage(sfParam);
+ }
+ return result;
+ }
+
+ protected static IImage getEObjectImage(final EObject source) {
+ IImage result = null;
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory
+ .adapt(source, IItemLabelProvider.class);
+ if (itemLabelProvider != null) {
+ final ImageDescriptor imgDescriptor = ExtendedImageRegistry
+ .getInstance().getImageDescriptor(source);
+ final IImageProvider imgProvider = IImageProviderFactory.DEFAULT
+ .createIImageProvider(Activator.getDefault());
+ if (imgDescriptor != null) {
+ final Image image = imgProvider.getImage(imgDescriptor);
+ result = new ImageWrapper(image);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the image for an attribute or reference link.
+ *
+ * @param sfParam
+ * the attribute or reference
+ * @param source
+ * the EObject under which the attribute or reference appears
+ * @return the image
+ */
+ private static IImage getLinkImage(final ETypedElement sfParam) {
+ Image image = null;
+ if (sfParam instanceof FacetReference) {
+ image = ImageProvider.getInstance().getFacetLinkIcon();
+ } else if (sfParam instanceof EReference) {
+ image = getReferenceImage((EReference) sfParam);
+ } else if (sfParam instanceof FacetAttribute) {
+ image = ImageProvider.getInstance().getFacetAttributeIcon();
+ } else if (sfParam instanceof EAttribute) {
+ image = getAttributeImage();
+ } else {
+ image = ImageProvider.getInstance().getFeatureIcon();
+ }
+ return new ImageWrapper(image);
+ }
+
+ private static Image getReferenceImage(final EReference reference) {
+ Image result;
+ final EReference opposite = reference.getEOpposite();
+ if (reference.isContainment()) {
+ if (opposite == null) {
+ result = ImageProvider.getInstance().getUnidirectionalAggregIcon();
+ } else {
+ result = ImageProvider.getInstance().getAggregIcon();
+ }
+ } else {
+ if (opposite != null && opposite.isContainment()) {
+ result = ImageProvider.getInstance().getInvAggregIcon();
+ } else if (opposite == null) {
+ result = ImageProvider.getInstance().getUnidirectionalLinkIcon();
+ } else {
+ result = ImageProvider.getInstance().getLinkIcon();
+ }
+ }
+ return result;
+ }
+
+ private static Image getAttributeImage() {
+ return ImageProvider.getInstance().getAttributeIcon();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java
new file mode 100644
index 00000000000..e68597d4aee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java
@@ -0,0 +1,136 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>)
+ * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
+ */
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProvider;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.emf.facet.util.emf.core.ModelUtils;
+
+public class LabelQuery implements IJavaQuery2<EObject, String> {
+
+ private static final String NAME = "name"; //$NON-NLS-1$
+
+ public String evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ ETypedElement sfParam = null;
+ if (parameterValues != null) {
+ sfParam = (ETypedElement) parameterValues
+ .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$
+ }
+ String result = null;
+ if (sfParam == null) {
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory
+ .adapt(source, IItemLabelProvider.class);
+ // We don't want to use a ReflectiveItemProvider because it provides
+ // a string prefixed with the eObject's meta-class name.
+ if (itemLabelProvider instanceof ReflectiveItemProvider) {
+ result = LabelQuery.getDefaultName(source);
+ } else if (itemLabelProvider == null) {
+ result = ModelUtils.getDefaultName(source);
+ } else {
+ result = itemLabelProvider.getText(source);
+ }
+ } else {
+ try {
+ if (sfParam instanceof EAttribute && sfParam.getUpperBound() == 1) {
+ final Object object = facetManager.getOrInvoke(source, sfParam, Object.class);
+ final String objectLabel = getObjectLabel(object, facetManager);
+ result = sfParam.getName() + " = " + objectLabel; //$NON-NLS-1$
+ } else {
+ result = sfParam.getName();
+ }
+ } catch (final Exception e) {
+ throw new DerivedTypedElementException(e);
+ }
+ }
+ return result;
+ }
+
+ private String getObjectLabel(final Object object,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ String result;
+ if (object instanceof EObject) {
+ final EObject eObject = (EObject) object;
+ result = evaluate(eObject, null, facetManager);
+ } else {
+ result = String.valueOf(object);
+ }
+ return result;
+ }
+
+ /**
+ * @return a default name based on a string feature of the given
+ * {@link EObject}
+ */
+ // from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils
+ public static String getDefaultName(final EObject eObject) {
+ String result = ""; //$NON-NLS-1$
+ // find a feature that can be used as a name
+ final EStructuralFeature feature = LabelQuery.getLabelFeature(eObject
+ .eClass());
+ if (feature != null) {
+ result = (String) eObject.eGet(feature);
+ }
+ return result;
+ }
+
+ /**
+ * This method searches for a structural feature that can be used as a name
+ *
+ * @param eClass
+ * in which class to search a structural feature that can be used as
+ * a name
+ * @return an EStructuralFeature
+ */
+ // Copied from org.eclipse.emf.edit.provider.ReflectiveItemProvider to org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils
+ // Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils
+ private static EStructuralFeature getLabelFeature(final EClass eClass) {
+ EAttribute result = null;
+ for (final EAttribute eAttribute : eClass.getEAllAttributes()) {
+ if (!eAttribute.isMany()
+ && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) {
+ if (LabelQuery.NAME.equalsIgnoreCase(eAttribute
+ .getName())) {
+ result = eAttribute;
+ break;
+ } else if (result == null) {
+ result = eAttribute;
+ } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class
+ && result.getEAttributeType().getInstanceClass() != String.class) {
+ result = eAttribute;
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java
new file mode 100644
index 00000000000..3597ae09e4c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+/**
+ * This is the query that returns the default selection for a given source and feature (i.e. row and column in a table).
+ * By default, the selection is the {@link EObject} (or list of {@link EObject}s) returned by evaluating the feature on
+ * the source.
+ */
+public class SelectionQuery implements IJavaQuery2<EObject, List<Object>> {
+
+ // @SuppressWarnings("unchecked") : facet manager is not type safe
+ @SuppressWarnings("unchecked")
+ public List<Object> evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ if (parameterValues.size() != 1) {
+ throw new DerivedTypedElementException("the selection query expects one argument"); //$NON-NLS-1$
+ }
+ final Object param1 = parameterValues.get(0).getValue();
+ if (!(param1 instanceof ETypedElement)) {
+ throw new DerivedTypedElementException("the selection query expects an ETypedElement argument"); //$NON-NLS-1$
+ }
+ final ETypedElement feature = (ETypedElement) param1;
+
+ final List<Object> result;
+ try {
+ final Object featureResult = facetManager.getOrInvoke(source, feature, null);
+ if (feature.isMany()) {
+ result = (List<Object>) featureResult;
+ } else {
+ result = Collections.singletonList(featureResult);
+ }
+ } catch (FacetManagerException e) {
+ throw new DerivedTypedElementException(e);
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java
new file mode 100644
index 00000000000..e4e82000f76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ *
+ *****************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+/**
+ *
+ * This query is used to get the default alignment for the tooltip texts
+ *
+ */
+public class ToolTipAlignmentQuery implements IJavaQuery2<EObject, Alignment> {
+
+ public Alignment evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Alignment.LEFT;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java
new file mode 100644
index 00000000000..283052d3b43
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ *
+ *****************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.custompt.IColor;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.Color;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+/**
+ *
+ * This query is used to get the default background color for the tooltips (255,255,225)
+ *
+ */
+public class ToolTipBackgroundQuery implements IJavaQuery2<EObject, IColor> {
+
+ private static final int BCK_GND_BLUE = 225;
+
+ public IColor evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ //default yellow background for tooltip
+ return new Color(Color.MAX_VALUE, Color.MAX_VALUE, ToolTipBackgroundQuery.BCK_GND_BLUE);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java
new file mode 100644
index 00000000000..40fe97a7073
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ *
+ *****************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+/**
+ *
+ * This query is used to get the default time for the tooltips
+ *
+ */
+public class ToolTipDelayQuery implements IJavaQuery2<EObject, Integer> {
+
+ public Integer evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Integer.valueOf(0);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java
new file mode 100644
index 00000000000..e0077edb17b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider
+ *
+ *****************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+
+/**
+ *
+ * This query is used to get the default shadow for the tooltips
+ *
+ */
+public class ToolTipShadowQuery implements IJavaQuery2<EObject, Shadow> {
+
+ public Shadow evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ return Shadow.NONE;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java
new file mode 100644
index 00000000000..2521276df6f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog
+ *
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.ui.internal.Messages;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement;
+import org.eclipse.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ * This query returns the tooltip to display for DocumentedElement and
+ * EModelElement
+ *
+ */
+public class ToolTipTextQuery implements IJavaQuery2<EObject, String> {
+
+ /** the URI used by EAnnotation for the documentation for the documentation */
+ public static final String URI_GEN_MODEL = "http://www.eclipse.org/emf/2002/GenModel"; //$NON-NLS-1$
+
+ /** the key to get the documentation in an EAnnotation */
+ public static final String DOCUMENTATION = "documentation"; //$NON-NLS-1$
+
+ /** the String displayed when there is no documentation */
+ public static final String NO_DOCUMENTATION = Messages.ToolTipTextQuery_NoDocumentation;
+
+ public String evaluate(final EObject source,
+ final IParameterValueList2 parameterValues,
+ final IFacetManager facetManager) {
+ String result = null;
+ final String documentation = getDocumentation(source);
+ if (documentation != null) {
+ result = NLS.bind(Messages.ToolTipTextQuery_Documentation,
+ documentation);
+ }
+ return result;
+ }
+
+ /**
+ *
+ * @param source
+ * @param parameterValues
+ * @param facetManager
+ * @return the documentation for DocumentedElement and EModelElement
+ */
+ private static String getDocumentation(final EObject source) {
+ String documentation = ""; //$NON-NLS-1$
+ if (source instanceof DocumentedElement) {
+ documentation = ((DocumentedElement) source).getDocumentation();
+ } else if (source instanceof EModelElement) {
+ final EAnnotation eAnnotation = ((EModelElement) source)
+ .getEAnnotation(ToolTipTextQuery.URI_GEN_MODEL);
+ if (eAnnotation != null) {
+ documentation = eAnnotation.getDetails().get(
+ ToolTipTextQuery.DOCUMENTATION);
+ }
+ }
+ return documentation;
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java
new file mode 100644
index 00000000000..88111e8211a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ */
+
+package org.eclipse.emf.facet.custom.ui.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage;
+import org.eclipse.emf.facet.custom.ui.internal.querytype.URIImageQueryEvaluator;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.osgi.framework.Bundle;
+
+public class URIImageQueryImplementationFactory implements
+ IQueryImplementationFactory {
+
+ public IQueryImplementation create(final Query query,
+ final Bundle queryBundle, final IDerivedTypedElementManager manager)
+ throws DerivedTypedElementException {
+ return new URIImageQueryEvaluator();
+ }
+
+ public EClass getManagedQueryType() {
+ return QueryPackage.eINSTANCE.getURIImageQuery();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java
new file mode 100644
index 00000000000..d6fe2627c66
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2013 Soft-Maint.
+ *
+ * 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:
+ * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI
+ */
+package org.eclipse.emf.facet.custom.ui.internal.querytype;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery;
+import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+public class URIImageQueryEvaluator implements IQueryImplementation {
+
+ public void setValue(final Query query,
+ final DerivedTypedElement feature, final EObject source,
+ final List<ParameterValue> parameterValues,
+ final Object newValue) throws DerivedTypedElementException {
+ throw new DerivedTypedElementException("Not implemented method"); //$NON-NLS-1$
+ }
+
+ public boolean isCheckResultType() {
+ return false;
+ }
+
+ public Object getValue(final Query query,
+ final DerivedTypedElement feature, final EObject source,
+ final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ // This cast is safe. The framework should only pass a query
+ // instance of URIImageQuery, because it has been declared in
+ // the method 'getManagedQueryType' that this query
+ // implementation is dedicated to the URIImageQuery type.
+ final String uri = ((URIImageQuery) query).getUri();
+ return new URIImage(uri);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java
new file mode 100644
index 00000000000..a976cf34077
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2012 Mia-Software.
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.ui.internal.view;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IExecutableExtensionFactory;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription;
+import org.eclipse.emf.facet.common.ui.internal.exported.views.IElementsViewFactory;
+import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager;
+import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
+import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.ui.internal.ImageProvider;
+import org.eclipse.emf.facet.custom.ui.internal.Messages;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+
+public class CustomizationsCatalogView implements IExecutableExtensionFactory, IOpenListener {
+
+ public Object create() throws CoreException {
+ this.customizationCatalogManager = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(new ResourceSetImpl());
+ Collection<IColumnDescription> columnDescriptions = new ArrayList<IColumnDescription>();
+ columnDescriptions.add(createNameColumnDescription());
+ columnDescriptions.add(createExtendsColumnDescription());
+ columnDescriptions.add(createDocumentationColumnDescription());
+ return IElementsViewFactory.DEFAULT.createElementsView(columnDescriptions, getContentProvider(), getInput(),
+ Messages.CustomizationsCatalogView_title, ImageProvider.getInstance().getUiCustomIcon(), this);
+ }
+
+ private static final String NAME_COLUMN = "CustomizationsView_NameColumn"; //$NON-NLS-1$
+ private static final String EXTENDS_COLUMN = "CustomizationsView_ExtendsColumn"; //$NON-NLS-1$
+ private static final String DOCUMENTATION_COLUMN = "CustomizationsView_DocumentationColumn"; //$NON-NLS-1$
+
+ private static final int NAME_COLUMN_WIDTH = 300;
+ private static final int EXTENDS_COLUMN_WIDTH = 300;
+ private static final int DOCUMENTATION_COLUMN_WIDTH = 400;
+
+ private ICustomizationCatalogManager customizationCatalogManager;
+
+ private static IColumnDescription createNameColumnDescription() {
+ ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ String result;
+ if (element instanceof ENamedElement) {
+ ENamedElement namedElement = (ENamedElement) element;
+ result = namedElement.getName();
+ } else {
+ result = "<" + element.getClass().getName() + ">"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+ return result;
+ }
+
+ @Override
+ public Image getImage(final Object element) {
+ return ImageProvider.getInstance().getUiCustomIcon();
+ }
+ };
+ return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_nameColumn, CustomizationsCatalogView.NAME_COLUMN,
+ CustomizationsCatalogView.NAME_COLUMN_WIDTH, columnLabelProvider);
+ }
+
+ private static IColumnDescription createExtendsColumnDescription() {
+ ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ String result = null;
+ if (element instanceof Customization) {
+ Customization customization = (Customization) element;
+ EPackage customizedEPackage = CustomizationUtils
+ .getCustomizedEPackage(customization);
+ if (customizedEPackage != null) {
+ result = customizedEPackage.getNsURI();
+ }
+ } else if (element instanceof Facet) {
+ Facet facet = (Facet) element;
+ EClass extendedMetaclass = facet.getExtendedMetaclass();
+ if (extendedMetaclass != null) {
+ result = extendedMetaclass.getName();
+ }
+ }
+ return result;
+ }
+ };
+ return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_extendsColumn,
+ CustomizationsCatalogView.EXTENDS_COLUMN,
+ CustomizationsCatalogView.EXTENDS_COLUMN_WIDTH, columnLabelProvider);
+ }
+
+ private static IColumnDescription createDocumentationColumnDescription() {
+ ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() {
+ @Override
+ public String getText(final Object element) {
+ String result = null;
+ if (element instanceof DocumentedElement) {
+ DocumentedElement documentedElement = (DocumentedElement) element;
+ result = documentedElement.getDocumentation();
+ }
+ return result;
+ }
+ };
+ return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_documentationColumn,
+ CustomizationsCatalogView.DOCUMENTATION_COLUMN, CustomizationsCatalogView.DOCUMENTATION_COLUMN_WIDTH,
+ columnLabelProvider);
+ }
+
+ protected static ITreeContentProvider getContentProvider() {
+ return new ITreeContentProvider() {
+ public Object[] getElements(final Object inputElement) {
+ @SuppressWarnings("unchecked")
+ final Collection<Customization> customizations = (Collection<Customization>) inputElement;
+ return customizations.toArray();
+ }
+
+ public void inputChanged(final Viewer viewer, final Object oldInput,
+ final Object newInput) {
+ // nothing
+ }
+
+ public void dispose() {
+ // nothing
+ }
+
+ public boolean hasChildren(final Object element) {
+ Object[] children = getChildren(element);
+ return children != null && children.length > 0;
+ }
+
+ public Object getParent(final Object element) {
+
+ Object result;
+ if (element instanceof EObject) {
+ EObject eObject = (EObject) element;
+ result = eObject.eContainer();
+ } else {
+ result = null;
+ }
+ return result;
+ }
+
+ public Object[] getChildren(final Object parentElement) {
+ Object[] result;
+ if (parentElement instanceof Customization) {
+ final Customization customization = (Customization) parentElement;
+ final List<Object> contents = new ArrayList<Object>();
+ // Aggregate
+ for (final FacetSet facetSet : customization.getFacetSets()) {
+ if (facetSet instanceof Customization) {
+ final Customization childCustom = (Customization) facetSet;
+ contents.add(childCustom);
+ }
+ }
+ contents.addAll(customization.getEClassifiers());
+ result = contents.toArray();
+ } else {
+ result = new Object[0];
+ }
+ return result;
+ }
+ };
+ }
+
+ protected Object getInput() {
+ return this.customizationCatalogManager.getRegisteredCustomizations();
+ }
+
+ public void open(final OpenEvent event) {
+ // TODO: re-enable once the customization editor is written
+
+ // final MetamodelView metamodelView = (MetamodelView) element;
+ // // open customization in editor
+ // try {
+ // org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI
+ // .createURI(metamodelView.getLocation());
+ // if (uri.isPlatformResource()) {
+ // IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ // new Path(uri.toPlatformString(true)));
+ // FileEditorInput fileEditorInput = new FileEditorInput(file);
+ // IDE.openEditor(
+ // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
+ // fileEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true);
+ // } else {
+ // final URIEditorInput uriEditorInput = new URIEditorInput(
+ // org.eclipse.emf.common.util.URI.createURI(uri.toString()));
+ // IDE.openEditor(
+ // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
+ // uriEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true);
+ // }
+ //
+ // } catch (final Exception e) {
+ // Activator.logException(e);
+ // }
+ }
+
+}

Back to the top